Avoid quickswapping
#1

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

pawn Код:
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;
}
I think that should work.
Reply
#3

Alright i did as you said, but when i switch weapon, it will just fuck up
Reply
#4

Also when i switch weapon after i putted what you send me, the weapon is just fucking up, when i switch after i have shot with it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)