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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerKeyStateChange. (/showthread.php?tid=275877)



OnPlayerKeyStateChange. - budelis - 11.08.2011

Hi all.Now i need some help with keys here:

Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if (newkeys & KEY_CROUCH)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 10.0, X, Y, Z))
{
GameTextForPlayer(i,"~b~Please stop",3000,5);
}
}
}
How you see,i want to do when player press KEY_CROUCH then nearest players gets gametext i have to that,but how to do that who pressed key not get this game text


Re: OnPlayerKeyStateChange. - XGh0stz - 11.08.2011

Start learning here:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

No loop is nessecary to check if or when a player presses a key...


Re: OnPlayerKeyStateChange. - MadeMan - 11.08.2011

pawn Код:
if(IsPlayerConnected(i) && i != playerid && IsPlayerInRangeOfPoint(i, 10.0, X, Y, Z))