Im sorry for duble post, but i got this:
pawn Код:
CMD:slap(playerid, params[])
{
new Float:x,Float:y,Float:z;
if(PVar[playerid][pLevel] >= 1)
{
new pID, Msg[128];
if(sscanf(params, "us[60]", pID)) return SendClientMessage(playerid, COLOR_RED, "* Usage: /slap [PlayerID]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "ERROR : That user is not connected!");
if(!IsPlayerConnected(pID) || pID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR : Player not connected or its yourself!");
format(Msg, sizeof(Msg), "** Administrator %s has slapped %s!", pName(playerid), pName(pID));
SendClientMessageToAll(COLOR_YELLOW, Msg);
SetPlayerHealth(pID, -20);
GetPlayerPos(pID,x,y,x);
SetPlayerPos(pID,x,y,z+6);
PlayerPlaySound(pID, 1190, x, y, z);
SendClientMessage(pID, COLOR_RED, "You have been slapped! Behave yourself!");
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR : This command is for admin level 1 only!");
return true;
}
CMD:slapall(playerid, params[])
{
new Float:x,Float:y,Float:z;
new Msg[128];
if(PVar[playerid][pLevel] >= 3)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerHealth(i, -20);
GetPlayerPos(i,x,y,x);
SetPlayerPos(i,x,y,z+6);
PlayerPlaySound(i, 1190, x, y, z);
SendClientMessage(i, COLOR_RED, "You have been slapped! Behave yourself!");
}
}
format(Msg, sizeof(Msg), "** Administrator %s has slapped all players!", pName(playerid));
SendClientMessageToAll(COLOR_GREY, Msg);
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR : This command is for admin level 3 only!");
return true;
}
All works, but kills all (it should take some health and put the player a little bit up) how to fix it?