AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Droped Weapons remover wich to choose? (https://forums.alliedmods.net/showthread.php?t=252883)

ghost95v 12-11-2014 03:10

Droped Weapons remover wich to choose?
 
Wich is the best and reliable code to use for removing droped weapons ?

this 1 ?

PHP Code:

#include < amxmodx > 
#include < fakemeta > 
#include < hamsandwich > 

public plugin_init( ) 

  
RegisterHamHam_Think"weaponbox""OnThink"); 
  
RegisterHamHam_Think"weapon_shield""OnThink"); 

  
register_forwardFM_SetModel"OnSetModel"); 


public 
OnThinkiEntity 
  
engfuncEngFunc_RemoveEntityiEntity ); 

public 
OnSetModeliEntity 

  if( 
pev_validiEntity ) ) 
  { 
    static 
szClass32 ]; 
    
peviEntitypev_classnameszClass31 ); 

    if( 
equalszClass"weaponbox" ) || equalszClass"weapon_shield" ) ) 
      
set_peviEntitypev_nextthinkget_gametime( ) + 0.1 ); 
  } 


this 2 ?
PHP Code:

#include <amxmodx> 
#include <fakemeta> 

#define PLUGIN "Destroy Weapons" 
#define AUTHOR "ConnorMcLeod" 
#define VERSION "0.0.1" 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR

    
register_forward(FM_SetModel"SetModel"


public 
SetModel(iEntszModel[]) 

    if( 
equal(szModel"models/w_"9) ) 
    {
        if( 
szModel[9] != 'h' && !equalszModel[9], "sm") && !equalszModel[9], "fl") )
            
set_pev(iEntpev_nextthinkget_gametime() + 10.0
    } 


and this 3 ?
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new gMaxClients;
new 
pCvarTime;

public 
plugin_init ()
{
    
register_plugin"Remove Weaponbox""1.0.0""Arkshine" );

    
pCvarTime register_cvar"dw_time""5" );
    
RegisterHamHam_Touch"weaponbox""WeaponBox_Touch");
    
    
gMaxClients get_maxplayers();
}

public 
WeaponBox_Touch ( const WeaponBox, const Other )
{
    if ( !
Other || Other gMaxClients )
    {
        
set_pevWeaponBoxpev_nextthinkget_gametime() + get_pcvar_floatpCvarTime ) );
    }



HamletEagle 12-11-2014 07:42

Re: Droped Weapons remover wich to choose?
 
All of them call think on weaponbox in order to remove it.

zmd94 12-11-2014 08:10

Re: Droped Weapons remover wich to choose?
 
HamletEagle, which one that you will choose?

HamletEagle 12-11-2014 09:58

Re: Droped Weapons remover wich to choose?
 
I would do:
Code:
#include <amxmodx> #include <engine> #include <fakemeta> public plugin_init() {     register_touch("worldspawn", "weaponbox", "CWeaponBoxTouch") } public CWeaponBoxTouch(const TouchedEnt, const ToucherEnt) {     if(pev_valid(ToucherEnt))     {         set_pev(ToucherEnt, pev_nextthink, get_gametime() + 0.1)     } }
Because, for me it makes more sense to hook Touch() and not Think().


All times are GMT -4. The time now is 15:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.