Detect when player shooting with OnPlayerKeyStateChange ?
#2

It is happening because when player presses multiple keys, variable oldkeys is different from KEY_FIRE. You shouldn't check key pressing in the way you did.
PHP код:
if(oldkeys KEY_FIRE
{
    
// Your code here

For more detailed information see the wiki page (https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange). You will find a lot of useful advice and functions to check keys pressing.

About "How to check for multiple keys" (from the wiki page):
PHP код:
if ((newkeys KEY_FIRE) && (newkeys KEY_CROUCH))
{
    
//.....

Reply


Messages In This Thread
Detect when player shooting with OnPlayerKeyStateChange ? - by YouServ - 28.01.2016, 18:36
Re: Detect when player shooting with OnPlayerKeyStateChange ? - by valych - 28.01.2016, 19:00
Re: Detect when player shooting with OnPlayerKeyStateChange ? - by Gammix - 28.01.2016, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)