AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   script looks fine altough the loop doesn't even start (https://forums.alliedmods.net/showthread.php?t=16993)

Proach 08-24-2005 02:13

script looks fine altough the loop doesn't even start
 
Ok I wanted a script that removes the entid's of hostage bomb and vip
so I searched around and found the correct classnames
but then I put the script on my server and i doesn't even start the loop a the beginning...
this is my very first script and I made it with a lot of help from hawk
any suggestions?
Code:
#include <amxmodx> #include <engine> #define MAXENTS 512 public plugin_init() {     register_plugin("Objective Remover","1.0","proach")     register_event("RoundTime", "check_obj", "bc")     register_cvar("amx_remhostages","1")     register_cvar("amx_rembomb","1")     register_cvar("amx_remvip","1") } public check_obj() {     client_print(0,print_chat,"[DEBUG] Round end detected.")     new entid     for(entid=0;entid >= 512; entid++)     {         client_print(0,print_chat,"[DEBUG] Loop check beginning.")         new classname[16]         entity_get_string(entid,EV_SZ_classname,classname,15)         if(get_cvar_num("amx_remhostages")==1)         {             client_print(0,print_chat,"[DEBUG] cvar amx_remhostages is 1.")             if(containi(classname,"hostage")!=-1)             {                 client_print(0,print_chat,"[DEBUG] A hostage has been detected.")                 remove_entity(entid)             }             if(containi(classname,"func_hostage_rescue")!=-1)             {                 client_print(0,print_chat,"[DEBUG] A hostage rescue zone has been detected.")                 remove_entity(entid)

v3x 08-24-2005 02:18

Code:
for(entid=0;entid <= get_global_int(GL_maxEntities); entid++)
Try that.

Also, make the classname length 32.

Proach 08-24-2005 02:23

thx. .g2g now but Ill try today and let you know ;)

Proach 08-24-2005 09:24

ok I got this now
Code:
#include <amxmodx> #include <engine> #define MAXENTS 512 public plugin_init() {     register_plugin("Objective Remover","1.0","proach")     register_event("RoundTime", "check_obj", "bc")     register_cvar("amx_remhostages","1")     register_cvar("amx_rembomb","1")     register_cvar("amx_remvip","1") } public check_obj() {     client_print(0,print_chat,"[DEBUG] Round end detected.")     new entid     for(entid=0;entid <= get_global_int(GL_maxEntities); entid++)     {         client_print(0,print_chat,"[DEBUG] Loop check beginning.")         new classname[32]         entity_get_string(entid,EV_SZ_classname,classname,15)         if(get_cvar_num("amx_remhostages")==1)         {             client_print(0,print_chat,"[DEBUG] cvar amx_remhostages is 1.")             if(containi(classname,"hostage")!=-1)             {                 client_print(0,print_chat,"[DEBUG] A hostage has been detected.")                 remove_entity(entid)             }             if(containi(classname,"func_hostage_rescue")!=-1)             {                 client_print(0,print_chat,"[DEBUG] A hostage rescue zone has been detected.")                 remove_entity(entid)             }         }     }     return PLUGIN_HANDLED }

but it gives an error while compiling and it overflows me when I put it on the server..
probably something really stupid .. but what? :)

v3x 08-24-2005 09:41

Try this:
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Objective Remover","1.0","proach")     register_event("RoundTime", "check_obj", "bc")     register_cvar("amx_remhostages","1")     register_cvar("amx_rembomb","1")     register_cvar("amx_remvip","1") } public check_obj() {     client_print(0,print_chat,"[DEBUG] Round end detected.")     new entid     for(entid=0;entid <= get_global_int(GL_maxEntities); entid++)     {         client_print(0,print_chat,"[DEBUG] Loop check beginning.")         if(!is_valid_ent(entid)) continue         new classname[32]         entity_get_string(entid,EV_SZ_classname,classname,31)         if(get_cvar_num("amx_remhostages")==1)         {             client_print(0,print_chat,"[DEBUG] cvar amx_remhostages is 1.")             if(equal(classname,"hostage_entity"))             {                 client_print(0,print_chat,"[DEBUG] A hostage has been detected.")                 remove_entity(entid)             }             if(equal(classname,"func_hostage_rescue"))             {                 client_print(0,print_chat,"[DEBUG] A hostage rescue zone has been detected.")                 remove_entity(entid)             }         }     } }

Proach 08-24-2005 11:00

same error
reliable channel overflowed :\

v3x 08-24-2005 11:10

Code:
client_print(0,print_chat,"[DEBUG] cvar amx_remhostages is 1.")
Take that out.

Proach 08-24-2005 11:56

nop.. server just crahses me out..
I'm about to give up :\

mysticssjgoku4 08-24-2005 12:39

Try Putting some return PLUGIN_HANDLED's in there. What I think is happening is that it keeps looping and looping and looing non-stop, that it's causing you to lose connection. or, possible try plugin_continues with elses.

Proach 08-24-2005 12:41

good advice.. g2 work but will try tonight or tomorrow


All times are GMT -4. The time now is 14:29.

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