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=87223)



OnPlayerKeyStateChange - [top_Shoter] - 19.07.2009

im useing OnPlayerKeyStateChange to jail i got cmd all working good its perfect the only thing is that it dosent work when in cars ive tried

pawn Код:
if (IsPlayerConnected(playerid) || IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_SPAWNED)
       
//or

      if (IsPlayerConnected(playerid) || IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_SPAWNED)
       
//or

      if (IsPlayerConnected(playerid) || IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_SPAWNED)
        {
and i still cant get it working it only works when im on foot.


Re: OnPlayerKeyStateChange - refshal - 19.07.2009

Try adding a

pawn Код:
new PlayerState = GetPlayerState(playerid);
Above your "if" thingy, and then use this "if" thingy:

pawn Код:
if(IsPlayerConnected(playerid) || IsPlayerInAnyVehicle(playerid) && PlayerState == PLAYER_STATE_DRIVER || PlayerState == PLAYER_STATE_SPAWNED)



Re: OnPlayerKeyStateChange - Correlli - 19.07.2009

eddy, it's same if you store player's state to variable or not.


Re: OnPlayerKeyStateChange - yezizhu - 19.07.2009

Keys are different by walking/in vehicle,
which key are you bond?


Re: OnPlayerKeyStateChange - [top_Shoter] - 19.07.2009

Quote:
Originally Posted by еddy
Try adding a

pawn Код:
new PlayerState = GetPlayerState(playerid);
Above your "if" thingy, and then use this "if" thingy:

pawn Код:
if(IsPlayerConnected(playerid) || IsPlayerInAnyVehicle(playerid) && PlayerState == PLAYER_STATE_DRIVER || PlayerState == PLAYER_STATE_SPAWNED)
i Tried it still no luck thanks for trying to help tho any other idear's of how to?


Re: OnPlayerKeyStateChange - refshal - 19.07.2009

Quote:
Originally Posted by Don Correlli
eddy, it's same if you store player's state to variable or not.
It's just because I did that at once, and it didn't work. I might have done something wrong then...


Re: OnPlayerKeyStateChange - [top_Shoter] - 19.07.2009

Quote:
Originally Posted by yezizhu
Keys are different by walking/in vehicle,
which key are you bond?
ive set both in vehicle and mouse to same button and still no luck

dsoe anyone else no any other way's?


Re: OnPlayerKeyStateChange - yezizhu - 19.07.2009

Quote:
Originally Posted by Top_Shoter
Quote:
Originally Posted by yezizhu
Keys are different by walking/in vehicle,
which key are you bond?
ive set both in vehicle and mouse to same button and still no luck

dsoe anyone else no any other way's?
Code?


Re: OnPlayerKeyStateChange - [top_Shoter] - 19.07.2009

CODE REMOVED.


Re: OnPlayerKeyStateChange - yezizhu - 19.07.2009

Quote:

if(newkeys == KEY_LOOK_BEHIND)

This is what I need.
Edit to
Код:
printf("newkeys:%d,key:%d",newkeys,KEY_LOOK_BEHIND);
if(newkeys&KEY_LOOK_BEHIND)
When newkeys has same value with key(at least), it should work.