AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What is wrong with this respawn script (https://forums.alliedmods.net/showthread.php?t=141337)

naf 10-22-2010 19:45

What is wrong with this respawn script
 
So, it doesn't actually work, and i think there is something wrong with this:
Code:

    if(get_user_team(id) == 1 || get_user_team(id) == 2) {
because it doesnt even say "respawned".

Well, the code:
Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init() {
    register_plugin("Respawn", "0.14b", "naf")
   
    register_event("DeathMsg","func_death","a")
}

public func_death()
    set_task(0.1, "r_spawn", read_data(2))
   
public r_spawn(id) {
    if(get_user_team(id) == 1 || get_user_team(id) == 2) {
        spawn_func(id)
   
        set_hudmessage(id, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3)
        show_hudmessage(id,"[Respawned]")
        client_print(id, print_console,"Respawned.")
    }
}

public spawn_func(id) {
    new parm[1]
    parm[0] = id
    set_task(0.2,"player_spawn",72,parm,1)
    set_task(0.3,"player_spawn",72,parm,1)
    set_task(0.4,"player_giveitems",72,parm,1)
}


g_often 10-22-2010 20:04

Re: What is wrong with this respawn script
 
Try this:

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>

new CvarTimeRespawnCsTeams:g_Team;

public 
plugin_init()
{
    
register_plugin"Respawn""0.14b""G_often" )
    
    
CvarTimeRespawn register_cvar"respawn_time""1.0" )
    
    
register_event"DeathMsg""EventDeathMsg""a""1>0" );
    
    
register_event"TeamInfo""PlayerJoinTeam""a" )
}

public 
EventDeathMsg()
{
    static 
id;
    
id read_data)
    
    
g_Team cs_get_user_teamid )
    
    if( 
g_Team == CS_TEAM_UNASSIGNED || g_Team == CS_TEAM_SPECTATOR )
        return 
PLUGIN_HANDLED;
    
    
set_taskget_pcvar_floatCvarTimeRespawn ), "RespawnPlayer"id )
    return 
PLUGIN_CONTINUE;
}

public 
PlayerJoinTeam()
{
    static 
id;
    
id read_data)
    
    
g_Team cs_get_user_teamid )
    
    if( 
g_Team == CS_TEAM_UNASSIGNED || g_Team == CS_TEAM_SPECTATOR )
        return 
PLUGIN_HANDLED;
    
    
set_taskget_pcvar_floatCvarTimeRespawn ), "RespawnPlayer"id )
    return 
PLUGIN_CONTINUE;
}

public 
RespawnPlayerid )
{
    if( 
is_user_alive(id) )
        return;
    
    
set_hudmessageid22500.050.4506.06.00.50.15)
    
show_hudmessage(id,"[Respawned]")
    
    
client_print(idprint_console,"Respawned.")
    
    
entity_set_int(idEV_INT_deadflagDEAD_RESPAWNABLE)
    
entity_set_int(idEV_INT_iuser10)
    
call_think(id)
    
DispatchSpawn(id)



naf 10-22-2010 20:15

Re: What is wrong with this respawn script
 
Thank you. I would though need like if some player is already dead, he would spawn. Like when he joins to server he is automaticly spawned..

g_often 10-22-2010 20:17

Re: What is wrong with this respawn script
 
With this plugin when a player join team is respawned.

EDIT: See again the plugin, is edited.

naf 10-23-2010 16:13

Re: What is wrong with this respawn script
 
How about suicide? I would like to have respawn there too :D

Edit: and i think that join respawning doesnt work...
Edit2: oh it works after waiting a while
Edit90000: no it doesnt


All times are GMT -4. The time now is 10:16.

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