SetArmedWeapon
#4

PHP код:
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(playeridGetPVarInt(playerid"iCurrentWeapon"), iCurWeap);
        
SetPVarInt(playerid"iCurrentWeapon"iCurWeap);//Update the weapon variable
        
SetPlayerArmedWeapon(playerid,0); 
    }
    return 
1// Send this update to other players.
}
 
stock OnPlayerChangeWeapon(playeridoldweaponnewweapon)
{
    new     
s[128],
        
oWeapon[24],
        
nWeapon[24];
 
    
GetWeaponName(oldweaponoWeaponsizeof(oWeapon));
    
GetWeaponName(newweaponnWeaponsizeof(nWeapon));
 
    
format(ssizeof(s), "You changed weapon from %s to %s!"oWeaponnWeapon);
 
    
SendClientMessage(playerid0xFFFFFFFFs);

Code taken from https://sampwiki.blast.hk/wiki/OnPlayerUpdate example and added SetPlayerArmedWeapon(playerid,0);
Reply


Messages In This Thread
SetArmedWeapon - by Cubie - 08.09.2017, 16:35
Re: SetArmedWeapon - by Primes007 - 08.09.2017, 16:48
Re: SetArmedWeapon - by Cubie - 08.09.2017, 17:02
Re: SetArmedWeapon - by Primes007 - 08.09.2017, 17:15
Re: SetArmedWeapon - by Cubie - 08.09.2017, 18:17
Re: SetArmedWeapon - by Abagail - 08.09.2017, 18:20

Forum Jump:


Users browsing this thread: 2 Guest(s)