14.02.2012, 14:58
I was updating my JMTDM script to new version and when I scripted this /givecookie CMD it bugged. When I type integer reason then it works good... Else if it's string then it bugs me with SERVER: Unknown command! Help me to fix that!
Код:
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie { new pid; new reason; new str[128]; if(sscanf(params, "us", 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[playerid][pCookies]=PlayerInfo[playerid][pCookies]+1; } else SendClientMessage(playerid, COLOR_RED, "You must be an admin to use that command!"); return 1; }