/givecookie bug
#6

sscanf needs for string "s[value]". Also, you have to define reason as a string with array.
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_RED, "PlayerID is not connected.");
    if (PlayerInfo[playerid][pAdmin]>=4)
    {
     format(str, sizeof(str), "%s have been granted a cookie by %s. Reason: %s", GetName(pid), GetName(playerid), reason);
     SendClientMessageToAll(COLOR_RED, str);
     format(str, sizeof(str), "You just gave a cookie to %s.", GetName(pid));
     SendClientMessage(playerid, COLOR_RED, str);
     PlayerInfo[pid][pCookies] ++; // ++ -> x = x + 1
    }
    else SendClientMessage(playerid, COLOR_RED, "You must be an admin to use that command!");
    return 1;
}
Reply


Messages In This Thread
/givecookie bug - by Maxandmov - 14.02.2012, 14:58
Re: /givecookie bug - by emokidx - 14.02.2012, 15:00
Re: /givecookie bug - by SpiderWalk - 14.02.2012, 15:01
Re: /givecookie bug - by Maxandmov - 14.02.2012, 15:02
Re: /givecookie bug - by Maxandmov - 14.02.2012, 15:05
Re: /givecookie bug - by Konstantinos - 14.02.2012, 15:06
Re: /givecookie bug - by Maxandmov - 14.02.2012, 15:10
Re: /givecookie bug - by Maxandmov - 14.02.2012, 15:13
Re: /givecookie bug - by Konstantinos - 14.02.2012, 15:14

Forum Jump:


Users browsing this thread: 2 Guest(s)