Raised This Month: $ Target: $400
 0% 

Spawn an Entity at an Origin (Float) via Fakemeta?


Post New Thread Reply   
 
Thread Tools Display Modes
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-20-2006 , 16:45   Re: Spawn an Entity at an Origin (Float) via Fakemeta?
Reply With Quote #21

thanks i will try that
edit: i now have this but still nothing happens.
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #define VERSION "1.0" new content_what[64][100] new content_with[64][100] public plugin_init() {     register_plugin("Entity Replacer",VERSION,"Silencer") } public plugin_precache() {     {         new path[128]         get_configsdir(path,127)         add(path,127,"/ent_replace.txt")         switch(file_exists(path))         {             case 1:             {                 new howlong                 new result[128]                 for(new i=0;i<100;i++)                 {                     read_file(path,i,result,127,howlong)                     parse(result,content_what[i],63,content_with[i],63)                 }                 register_forward(FM_Spawn,"ER_Spawn")             }             case 0:             {                 set_fail_state("NO FILE")             }         }     } } public ER_Spawn(entid) {     new classname[64]     pev(entid,pev_classname,classname,63)     new curpos     while(curpos<100&&!equali(content_what[curpos],classname))     {         curpos++     }     if(curpos<100)     {         engfunc(EngFunc_RemoveEntity,entid)         if(!equali(content_with[curpos],"NOTHING"))         {             new Float:origin[3]             pev(entid,pev_origin,origin)             new alt_ent=engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,content_with[curpos]))             engfunc(EngFunc_SetOrigin,alt_ent,origin)             dllfunc(DLLFunc_Spawn,alt_ent)             return alt_ent         }     }     return PLUGIN_HANDLED }
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 10-20-2006 at 16:53.
Silencer123 is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 10-20-2006 , 17:08   Re: Spawn an Entity at an Origin (Float) via Fakemeta?
Reply With Quote #22

Code:
new content_what[64][100] new content_with[64][100] for(new i = 0; i < 64; i++) {     read_file(path, i, result, 127, howlong)     parse(result, content_what[i], 99, content_with[i], 99) }

It look like your not understanding 2D Arrays. [64] is how many there are. [100] is how long. The code above is what I change to look correct

Quote:
0 ---> 99 long
|
|
v
63
Plus I don't know how your text file look likes.


Edit:
Are you sure your file exists correct? I would add some log_amx to see if it into the correct case statement.
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 10-20-2006 at 17:14.
teame06 is offline
Send a message via AIM to teame06
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-21-2006 , 06:31   Re: Spawn an Entity at an Origin (Float) via Fakemeta?
Reply With Quote #23

I posted the content of the file at the end of post #10.
;)
And you say I have to change the variable to this:
new content_what[100][64]
new content_with[100][64]
(Swapped 100 and 64)
to make it work with the current code?
EDIT: Yea entities get deleted now, thanks, i will keep it in mind.
but the new ones do not spawn, or just not at the correct origin.
:/
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 10-21-2006 at 06:38.
Silencer123 is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-23-2006 , 08:45   Re: Spawn an Entity at an Origin (Float) via Fakemeta?
Reply With Quote #24

the new entities do not spawn, or just not at the correct origin.
__________________
EAT YOUR VEGGIES
Silencer123 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 08:01.


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