Raised This Month: $32 Target: $400
 8% 

Drop then remove C4


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 01-03-2007 , 08:48   Drop then remove C4
Reply With Quote #1

I'm not very good with entities but is this the correct way for dropping the C4 then removing it?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

public plugin_init() {
    
register_event("StatusIcon""c4_dropped""be""1=1""1=2""2=c4")
}

public 
c4_dropped(id) {
    
engclient_cmd(id"drop""weapon_c4")
    
set_task(0.1"delete_c4")
}
public 
delete_c4() {
    new 
ent find_ent_by_class(-1"weaponbox")
    while (
ent 0) {
        new 
model[33]
        
entity_get_string(entEV_SZ_modelmodel32)
        if (
equali(model"models/w_backpack.mdl")) {
            
remove_entity(ent)
            return 
PLUGIN_CONTINUE
        
}
        
ent find_ent_by_class(ent"weaponbox")
    }
    return 
PLUGIN_CONTINUE

Also, is there a way to remove hostages as well?
__________________
It's a mystery.
Mini_Midget is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-03-2007 , 09:07   Re: Drop then remove C4
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=40164
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
VEN
Veteran Member
Join Date: Jan 2005
Old 01-03-2007 , 10:35   Re: Drop then remove C4
Reply With Quote #3

Quote:
engclient_cmd(id, "drop", "weapon_c4")
set_task(0.1, "delete_c4")
You do not need a task because the backack is created right after drop emulation.

Also in the article [HOWTO] detect weapon drop details [including drop type, weapon type, etc] i've wrote that
Quote:
Note: The weaponbox entity is not the actual weapon, it is the "box" entity that "contain" the weapon_* entity, i.e. the actual weapon entity.
In other words your backpack isn't the only entity that should be removed. There are also a weapon_c4 entity that is linked to a weaponbox, i.e. your backpack. There is a safe weaponbox/weapon_* entity deletion method: just force weaponbox Think and it will remove the entity pair almost instantly and safely using the default game methods.

Quote:
Also, is there a way to remove hostages as well?
Hook Spawn in plugin_precache and remove/supercede the corresponding entity - the most safe way.
VEN is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 09-08-2012 , 12:41   Re: Drop then remove C4
Reply With Quote #4

What the best method to remove C4?
__________________
kramesa is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-08-2012 , 12:59   Re: Drop then remove C4
Reply With Quote #5

PHP Code:
Strip_User_C4id )
{
    new 
fwd register_forward(FM_SetModel"C4_Drop_SetModel"true)
    
engclient_cmd(id"drop""weapon_c4")
    
unregister_forward(FM_SetModelfwdtrue)
}

public 
C4_Drop_SetModelent model[] )
{
    if( !
equal(model"model/weaponbox.mdl") )
    {
        
dllfunc(DLLFunc_Thinkent)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 09-08-2012, 18:08
matsi
This message has been deleted by matsi.
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 09-09-2012 , 07:58   Re: Drop then remove C4
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
Strip_User_C4id )
{
    new 
fwd register_forward(FM_SetModel"C4_Drop_SetModel"true)
    
engclient_cmd(id"drop""weapon_c4")
    
unregister_forward(FM_SetModelfwdtrue)
}

public 
C4_Drop_SetModelent model[] )
{
    if( !
equal(model"model/weaponbox.mdl") )
    {
        
dllfunc(DLLFunc_Thinkent)
    }

And see this : http://forums.alliedmods.net/showpos...08&postcount=8
Lolz0r is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-09-2012 , 10:09   Re: Drop then remove C4
Reply With Quote #7

Roughly the same method.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 09-10-2012 , 19:14   Re: Drop then remove C4
Reply With Quote #8

Now I saw that he only wants to remove it, wouldn't it be better in his occasion ? :

PHP Code:
#include <amxmodx>
#include <fakemeta_util>

public plugin_init() 
{
    
register_plugin("C4 Remove""0.1""ConnorMcLeod")
    
register_event("StatusIcon""GotBomb""be""1=1""1=2""2=c4")
}

public 
GotBomb(id

    
fm_strip_user_gun(idCSW_C4)

Lolz0r is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-11-2012 , 02:19   Re: Drop then remove C4
Reply With Quote #9

Most of fm_ stocks are not recommanded to use, that one belongs to those ones.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 10-02-2012 , 15:36   Re: Drop then remove C4
Reply With Quote #10

This code is correct?

Code:
#include <amxmodx> #include <fakemeta> public plugin_init()     register_event("StatusIcon", "c4Dropped", "be", "1=1", "1=2", "2=c4");     public c4Dropped(id) {     new fwd = register_forward(FM_SetModel, "C4_Drop_SetModel", true);     engclient_cmd(id, "drop", "weapon_c4");     unregister_forward(FM_SetModel, fwd, true); } public C4_Drop_SetModel(ent , model[]) {     if(!equal(model, "model/weaponbox.mdl"))         dllfunc(DLLFunc_Think, ent); }

Stack error!
__________________

Last edited by kramesa; 10-04-2012 at 22:39.
kramesa is offline
Old 10-04-2012, 22:40
kramesa
This message has been deleted by ConnorMcLeod. Reason: Read rules... 2k11 member...
Reply


Thread Tools
Display Modes

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 01:32.


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