Raised This Month: $51 Target: $400
 12% 

Remove any entities at startup


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
stevenlafl
Member
Join Date: Apr 2005
Location: Florida, USA
Old 03-16-2006 , 13:19   Remove any entities at startup
Reply With Quote #1

Add the cvars below to the configs/amxx.cfg:

ent_remove_class <classname>
ent_remove_model <model> (this has to be full path)

Or, you can put this in configs/maps/*MAPNAME*.cfg for individual maps!
This will remove anything you want on startup.
Attached Files
File Type: sma Get Plugin or Get Source (removeall.sma - 927 views - 908 Bytes)
__________________
Hippopotomonstrosesquippedaliophobia
stevenlafl is offline
Send a message via AIM to stevenlafl
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-16-2006 , 13:26  
Reply With Quote #2

Change this:
Code:
for(new i = 0;i < entity_count();i++)
to this:
Code:
new iEnts = entity_count(); for(new i = 0;i < iEnts;i++)
Or similiar.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
stevenlafl
Member
Join Date: Apr 2005
Location: Florida, USA
Old 03-16-2006 , 13:35  
Reply With Quote #3

What's the point of that? It's the same thing, and I tested it. Unless of course you meant to set entity_count() when the map loads, and dont get it again over and over?
__________________
Hippopotomonstrosesquippedaliophobia
stevenlafl is offline
Send a message via AIM to stevenlafl
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-16-2006 , 13:41  
Reply With Quote #4

Quote:
Originally Posted by AMWiki
A common mistake is to write code like this:

Code:
new string[256] = "something long" for (new i=0; i<strlen(string); i++)    //...code

This plays off a similar principle from before: cache results. The compiler will actually recompute your string length on each iteration of the loop. This will have even worse effects if your string changes mid-loop. A more sensible method is:

Code:
new string[256] = "something long" new len = strlen(string) for (new i=0; i<len; i++)    //...code
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
stevenlafl
Member
Join Date: Apr 2005
Location: Florida, USA
Old 03-16-2006 , 13:55  
Reply With Quote #5

I'm not using a string But I'll do this anyways.
Edit: Done
__________________
Hippopotomonstrosesquippedaliophobia
stevenlafl is offline
Send a message via AIM to stevenlafl
VEN
Veteran Member
Join Date: Jan 2005
Old 03-17-2006 , 02:20  
Reply With Quote #6

Your plugin wouldn't work all the time as intended because of possible "holes" between entities, i.e. empity entity slots.
You have to use get_global_int(GL_maxEntities) if you want complete plugin in similar way.
Also you can done that plugin with fakemeta module
Code:
engfunc(EngFunc_FindEntityByString, StartSearchAfterEntid, "classnameORmodel", "search_for_string")
VEN is offline
stevenlafl
Member
Join Date: Apr 2005
Location: Florida, USA
Old 03-19-2006 , 23:21  
Reply With Quote #7

notice the is_valid_ent() :p
__________________
Hippopotomonstrosesquippedaliophobia
stevenlafl is offline
Send a message via AIM to stevenlafl
VEN
Veteran Member
Join Date: Jan 2005
Old 03-20-2006 , 04:16  
Reply With Quote #8

No, you didn't get it.

Lets say:
maxents == 5
entcount == 4
Entlist: 1, 2, 3, 5
4 is empty slot.

Now if you would use loop, you'll get:

From 1 to 4, i.e 1, 2, 3, 4.

Yes, your script would pass 1, 2, 3 and detect that 4 is invalid BUT script wouldn't detect 5.
Why? Yes, because of that "hole".
And look what if maxents instead of entcount is used?
Yes, no such problem.
VEN is offline
T(+)rget
Senior Member
Join Date: Mar 2004
Old 03-20-2006 , 11:51  
Reply With Quote #9

You won't be able to remove hostage_entity with that it'll cause the server to crash.
T(+)rget is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-03-2006 , 22:18  
Reply With Quote #10

There are plugins similar to, and more powerful than, this one.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
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:20.


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