Raised This Month: $7 Target: $400
 1% 

How to recreate some entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 03-03-2007 , 16:40   How to recreate some entities
Reply With Quote #1

With the new CSDM 2.1 at activating the mod some entities get removed from the map (hostage rescue zones, hostages, bomb zones, bomb, vip escape zones, some weapons they are on fy_xx maps on the ground etc). My problem is - if someone wants to disable CSDM - these entities should be recreated to continue the game with normal CS playing.
I have no idea what the data should I store (to use it later to recreate those entities), how to do it (in which moment I should store it etc). And also I don't know how should look the correct procedure with setting the properties of the recreated entity and the right moment with recreating it.
I'm a person which can get the idea of coding when I have the working example of code and some theory. If there is only the theory - it's nothing for me.
So if someone could write for me the working example of recreating for one of these entities listed above with eventually the info what should I store and then use with recreate for others entities - it would be sufficient for me and I will be very thankful.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-03-2007 , 18:04   Re: How to recreate some entities
Reply With Quote #2

Example of brush-based entites (tested and works):

Code:
#include <amxmodx>  #include <fakemeta>  #define MAX_RZONES 10  #define CLASS_RZONE    "func_hostage_rescue"  new rZoneCount, Float:rZoneMins[MAX_RZONES], Float:rZoneMaxs[MAX_RZONES];  public plugin_init()  {     register_clcmd("say kill","kill");     register_clcmd("say make","make");     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_RZONE)) != 0)     {         pev(ent,pev_absmin,rZoneMins[rZoneCount]);         pev(ent,pev_absmax,rZoneMaxs[rZoneCount]);         if(++rZoneCount >= MAX_RZONES) break;     }  }  public kill(id)  {     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_RZONE)) != 0)         engfunc(EngFunc_RemoveEntity,ent);     client_print(id,print_chat,"* Removed entities");     return PLUGIN_HANDLED;  }  public make(id)  {     new i, ent;     for(i=0;i<rZoneCount;i++)     {         ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,CLASS_RZONE));         dllfunc(DLLFunc_Spawn,ent);         engfunc(EngFunc_SetSize,ent,rZoneMins[i],rZoneMaxs[i]);     }     client_print(id,print_chat,"* Remade entites");     return PLUGIN_HANDLED;  }

Still working on point-based entities.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-03-2007 , 18:22   Re: How to recreate some entities
Reply With Quote #3

This works on point-based entities.

Code:
#include <amxmodx>  #include <fakemeta>  #define MAX_HOSTAGES   10  #define CLASS_HOSTAGE  "hostage_entity"  new hostageCount, Float:hostageOrigin[MAX_HOSTAGES][3], Float:hostageAngles[MAX_HOSTAGES][3],  hostageModel[MAX_HOSTAGES][32], hostageSkin[MAX_HOSTAGES];  public plugin_init()  {     register_clcmd("say kill","kill");     register_clcmd("say make","make");     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_HOSTAGE)) != 0)     {         pev(ent,pev_origin,hostageOrigin[hostageCount]);         pev(ent,pev_angles,hostageAngles[hostageCount]);         pev(ent,pev_model,hostageModel[hostageCount],31);         hostageSkin[hostageCount] = pev(ent,pev_skin);         if(++hostageCount >= MAX_HOSTAGES) break;     }  }  public kill(id)  {     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_HOSTAGE)) != 0)         engfunc(EngFunc_RemoveEntity,ent);     client_print(id,print_chat,"* Removed entities");     return PLUGIN_HANDLED;  }  public make(id)  {     new i, ent;     for(i=0;i<hostageCount;i++)     {         ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,CLASS_HOSTAGE));         engfunc(EngFunc_SetModel,ent,hostageModel[i]);         set_pev(ent,pev_skin,hostageSkin[i]);         dllfunc(DLLFunc_Spawn,ent);         engfunc(EngFunc_SetOrigin,ent,hostageOrigin[i]);         set_pev(ent,pev_angles,hostageAngles[i]);     }     client_print(id,print_chat,"* Remade entites");     return PLUGIN_HANDLED;  }

However, there is a catch: this doesn't work with Condition Zero hostages; the game crashes shortly after spawning them. However, I tested it in regular Counter-Strike, and it worked succesfully.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 03-03-2007 , 19:18   Re: How to recreate some entities
Reply With Quote #4

Code:
    register_clcmd("say kill","kill");  public kill(id)  {     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_HOSTAGE)) != 0)         engfunc(EngFunc_RemoveEntity,ent);     client_print(id,print_chat,"* Removed entities");     return PLUGIN_HANDLED;  }

This code will make linux server crash when hostages are removed.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-03-2007 , 19:25   Re: How to recreate some entities
Reply With Quote #5

Oh. What for?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 03-03-2007 , 21:10   Re: How to recreate some entities
Reply With Quote #6

Counter Strike cache the hostage into memory somewhere. For windows it doesn't care if you remove hostage but for linux it does care. It will crash the server on the hostage removal. You have to hook FM_Spawn and remove it before the server caches the hostage.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 03-04-2007 , 15:19   Re: How to recreate some entities
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
Example of brush-based entites (tested and works):

Code:
(...)  public plugin_init()  {     register_clcmd("say kill","kill");     register_clcmd("say make","make");     new ent;     while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",CLASS_RZONE)) != 0)     {         pev(ent,pev_absmin,rZoneMins[rZoneCount]);         pev(ent,pev_absmax,rZoneMaxs[rZoneCount]);         if(++rZoneCount >= MAX_RZONES) break;     }  } (...)  }
Thanks, but I really don't need to have more data stored about func_hostage_rescue?
What about "info_hostage_rescue"? what the data should be stored (as sufficient to recreate it)? The same about the bomb Ts are carrying on their back.

Quote:
Originally Posted by teame06 View Post
Counter Strike cache the hostage into memory somewhere. For windows it doesn't care if you remove hostage but for linux it does care. It will crash the server on the hostage removal. You have to hook FM_Spawn and remove it before the server caches the hostage.
It does care also for windows CS1.6/CZERO steam. It didn't care for old CS1.5 under windows.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.

Last edited by KWo; 03-04-2007 at 15:21.
KWo is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 03-04-2007 , 15:40   Re: How to recreate some entities
Reply With Quote #8

Quote:
Originally Posted by KWo
It does care also for windows CS1.6/CZERO steam. It didn't care for old CS1.5 under windows.
No, it does not care if you remove hostages in windows. I just tried the code above to remove hostages on windows and on my hlds test server for 1.6.

It is linux server that only care and will crash if you remove hostages at any other time then FM_Spawn from my experience when I had a linux server.
Also that why CSDM and Twisted DeathMatch uses that method.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-04-2007 , 16:01   Re: How to recreate some entities
Reply With Quote #9

KWo: For info_hostage_rescue, probably all you need to store is the origin. Also, there is no entity for the bomb on a Terrorist's back.

I don't know if it would work for you, but if you can find your way through GunGame's code you can see how I dynamically switch between objectives enabled and disabled (just search for gg_block_objectives).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 03-05-2007 , 05:28   Re: How to recreate some entities
Reply With Quote #10

Quote:
Originally Posted by teame06 View Post
No, it does not care if you remove hostages in windows. I just tried the code above to remove hostages on windows and on my hlds test server for 1.6.
I'll re-phrase then - it was crashing (tested about 6 months ago) depanding of how many players/or bots I had on the server. For some reason - if there was about 8 bots/players on the windows server it wasn't crashing, but when I had there 20 bots it was crashing. No idea why that number of players could deal with that.
@XxAvalanchexX - thank You. I'll try Your methods.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
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 06:16.


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