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



OnPlayerKeyStateChange - Similarty - 22.04.2018

Hello guys, I'm currently scripting an RPG Gamemode for me right now, maybe I'll host it one time and I made a rent car system and at onplayerkeystatechange i wrote if he is in the rentcar range then open a dialog, but I want to do it only when the player presses key Y, I did read the wiki but didn't understand much. I'm on my android phone right now so sorry if you wanted some code.


Re: OnPlayerKeyStateChange - StefaNO [ITA] - 22.04.2018

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_YES) && IsPlayerInRangeOfPoint(playerid, x, y ,z)) // Your coords
	{
	    ShowPlayerDialog.... // Your dialog code
	}
	return 1;
}



Re: OnPlayerKeyStateChange - Similarty - 22.04.2018

Thanks, appreciated.