06.03.2012, 04:57
There's no way to make it save instantly?
EDIT: I've added this, to the command.
Would that save it, after I processed the command?
Here's the full command.
This is under OnPlayerDisconnect.
EDIT: I've added this, to the command.
pawn Код:
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]+=iAmount);
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]-=iAmount);
INI_Close(File);
pawn Код:
new iPlayer;
new iAmount;
new iReason[MAX_STRINGS];
Here's the full command.
pawn Код:
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie
{
new iPlayer;
new iAmount;
new iReason[MAX_STRINGS];
new str[256];
if(sscanf(params, "usS[250]",iPlayer, iAmount, iReason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecookie [Player ID] [Amount] [Reason]");
if(!IsPlayerConnected(iPlayer)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "PlayerID is not connected.");
if(PlayerInfo[playerid][pAdmin]>=2)
{
format(str, sizeof(str), "%s has received %s Cookies by Administrator %s. Reason:%s ",GetName(iPlayer), iAmount, GetName(playerid), iReason);
SendClientMessageToAll(COLOR_ORANGE, str);
format(str, sizeof(str), "You just gave a cookie to %s.", GetName(iPlayer));
SendClientMessage(playerid, COLOR_GREEN, str);
// PlayerInfo[iPlayer][pCookies] ++;
PlayerInfo[playerid][pCookies] += iAmount;
PlayerInfo[playerid][pCookies]-= iAmount;
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]+=iAmount);
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]-=iAmount);
INI_Close(File);
}
else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
return 1;
}
pawn Код:
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);