10.05.2009, 17:12
i have admin command /slap it all works fine, no errors/warnings but you can do '/slap 4' it works but if you type '/slap aaron' or '/slap awrhsetjnsrnmrdykrukm' it always slaps id 0.. why? please can sum one help me! may admin is get angry beacuse i cant fix this!
here is example of my code:
So if anyone can know what to help thanks!
here is example of my code:
pawn Код:
dcmd_Slap(playerid,params[])
{
if(PlayerData[playerid][AdminLevel] >= 4) //need be level 4 to slap
{
new tmp[256],idx;
tmp = strtok(params,idx);
new pid = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /Slap [playersidnumber]");
return true;
}
if(IsPlayerConnected(pid))
{
new Float:posX, Float:posY, Float:posZ, Float:health;
new pname[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(pid,pname,sizeof(pname));
GetPlayerName(playerid,pname2,sizeof(pname2));
GetPlayerPos(pid, posX, posY, posZ);
SetPlayerPos(pid, posX, posY, posZ+10);
SetCameraBehindPlayer(pid);
format(string,sizeof(string),"player %s has got slapped in the face by a admin called %s!",pname,pname2);
SendClientMessageToAll(COLOR_RED, string);
return true;
}
else return SendClientMessage(playerid, COLOR_YELLOW, "that not a valid id");
}
else return SendClientMessage(playerid,COLOR_YELLOW,"only level 2 admin use this!");
}