25.12.2014, 16:18
(
Last edited by Juvanii; 25/12/2014 at 06:33 PM.
)
Would you please tell how it works step by step on this command? this would be easily to understand.
i already have a variable to store the player's money defined through an enum.
- What did you mean by {0 bla bla} after defining the variable?
- Does 'playerid' in INI_ParseFile where it's in the command return the admin's id? if so, it will load the admin's money who used the command, or what
pawn Code:
CMD:increasecash(playerid, params[]) //admin using the command to increase a disconnected player's money
{
new string[128], name[64], money;
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "s[64]i", name, money)) return SendClientMessage(playerid, -1, "/refund [player name] [money]");
format(string,sizeof(string),"/JCNR/Users/%s.ini", name);
if(!fexist(string)) return SendClientMessage(playerid, -1, "Invalid Player.");
INI_ParseFile(string, "LoadUser_%s", .bExtra = true, .extra = playerid);
new INI:File = INI_Open(string);
INI_SetTag(File,"UserData");
INI_WriteInt(File,"Cash", PlayerInfo[playerid][pCash] + money);
INI_Close(File);
return 1;
}
forward LoadUser_UserData(playerid, name[], value[]);
public LoadUser_UserData(playerid, name[], value[])
{
INI_Int("Cash", PlayerInfo[playerid][pCash]);
return 1;
}
- What did you mean by {0 bla bla} after defining the variable?
- Does 'playerid' in INI_ParseFile where it's in the command return the admin's id? if so, it will load the admin's money who used the command, or what