SA-MP Forums Archive
Can't kill player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can't kill player (/showthread.php?tid=539351)



Can't kill player - alibalicharlton - 27.09.2014

I'm trying to do a seemingly simple task, to kill a player when they try to repair their vehicle by pressing 2. I get the no cheating message, but the players health doesn't change, what am I doing wrong?

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_SUBMISSION)
    {
        if(playerid==robber)
        {
	    SetPlayerHealth(playerid,0);
	    SendClientMessageToAll(0xFF0000FF, "Cheating is not tolerated!");
        }
        else
        {
	    if(IsPlayerInAnyVehicle(playerid))
	    {
	        RepairVehicle(GetPlayerVehicleID(playerid));
	    }
	}
    }
 }
 return 1;