26.03.2014, 08:30
(
Последний раз редактировалось DaniceMcHarley; 26.03.2014 в 08:32.
Причина: Bug fix
)
If you wanna count the bullets then OnPlayerKeyStateChange callback will do it.
1- Check if the player has pressed KEY_FIRE ( left click)
2- If he pressed it then check if he has a weapon in his hand (GetPlayerWeapon).
3- Set a variable, each KEY_FIRE pressed increase it (Note: a variable/array must be set for each weapon)
4- OnPlayerUpdate check if the variable is 100 = then SetPlayerWeaponSkill, ETC..
However there still might be a bug since if you keep your hand on Left Click it will shoot many bullets but it will be counted as 1 bullet, so..
EDIT:
Maybe you can set a variable if the player is kept pressing KEY_FIRE then keep increasing the variable OnPlayerUpdate.
Example:
1- Check if the player has pressed KEY_FIRE ( left click)
2- If he pressed it then check if he has a weapon in his hand (GetPlayerWeapon).
3- Set a variable, each KEY_FIRE pressed increase it (Note: a variable/array must be set for each weapon)
4- OnPlayerUpdate check if the variable is 100 = then SetPlayerWeaponSkill, ETC..
However there still might be a bug since if you keep your hand on Left Click it will shoot many bullets but it will be counted as 1 bullet, so..
EDIT:
Maybe you can set a variable if the player is kept pressing KEY_FIRE then keep increasing the variable OnPlayerUpdate.
Example:
Код:
new is_shooting[MAX_PLAYERS] = 0; OnPlayerUpdate { if(is_shooting[MAX_PLAYERS] = 1) { // Increase the Bullet Variable. } }