Raised This Month: $ Target: $400
 0% 

Error Respawn


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bello2
Senior Member
Join Date: Jun 2010
Location: Venezuela
Old 07-08-2010 , 13:25   Re: Error Respawn
Reply With Quote #8

Quote:
Originally Posted by ot_207 View Post
Even better a macro:
PHP Code:
#define can_spawn(%0) !(( !is_user_connected((%0) && (cs_get_user_team((%0) == CS_TEAM_SPECTATOR || cs_get_user_team((%0) == CS_TEAM_UNASSIGNED || is_user_alive((%0)))) 
This is the code:

PHP Code:
public plugin_init() 

    
register_plugin("respawn","1.0","Bello2")
    
register_event("DeathMsg","death","a"
    
register_cvar("dm_enabled","0")
    
register_cvar("dm_protection","1")
    
register_cvar("dm_protection_time","3")
}

public 
death() 

    if (
get_cvar_num("dm_enabled"))
    {
        new 
id read_data(2)
        
set_task(0.5,"revive",id)
    }
}

public 
revive(id)
{
    if (!
can_spawn(id)) return;
    
    
ExecuteHamBHam_CS_RoundRespawnid );
    
    if (
get_cvar_num("dm_protection"))
    {
        new 
Float:ProtectTime get_cvar_float("dm_protection_time")
        
        
set_user_godmodeid);
        
set_taskProtectTime "stopprotect"id );
    }
}

stock can_spawn(id)
{
   if( !
is_user_connected(id) && ( cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED || is_user_alive(id) ) )
      return 
false
    
   
return true
}

public 
stopprotect(id)
{
    if( 
is_user_aliveid ) )
        
set_user_godmodeid);

@Ot, as be the code applying your macro?

@Connor that is the code
Bello2 is offline
 



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 07:16.


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