Raised This Month: $ Target: $400
 0% 

AutoRespawn plugin... Not working...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smarttart62
Junior Member
Join Date: Jun 2006
Location: Connecticut, USA
Old 06-30-2006 , 09:33   AutoRespawn plugin... Not working...
Reply With Quote #1

Well im trying to make another plugin in which you basically auto-respawn when you die...
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AutoSpawn" #define VERSION "1.0" #define AUTHOR "Smarttart62" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_cvar("amx_autospawn","1");     register_event("Death","spawnMe","a"); } public spawnMe(){     if (get_cvar_num("amx_autospawn")!=1){         return PLUGIN_HANDLED;     }         new players[32],num;     get_players(players,num);         new ii;     for (ii=0;ii<num;ii++)     {         if (!is_user_alive(ii)){             spawn(ii);             set_task(0.5,"respawn",ii);         }     }         return PLUGIN_CONTINUE; } public respawn(id){     spawn(id); }
It just wont respawn though... And also the cvar keeps saying that it cant be set in a multiplayer game...

Thanks,
-Steve
smarttart62 is offline
Send a message via AIM to smarttart62 Send a message via MSN to smarttart62 Send a message via Skype™ to smarttart62
Gizmo
Senior Member
Join Date: May 2006
Location: Sweden
Old 06-30-2006 , 10:58   Re: AutoRespawn plugin... Not working...
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AutoSpawn" #define VERSION "1.0" #define AUTHOR "Smarttart62" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("amx_autospawn","1")     register_event("DeathMsg","spawnMe","a") } public spawnMe() {           if (get_cvar_num("amx_autospawn")!=1)     {         return PLUGIN_HANDLED     }               new players[32], num     get_players(players, num)     new i     for (i = 0; i < num; i++)     {         new id = players[i]         if (!is_user_alive(id))         {                   spawn(id)             set_task(0.5, "respawn", id)         }     }     return PLUGIN_CONTINUE } public respawn(id) {         spawn(id) }

Look at that code an compare to yours and you will find your errors.
Gizmo is offline
smarttart62
Junior Member
Join Date: Jun 2006
Location: Connecticut, USA
Old 06-30-2006 , 11:12   Re: AutoRespawn plugin... Not working...
Reply With Quote #3

Thanks for the help, but it still has no effect in the game...
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AutoSpawn" #define VERSION "1.0" #define AUTHOR "Smarttart62" public plugin_init(){     register_plugin(PLUGIN, VERSION, AUTHOR);     register_cvar("amx_autospawn","1");     register_event("Death","spawnMe","a"); } public spawnMe(){     if (get_cvar_num("amx_autospawn")!=1){         return PLUGIN_HANDLED;     }         new players[32],num;     get_players(players,num);         new ii;     for (ii=0;ii<num;ii++)     {         new id=players[ii];         if (!is_user_alive(id)){             spawn(id);             set_task(0.5,"respawn",id);         }     }         return PLUGIN_CONTINUE; } public respawn(id){     spawn(id); }
And i still have that cvar problem..
-Steve

Last edited by smarttart62; 06-30-2006 at 11:23.
smarttart62 is offline
Send a message via AIM to smarttart62 Send a message via MSN to smarttart62 Send a message via Skype™ to smarttart62
Gizmo
Senior Member
Join Date: May 2006
Location: Sweden
Old 06-30-2006 , 11:25   Re: AutoRespawn plugin... Not working...
Reply With Quote #4

You did not check all of the code
Code:
register_event("Death","spawnMe","a");

change to

Code:
register_event("DeathMsg","spawnMe","a");
Gizmo is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-30-2006 , 12:27   Re: AutoRespawn plugin... Not working...
Reply With Quote #5

You should either do cs_user_spawn, or spawn twice (there's a bug in the HL engine)

Also, the way you made this is retarded. Every time one person dies, you check if everyone is dead and end up spawning only one person. On top of that, you don't take into account spectators or just joined players.

Use read_data(2), it gives you the victim of the DeathMsg.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
smarttart62
Junior Member
Join Date: Jun 2006
Location: Connecticut, USA
Old 06-30-2006 , 15:57   Re: AutoRespawn plugin... Not working...
Reply With Quote #6

Hey thanks so much.
Sorry, im just quite new at this so i havent got it all down yet .

EDIT: Ugh now it crashes:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AutoSpawn" #define VERSION "1.0" #define AUTHOR "Smarttart62" public plugin_init(){     register_plugin(PLUGIN, VERSION, AUTHOR);     register_cvar("amx_autospawn","1");     register_event("DeathMsg","spawnMe","a"); } public spawnMe(){     if (get_cvar_num("amx_autospawn")!=1){         return PLUGIN_HANDLED;     }         new player;     player=read_data(2);     spawn(player);     set_task(0.5,"respawn",player);     return PLUGIN_CONTINUE; } public respawn(id){     spawn(id); }

ERROR: SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Reliable Datagram.
-Steve

Last edited by smarttart62; 06-30-2006 at 16:03.
smarttart62 is offline
Send a message via AIM to smarttart62 Send a message via MSN to smarttart62 Send a message via Skype™ to smarttart62
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-30-2006 , 16:10   Re: AutoRespawn plugin... Not working...
Reply With Quote #7

Do a set_task twice, the first one for 0.5 and the second for 0.7. You can't spawn the person right when they join.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
smarttart62
Junior Member
Join Date: Jun 2006
Location: Connecticut, USA
Old 06-30-2006 , 16:27   Re: AutoRespawn plugin... Not working...
Reply With Quote #8

It only happens when im about to die though. Like for example, i jumped off of somewhere i knew would kill me and then when i kit the ground and the life was deducted then it errored.

I think its something to do with read_data...
-Steve
smarttart62 is offline
Send a message via AIM to smarttart62 Send a message via MSN to smarttart62 Send a message via Skype™ to smarttart62
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-30-2006 , 16:31   Re: AutoRespawn plugin... Not working...
Reply With Quote #9

Quote:
Originally Posted by smarttart62
It only happens when im about to die though. Like for example, i jumped off of somewhere i knew would kill me and then when i kit the ground and the life was deducted then it errored.

I think its something to do with read_data...
-Steve
Then check if(!read_data(1)) return PLUGIN_CONTINUE or something, even though if you fell and died it wouldn't respawn you.

Like I said, just add the set_tasks.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
smarttart62
Junior Member
Join Date: Jun 2006
Location: Connecticut, USA
Old 06-30-2006 , 16:35   Re: AutoRespawn plugin... Not working...
Reply With Quote #10

Hey, it worked.

Thanks so much Hawk!
-Steve
smarttart62 is offline
Send a message via AIM to smarttart62 Send a message via MSN to smarttart62 Send a message via Skype™ to smarttart62
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 08:01.


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