Raised This Month: $ Target: $400
 0% 

[SOLVED] [CS] remove multiple C4


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-27-2013 , 05:24   [SOLVED] [CS] remove multiple C4
Reply With Quote #1

Hello all! I have a simple question.

PHP Code:
    new bomb
    
if ((bomb fm_find_ent_by_model(-1"grenade""models/w_c4.mdl")))
    {
        
fm_remove_entity(bomb)
    } 
This code removes a planted C4.

If I have 2 or more C4 (which planted on map) the code removes only LAST PLANTED C4.
How i can remove ALL c4 bombs from map (it's a simple fun mod). ?
__________________
sorry my bad english...

Last edited by alonelive; 01-31-2013 at 05:01.
alonelive is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-27-2013 , 05:34   Re: [CS] remove multiple C4
Reply With Quote #2

1st you have to stop using fakemeta_util

Then, use a loop :

PHP Code:
#include <engine>
#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif

public RemoveC4All()
{
    new 
grenade FM_NULLENT
    
while( (grenade find_ent_by_class(grenade"grenade")) )
    {
        if( 
get_pdata_bool(grenadem_bIsC4XO_CGRENADE) )
        {
            
remove_entity(grenade)
        }
    }

Needed files are there : http://forums.alliedmods.net/showpos...01#post1712101
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
michal123
Junior Member
Join Date: Feb 2011
Location: Poland
Old 01-27-2013 , 05:35   Re: [CS] remove multiple C4
Reply With Quote #3

Maybe try this:
Code:
new g_Bomb = fm_find_ent_by_model(-1, "grenade", "models/w_c4.mdl");

while(g_Bomb){
	fm_remove_entity(g_Bomb);
	g_Bomb = fm_find_ent_by_model(-1, "grenade", "models/w_c4.mdl");
}
michal123 is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-31-2013 , 05:01   Re: [CS] remove multiple C4
Reply With Quote #4

Thank you all, question is solved.
__________________
sorry my bad english...
alonelive 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 20:38.


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