Raised This Month: $ Target: $400
 0% 

Detect brokeable things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 02-26-2007 , 15:28   Re: Detect brokeable things
Reply With Quote #1

Not sure if this works because of the EVENT in CS, but try this:

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "Breakable Ent Destroyer" #define VERSION "1.0" #define AUTHOR "Remo Williams" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("ResetHUD","client_spawn","b") } public client_spawn(id) {     new ent     while((ent = find_ent_by_class(0,"func_breakable")) != 0)     {         remove_entity(ent)     }     return PLUGIN_HANDLED }
Attached Files
File Type: sma Get Plugin or Get Source (breakable_ent_destroyer.sma - 684 views - 444 Bytes)
__________________


Last edited by mysticssjgoku4; 02-26-2007 at 15:31.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
NoobInAmxx
Senior Member
Join Date: Mar 2006
Location: Turku Finland
Old 02-26-2007 , 16:42   Re: Detect brokeable things
Reply With Quote #2

If i want kill all hostages at round start to ? And switch that on/off
PS: that script did work thanks.
__________________
..Im not smart and im not stupid..

Last edited by NoobInAmxx; 02-26-2007 at 16:49.
NoobInAmxx is offline
Send a message via MSN to NoobInAmxx
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-26-2007 , 20:53   Re: Detect brokeable things
Reply With Quote #3

Reference:http://forums.alliedmods.net/showthread.php?t=42159

Note: Untested
PHP Code:
#include <amxmodx>
#include <fakemeta>

static const PLUGIN_NAME[]     = "Remove Breakable Stuff & Hostages"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.0"

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
register_event("HLTV""event_hltv""a""1=0""2=0")
}

public 
event_hltv()
{
    
remove_entity_by_classname("func_breakable")
    
remove_entity_by_classname("hostage_entity")
    
remove_entity_by_classname("scientist_entity")
}

stock remove_entity_by_classname(const classname[]) 
{
    new 
ent = -1
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname"classname)))
        
engfunc(EngFunc_RemoveEntityent)

__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 02-27-2007 at 06:20.
Cheap_Suit is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-26-2007 , 21:44   Re: Detect brokeable things
Reply With Quote #4

Okay Cheap_Suit, you got me here.

Why did you declare the global variables as static? It's redundant, it's like calling it "global global". The best thing to do would be to just declare them in plugin_init, like so:

Code:
//... public plugin_init() {     new PLUGIN_NAME[]     = "Remove Breakable Stuff & Hostages"     new PLUGIN_VERSION[]    = "1.0"     new PLUGIN_AUTHOR[]     = "Cheap_Suit"     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER) //...


Also, why did you make the remove_entity_by_classname function a stock? All that does is slow the compiler down and make it look like crap. Just make it a private function. If you were trying to make your script look nice and confusing, you failed.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-26-2007 , 22:46   Re: Detect brokeable things
Reply With Quote #5

- Personal reasons even if its redundant and useless . Unless it does something really terrible, then Ill change it.
- It's a modified right from fakemeta_util.

#edit:
Quote:
If you were trying to make your script look nice and confusing, you failed.
Trying to make it readable for me and thank you, I try my best not to make any of my scripts confusing.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 02-27-2007 at 06:18. Reason: P.S. Im still a noob
Cheap_Suit is offline
NoobInAmxx
Senior Member
Join Date: Mar 2006
Location: Turku Finland
Old 02-27-2007 , 02:32   Re: Detect brokeable things
Reply With Quote #6

Thanks its working... hawk NoobInEverything would suit u actually better than for me..
__________________
..Im not smart and im not stupid..
NoobInAmxx is offline
Send a message via MSN to NoobInAmxx
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-27-2007 , 06:53   Re: Detect brokeable things
Reply With Quote #7

Quote:
Originally Posted by NoobInAmxx View Post
Thanks its working... hawk NoobInEverything would suit u actually better than for me..
Oh great one, "this generic degrading title may fit me quite well, but it fits you better!"

Quote:
Originally Posted by Cheap_Suit View Post
- Personal reasons even if its redundant and useless . Unless it does something really terrible, then Ill change it.
Do you even understand that there actually is a difference? Declaring it in plugin_init means that it's destroyed when the function ends - there's not a bunch of garbage sitting there throughout the entire time the plugin is running. It has nothing to do with personal preference, it's just stupid.

Quote:
Originally Posted by Cheap_Suit View Post
- It's a [sic] modified [sic] right from fakemeta_util.
That doesn't change the fact that you're doing unnecessary operations. It's a stock in fakemeta_util because it won't necissarily be used by the plugin including it. Here, you're 100% sure it's going to be used, thus the stock tag is redundant and useless.

Quote:
Originally Posted by Cheap_Suit View Post
#edit:Trying to make it readable for me and thank you, I try my best not to make any of my scripts confusing.
Apparently you failed here. You managed to confuse me.
__________________

Last edited by Hawk552; 02-27-2007 at 06:57.
Hawk552 is offline
Send a message via AIM to Hawk552
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 00:37.


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