OnPlayerKeyStateChange ?
#1

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;
}
Reply
#2

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).
Reply
#3

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.
Reply
#4

You should use OnPlayerWeaponShot instead of OnPlayerKeyStateChange then.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)