How to make a /checkcookies command? Partially done.
#3

Quote:
Originally Posted by BigETI
Посмотреть сообщение
Get the variable of the "player cookies", and in format just add the %d or %i to add numbers inside a string.

pawn Код:
CMD:cookies(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cookies [Player ID]");
    if(id == INVALID_PLAYER_ID) retur SendClientMessage(playerid, 0xFF0000, "This player is not connected!");
    new str[64];
    format(str, sizeof(str), "%s(%d) does have %d cookies.", GetName(id), id, /*Put here the player variable of the cookies*/);
    SendClientMessage(playerid, COLOR_WHITE, str);
    return 1;
}
Thanks man.
EDIT: Do you happen to know how to save it instantly, when I do the command /givecookie? I saves when I relog, but not instantly. Here's my current /givecookie command.
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);
     new INI:File = INI_Open(UserPath(playerid));
     INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
     INI_Close(File);
     PlayerInfo[pid][pCookies] ++;
    }
    else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
    return 1;
}
Reply


Messages In This Thread
How to make a /checkcookies command? Partially done. - by rangerxxll - 06.03.2012, 02:29
AW: How to make a /checkcookies command? Partially done. - by BigETI - 06.03.2012, 02:38
Re: AW: How to make a /checkcookies command? Partially done. - by rangerxxll - 06.03.2012, 02:44

Forum Jump:


Users browsing this thread: 1 Guest(s)