Quote:
Originally Posted by ot_207
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;
ExecuteHamB( Ham_CS_RoundRespawn, id );
if (get_cvar_num("dm_protection"))
{
new Float:ProtectTime = get_cvar_float("dm_protection_time")
set_user_godmode( id, 1 );
set_task( ProtectTime , "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_alive( id ) )
set_user_godmode( id, 0 );
}
@Ot, as be the code applying your macro?
@Connor that is the code