[Quick Swapping] example
#1

I need some example if player quick swapping weapon, server say him you need swapping your weapon slowly.
And player must wait 3-4 second to swap that weapon,because she is qucik swapping.
Reply
#2

Something like this?
pawn Код:
new PlayerWeaponSwap[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    new iCurWeap = GetPlayerWeapon(playerid); // Return the player's current weapon    
    if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // If he changed weapons since the last update
    {
        // Lets call a callback named OnPlayerChangeWeapon
        OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
        SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
    }
    return 1; // Send this update to other players.
}
public OnPlayerChangeWeapon(playerid, newweapon, oldweapon)
{
     if(PlayerWeaponSwap[playerid] > gettime() - 5)
     {
          SetPlayerArmedWeapon(playerid, oldweapon);
          CallLocalFunction("OnPlayerQuickSwap", "i", playerid);
          return 0;
     }

     PlayerWeaponSwap[playerid] = gettime();
     return 1;
}
Reply
#3

@Abagail something like that,but that don't work.
Reply
#4

Quick swapping relates to switching weapons to avoid the reload animation, so in essence, this won't avoid the QuickSwap.

I could fire spas rounds, switch, run around for a few seconds, then switch back to spas. QuickSwap achieved.


What you could look at more though, is checking whether the player actually had the animation for the reload occur, and that'd show it up.

There won't be a stopping it, but more then people can see it, and admins can act upon it.

You could even broadcast it to the server openly, so everyone knows.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)