02.07.2013, 01:11
Try this:
pawn Код:
CMD:addcashoffline(playerid, params[])
{
new offlineplayer[24], filestring[79], cash;
if(sscanf(params, "s[24]i", offlineplayer, cash)) return SendClientMessage(playerid, COLOR_RED, "/addcashoff NAME CASH");
format(filestring, sizeof(filestring), AccountsPath, offlineplayer);
if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_RED, "No palyer but that name");
INI_ParseFile(filestring, "LoadAccountOffline_%s", .bExtra = true , .extra = offlineplayer);
new INI:File = INI_Open(filestring);
INI_WriteInt(File, "Cash", PlayerData[offlineplayer][pCash]+cash);
INI_Close(File);
format(gstring, sizeof(gstring), "%s now has $%d", offlineplayer, PlayerData[offlineplayer][pCash]+cash);
SendClientMessage(playerid, COLOR_RED, gstring);
return 1;
}
forward LoadAccountOffline_user(offlineplayer[24], name[], value[]);
public LoadAccountOffline_user(offlineplayer[24], name[], value[])
{
INI_Int("Cash", PlayerData[offlineplayer][pCash]);
return 1;
}