Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * GVars System
- * Variables per Name in Pawn
- * Author: Bruno da Silva
- * Site: www.ips-team.blogspot.com
- * Date: 19:08 21/08/2011
- * (C) Copyright [iPs]TeaM
- *
- */
- enum gVars
- {
- gVarName[32],
- gVarValue[128]
- };
- new
- gVarData[100][gVars],
- maxGVars = 0,
- bool:encontrado = false
- ;
- SetGVarString(varName[], valueVar[128])
- {
- for(new i = 0; i != maxGVars; i++) if(gVarData[i][gVarName][0] && !strcmp(gVarData[i][gVarName], varName, true))
- {
- gVarData[i][gVarValue] = valueVar;
- encontrado = true;
- break;
- }
- if(!encontrado)
- {
- format(gVarData[++maxGVars][gVarName],128, "%s", varName);
- gVarData[maxGVars][gVarValue] = valueVar;
- }
- return ++maxGVars, encontrado = false;
- }
- GetGVarString(varName[])
- {
- static returnString[128] = "Invalid GVar";
- for(new i; i != maxGVars; i++) if(gVarData[i][gVarName][0] && !strcmp(gVarData[i][gVarName], varName, true))
- {
- format(returnString, 128, gVarData[i][gVarValue]);
- break;
- }
- return returnString;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement