SA-MP Forums Archive
OnPlayerSwitchWeapon - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerSwitchWeapon (/showthread.php?tid=342298)



OnPlayerSwitchWeapon - milanosie - 13.05.2012

Anything like that excists?

I want to make that if a players uses a weapon that he/she has not attached to their body (attaching already made) the weapon goes back and he/she cant use it


Re: OnPlayerSwitchWeapon - iRage - 13.05.2012

I'll make you a function for that, give me 5 minutes.


Re: OnPlayerSwitchWeapon - milanosie - 13.05.2012

Quote:
Originally Posted by iRage
Посмотреть сообщение
I'll make you a function for that, give me 5 minutes.
Aight that would be awesome


Re: OnPlayerSwitchWeapon - iRage - 13.05.2012

Actually this thread has one, if it doesn't work tell me.
https://sampforum.blast.hk/showthread.php?tid=24671


Re: OnPlayerSwitchWeapon - SuperViper - 13.05.2012

Easy to make, put this into your script:

pawn Код:
new lastWeapon[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    lastWeapon[playerid] = 0;
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new w = GetPlayerWeapon(playerid);
    if(w != lastWeapon[playerid])
    {
        OnPlayerChangeWeapon(playerid, w, lastWeapon[playerid]);
    }
    lastWeapon[playerid] = w;
    return 1;
}

OnPlayerChangeWeapon(playerid, newgun, oldgun)
{
    return 1;
}



Re: OnPlayerSwitchWeapon - milanosie - 13.05.2012

Thanks both