AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove dropped entities except C4 (https://forums.alliedmods.net/showthread.php?t=173797)

reinert 12-10-2011 16:46

Remove dropped entities except C4
 
How to remove all dropped entities except Bomb ?

PHP Code:

RegisterHam(Ham_Spawn"weaponbox""WeaponSpawned"1);

public 
WeaponSpawned(iEntity)
{
    
set_pev(iEntitypev_flagsFL_KILLME);
    
dllfunc(DLLFunc_ThinkiEntity);
    return 
HAM_IGNORED;



hleV 12-10-2011 17:41

Re: Remove dropped entities except C4
 
Try checking
Code:
if (cs_get_weapon_id(iEntity) == CSW_C4)     return HAM_IGNORED;

Erox902 12-10-2011 17:55

Re: Remove dropped entities except C4
 
Or check so that the entity's classname isn't c4's classname.

neverminde 12-10-2011 18:10

Re: Remove dropped entities except C4
 
or something like this
PHP Code:

public delEnt()
{
    new 
ent = -1
    
while( !(ent find_ent_by_class(ent"bomb")))
    {
        
engfunc(EngFunc_RemoveEntity,ent)
    }



Erox902 12-10-2011 20:47

Re: Remove dropped entities except C4
 
Quote:

Originally Posted by neverminde (Post 1611010)
or something like this
PHP Code:

public delEnt()
{
    new 
ent = -1
    
while( !(ent find_ent_by_class(ent"bomb")))
    {
        
engfunc(EngFunc_RemoveEntity,ent)
    }



Wont this delete it even if someone is holding it?

matsi 12-11-2011 03:33

Re: Remove dropped entities except C4
 
Quote:

Originally Posted by Erox902 (Post 1611079)
Wont this delete it even if someone is holding it?

It doesn't remove anything because afaik its not even real entity name. And even if it had proper entity name it wouldn't remove the bomb. :shock:

Quote:

Originally Posted by Erox902 (Post 1611003)
Or check so that the entity's classname isn't c4's classname.

hleV's code should work like reiner wants.

reinert 12-11-2011 08:48

Re: Remove dropped entities except C4
 
Quote:

Originally Posted by hleV (Post 1610997)
Try checking
Code:
if (cs_get_weapon_id(iEntity) == CSW_C4)     return HAM_IGNORED;

Does not work :(

ConnorMcLeod 12-11-2011 10:15

Re: Remove dropped entities except C4
 
PHP Code:

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

#define VERSION "0.0.1"
#define PLUGIN "Remove Weapons"

#define XO_WEAPONBOX 4
new const m_rgpPlayerItems_wpnbx[] = {353638}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
RegisterHamHam_Touch"weaponbox""WeaponBox_Touch")
    
RegisterHamHam_Touch"weapon_shield""WeaponShield_Touch")
}

public 
WeaponBox_Touch(iEntiOther)
{
    for(new 
ii<3i++)
    {
        if( 
get_pdata_cbase(iEntm_rgpPlayerItems_wpnbx[i], XO_WEAPONBOX) > )
        {
            
call_thinkiEnt )
            return
        }
    }
}

public 
WeaponShield_Touch(iEntiOther)
{
    
call_thinkiEnt )




All times are GMT -4. The time now is 12:00.

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