Help with a cookie system. ++rep
#1

Hello.
I'm currently making a cookie system, and It's going well so far. Here's what I currently have.
pawn Код:
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie
{
    new pid;
    new reason[128];
    new str[128];
    if(sscanf(params, "us[128]", pid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecookie [Player ID] [Reason]");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "PlayerID is not connected.");
    if(PlayerInfo[playerid][pAdmin]>=2)
    {
     format(str, sizeof(str), "%s has been granted a cookie by Administrator %s. Reason: (%s)", GetName(pid), GetName(playerid), reason);
     SendClientMessageToAll(COLOR_ORANGE, str);
     format(str, sizeof(str), "You just gave a cookie to %s.", GetName(pid));
     SendClientMessage(playerid, COLOR_GREEN, str);
     PlayerInfo[pid][pCookies] ++;
    }
    else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
    return 1;
}
pawn Код:
CMD:resetcookies(playerid, params[])
{
        new pid;
        new reason[128];
        new str[128];
        if(sscanf(params, "us[128]", pid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /resetcookies [Player ID] [Reason]");
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: Player is not connected");
        if(PlayerInfo[playerid][pAdmin]>=2)
        {
        format(str, sizeof(str), "Administrator %s has reset %s's Cookies. Reason: (%s)", GetName(playerid), GetName(pid), reason);
        SendClientMessageToAll(COLOR_ORANGE, str);
        format(str, sizeof(str), "You just reset %s's Cookies.", GetName(pid));
        SendClientMessage(playerid, COLOR_GREEN, str);
        PlayerInfo[pid][pCookies] = 0;
        }
        else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
        return 1;
  }
Alright, so say I wanted to make a /buyvip command. And the person needs 5 cookies to buy it. How could I take away 5 cookies, without deleting them all?

Also... When I /give the player a cookie, it doesn't save in the scriptfiles until he logs out. How could I save it instantly?

Thanks for your help.
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)