Raised This Month: $ Target: $400
 0% 

What is wrong with this respawn script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naf
Junior Member
Join Date: Aug 2010
Old 10-22-2010 , 19:45   What is wrong with this respawn script
Reply With Quote #1

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)
}
naf is offline
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 10-22-2010 , 20:04   Re: What is wrong with this respawn script
Reply With Quote #2

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)

__________________
Reality is wrong, dreams are for real.

Last edited by g_often; 10-22-2010 at 20:30.
g_often is offline
naf
Junior Member
Join Date: Aug 2010
Old 10-22-2010 , 20:15   Re: What is wrong with this respawn script
Reply With Quote #3

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..
naf is offline
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 10-22-2010 , 20:17   Re: What is wrong with this respawn script
Reply With Quote #4

With this plugin when a player join team is respawned.

EDIT: See again the plugin, is edited.
__________________
Reality is wrong, dreams are for real.

Last edited by g_often; 10-22-2010 at 20:24.
g_often is offline
naf
Junior Member
Join Date: Aug 2010
Old 10-23-2010 , 16:13   Re: What is wrong with this respawn script
Reply With Quote #5

How about suicide? I would like to have respawn there too

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

Last edited by naf; 10-23-2010 at 16:45.
naf 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 10:16.


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