SA-MP Forums Archive
OnPlayerKeyStateChange help - 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: OnPlayerKeyStateChange help (/showthread.php?tid=593272)



OnPlayerKeyStateChange help - edwardluciano - 03.11.2015

i need to getkey when player move normally (W S A D) or (W & Holding Spacbar)

i find in wiki not found i want

My code
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(HOLDING(KEY_SPRINT) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) << not work
	{
	    CheckEnergy(playerid);
	}
        if(newkeys == KEY_SPRINT)
	{
	    if(!IsPlayerInAnyVehicle(playerid))
	    {
	        if(PSleep[playerid] != 1)
 	       {
	        	CheckEnergy(playerid);
	        }
	    }
	    if(IsPlayerInAnyVehicle(playerid))
	    {
	        if(PSleep[playerid] != 1)
		{
	        	CheckEnergyInVeh(playerid);
	        }
	    }
        }
}
Thx for all answer sry my english very bad