13.01.2013, 21:32
Hello
I have a problem with my /givecookies command.
If i give cookie to any players then it is giving only to ID 0.
Here is the code
Please help to fix it.
I have a problem with my /givecookies command.
If i give cookie to any players then it is giving only to ID 0.
Here is the code
pawn Код:
CMD:givecookies(playerid,params[]) {
if(PInfo[playerid][Level] >= 4) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(sscanf(params,"ds",tmp,tmp2)) return SendClientMessage(playerid, -1, "USAGE: /givecookies [playerid] [amount]");
new player1 = strval(tmp), cookie = strval(tmp2), string[128];
if(PInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
format(string, sizeof(string), "You have given %d Cookie(s) to %s", cookie, pName(player1)); SendClientMessage(playerid,yellow,string);
format(string,sizeof(string),"Administrator %s has given %d Cookie(s) to %s. %s have %d Cookies in total.", pName(playerid), cookie, pName(player1), pName(player1), PInfo[player1][Cookies]);
SendClientMessageToAll(nicegreen, string);
return PInfo[player1][Cookies] += cookie;
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,-1,"ERROR.You are not a high enough level to use this command");}