14.02.2012, 15:06
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;
}