AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   respawn player before next round? (https://forums.alliedmods.net/showthread.php?t=54483)

MadMaurice 04-27-2007 08:35

respawn player before next round?
 
I'm working on my first Plugin for AMX.

Because my friends die too early in CS (newbies)
I thought of a plugin that let players respawn without much wait.

I tried the following Tutorial: http://forums.alliedmods.net/showthread.php?p=466787

but it didn't work because the compiler doesn't find "cs_user_respawn"

Here my code:

Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() {
    register_plugin("Auto_Respawn", "0.2", "MadMaurice")
    register_event("DeathMsg","Death","a");
    register_cvar("respawn_power","0");
}

public Death() {
    if(get_cvar_num("respawn_power") == 1) {
        new victim = read_data(2);
        cs_user_respawn(victim);
    }
}

is there any other function or what do i need for this?

Arkshine 04-27-2007 08:42

Re: respawn player before next round?
 
Try this :

Code:
#include <amxmodx> #include <cstrike> new p_respawn; public plugin_init( ) {     register_plugin( "Auto_Respawn", "0.2", "MadMaurice" )         register_event( "DeathMsg", "eDeath", "a" );       p_respawn = register_cvar( "respawn_power", "1" ); } public eDeath( ) {     if( !get_pcvar_num( p_respawn) )         return;         new iVictim = read_data( 2 );         cs_user_spawn( iVictim ); }

Rolnaaba 04-27-2007 11:32

Re: respawn player before next round?
 
sorry I didnt note on the tut that you need to include cstrike did I? Will be added next update

[EDIT] Just updated it: UPDATED

MadMaurice 04-27-2007 17:13

Re: respawn player before next round?
 
thx arkshine but i tried cs_user_spawn several times WITH cstrike ;)

when i tried yours, arkshine, my cs 1.6 hang up :(

edit: @ rolnaaba: thx for updating :)

Arkshine 04-27-2007 17:22

Re: respawn player before next round?
 
Put a delay. Tested and it works fine.

Code:
#include <amxmodx> #include <cstrike> new p_respawn; public plugin_init( ) {     register_plugin( "Auto_Respawn", "0.2", "MadMaurice" )         register_event( "DeathMsg", "eDeath", "a" );       p_respawn = register_cvar( "respawn_power", "1" ); } public eDeath( ) {     if( !get_pcvar_num( p_respawn) )         return;         new iVictim = read_data( 2 );         if( !is_user_connected( iVictim ) )         return;             set_task( 0.1, "spawn_players", iVictim ); } public spawn_players( id ) {     cs_user_spawn( id ); }

MadMaurice 04-28-2007 01:19

Re: respawn player before next round?
 
now the overflow fatal error (when cs hand up) didn't come again, but i also didn't respawn in the next 10 seconds after i died.:shock:

i don't know what it is but i use the newest AMX Mod X. Maybe because in the wiki of amxmodx.org there they say, that it is experimental (cs_user_spawn) and you should better use spawn() ?

btw: spawn() didn't work either.

MadMaurice 04-28-2007 04:24

Re: respawn player before next round?
 
i just recognized that i forgot to turn on respawn_power
but now the fatal error comes again.

edit: the fatal error msg:
SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Reliable Datagram

Arkshine 04-28-2007 08:16

Re: respawn player before next round?
 
Quote:

Originally Posted by MadMaurice (Post 470606)
i just recognized that i forgot to turn on respawn_power
but now the fatal error comes again.

edit: the fatal error msg:
SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Reliable Datagram

With just exactly the same code above ? Otherwise post your complete code.

MadMaurice 04-28-2007 09:53

Re: respawn player before next round?
 
once with your code above

and once with these changings:

respawn_power -> sv_auto_respawn (cvar)

0.1 -> 5.0 (set_task)

both times this message came :cry:

Arkshine 04-28-2007 10:25

Re: respawn player before next round?
 
Are you running others plugins with this 'little code' ? Strange because It works fine with me.


All times are GMT -4. The time now is 06:44.

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