24.06.2014, 02:44
How to change the timer so it can detect if the weapon is shooting in 2 milliseconds or lest
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(Lrapid_oldticks[playerid] == 0) Lrapid_oldticks[playerid] = GetTickCount();
else {
new Lrapid_intervals,
Lrapid_checkreturn = 1;
if((Lrapid_intervals = GetTickCount() - Lrapid_oldticks[playerid]) <= 35 &&(GetPlayerWeapon(playerid) != 38
&& GetPlayerWeapon(playerid) != 28 && GetPlayerWeapon(playerid) != 32 && GetPlayerWeapon(playerid) != 31)) { //Submachines such as 32, 28 and minigun got a higher fire rate.
Lrapid_checkreturn = CallLocalFunction("OnPlayerRapidFire", "iii", playerid, weaponid, Lrapid_intervals);
}
else if((Lrapid_intervals = GetTickCount() - Lrapid_oldticks[playerid]) <= 370 && (GetPlayerWeapon(playerid) == 34 ||
GetPlayerWeapon(playerid) == 33)) {
Lrapid_checkreturn = CallLocalFunction("OnPlayerRapidFire", "iii", playerid, weaponid, Lrapid_intervals);
}
Lrapid_oldticks[playerid] = GetTickCount();
if(!Lrapid_checkreturn) return 0; //Doesn't allow to call the rest 'OnPlayerWeaponShot' works anymore.
}
#if defined LRAPID_OnPlayerWeaponShot
return LRAPID_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
#else
return 1;
#endif
}