30.07.2012, 12:28
Is there a way to make a system that you can't quickswap your weapon, i mean something that if you shoot with a gun, you cant change the weapon before 3 seconds after you stop shooting
public OnPlayerUpdate(playerid)
{
// ----- OnPlayerWeaponChange -----
static
oldWeapon[MAX_PLAYERS char];
new
newWeapon = GetPlayerWeapon(playerid);
if(newWeapon != oldWeapon{playerid})
{
OnPlayerWeaponChange(playerid, newWeapon, oldWeapon{playerid});
oldWeapon{playerid} = newWeapon;
return 1;
}
return 1;
}
public OnPlayerWeaponChange(playerid, newweapon, oldweapon)
{
static
switchTime[MAX_PLAYERS];
if((gettime() - switchTime[playerid]) < 3)
SetPlayerArmedWeapon(playerid, oldweapon);
switchTime[playerid] = gettime();
return 1;
}