13.11.2012, 14:52
PHP код:
CMD:passcookie(playerid,params[])
{
new string[128],PID,Playername[MAX_PLAYER_NAME];
GetPlayerName(PID, Playername, sizeof(Playername));
if(PlayerInfo[playerid][pCookies] >=1)
{
if(sscanf(params, "d", PID)) return SendClientMessage(playerid,-1,"USAGE: /passcookie [playerid]");
format(string, sizeof(string), "* %s reaches into his pocket taking out a one big cookie passing it over to %s",RPName(playerid),RPName( PID ));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pCookies] --;
PlayerInfo[PID][pCookies] ++;
}
}
else
{
format(string, sizeof(string), "INFO:{3BB9FF} Sorry %s, Seams like you dont have any cookies", RPName(playerid));
SendClientMessage(playerid,-1,string);
}
return 1;
}
Also in the if-statement where your processing the user input your using a string (s) but you need an integer (i,d) you could also use the u parameter to find players