Y_INI: Can i get how much is the player's money while he's offline?
#8

Would you please tell how it works step by step on this command? this would be easily to understand.
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;
}
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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)