Help with a cookie system. ++rep
#7

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
It saves when you log out.
There's no way to make it save instantly?

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];
Would that save it, after I processed the command?
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;
}
This is under OnPlayerDisconnect.
pawn Код:
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
Reply


Messages In This Thread
Help with a cookie system. ++rep - by rangerxxll - 05.03.2012, 23:38
Re: Help with a cookie system. ++rep - by coole210 - 06.03.2012, 00:26
Re: Help with a cookie system. ++rep - by rangerxxll - 06.03.2012, 00:38
Re: Help with a cookie system. ++rep - by Chrillzen - 06.03.2012, 03:59
Re: Help with a cookie system. ++rep - by rangerxxll - 06.03.2012, 04:25
Re: Help with a cookie system. ++rep - by Chrillzen - 06.03.2012, 04:47
Re: Help with a cookie system. ++rep - by rangerxxll - 06.03.2012, 04:57
Re: Help with a cookie system. ++rep - by T0pAz - 06.03.2012, 05:08
Re: Help with a cookie system. ++rep - by rangerxxll - 06.03.2012, 05:44

Forum Jump:


Users browsing this thread: 1 Guest(s)