30.12.2009, 16:35
Here my way of struggle against users of bugs "+ crouch"
(sorry for my bad English)
(sorry for my bad English)
Код:
#include <a_samp> #define RELEASED(%0) \ (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0))) new PlayerUsingBug[MAX_PLAYERS]; new PlayerBugTimer[MAX_PLAYERS]; public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsBugWeapon(playerid) && RELEASED(KEY_FIRE)){ PlayerUsingBug[playerid] = 1; PlayerBugTimer[playerid] = SetTimerEx("BugTimeOut",1000,0,"i",playerid); } if(PlayerUsingBug[playerid]==1 && newkeys != KEY_FIRE && newkeys & KEY_CROUCH){ ApplyAnimation(playerid,"PED","getup",4.1,0,0,0,0,0); PlayerUsingBug[playerid] = 0; KillTimer(PlayerBugTimer[playerid]); } return true; } stock BugTimeOut(playerid) { PlayerBugged[playerid]=0; } stock IsBugWeapon(playerid) { new weaponid = GetPlayerWeapon(playerid); switch(weaponid){ case 24,25,27,34: return true;} return false; }