Raised This Month: $ Target: $400
 0% 

Droped Weapons remover wich to choose?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 12-11-2014 , 03:10   Droped Weapons remover wich to choose?
Reply With Quote #1

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 ) );
    }

__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2014 , 07:42   Re: Droped Weapons remover wich to choose?
Reply With Quote #2

All of them call think on weaponbox in order to remove it.
__________________
HamletEagle is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-11-2014 , 08:10   Re: Droped Weapons remover wich to choose?
Reply With Quote #3

HamletEagle, which one that you will choose?
zmd94 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2014 , 09:58   Re: Droped Weapons remover wich to choose?
Reply With Quote #4

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().
__________________

Last edited by HamletEagle; 12-11-2014 at 09:59.
HamletEagle is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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