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



OnPlayerKeyStateChange ? - sampkinq - 19.07.2016

Hello, I shoot, but a value of 1. Again, when I shoot 2's. I want to constantly increase in value. How Can I do that. I'm sorry for my bad English.

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE)
{
new s[10];
SIKMACOUNT[playerid]++;
format(s,sizeof(s),"%d",SIKMACOUNT[playerid]);
SendClientMessage(playerid,-1,s);
}
return 1;
}



Re: OnPlayerKeyStateChange ? - Freaksken - 19.07.2016

Quote:

if(newkeys & KEY_FIRE)

You should take a look at OnPlayerKeyStateChange under the section How to check for a key that has been pressed.

Quote:

Hello, I shoot, but a value of 1. Again, when I shoot 2's. I want to constantly increase in value. How Can I do that. I'm sorry for my bad English.

Do you mean if the player presses the fire button that the value should increase, or that if the gun fires that the value should increase (a gun can fire multiple times by hodling the fire key).


Re: OnPlayerKeyStateChange ? - sampkinq - 19.07.2016

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
You should take a look at OnPlayerKeyStateChange under the section How to check for a key that has been pressed.


Do you mean if the player presses the fire button that the value should increase, or that if the gun fires that the value should increase (a gun can fire multiple times by hodling the fire key).
I want to increase the value by holding down the fire key.


Re: OnPlayerKeyStateChange ? - Freaksken - 19.07.2016

You should use OnPlayerWeaponShot instead of OnPlayerKeyStateChange then.


Re: OnPlayerKeyStateChange ? - sampkinq - 19.07.2016

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
You should use OnPlayerWeaponShot instead of OnPlayerKeyStateChange then.
Thanks for your help !