@drakula
HORRIBLE CODE
@kp3t3h
amx_respawn_team 0 disabled, 1 Ts, 2 CTs, 3 both teams
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
const m_iTeam = 114
new g_iCountdown[33]
new g_pCvarRespawnDelay
new g_pCvarRespawnTeam
enum _:PlayersTasksOffsets (+=33) {
TASK_PLAYER_RESPAWN,
} // id %= 33 in task callback
public plugin_init()
{
register_plugin("Respawn", "1.0", "01")
g_pCvarRespawnDelay = register_cvar("amx_respawn_delay", "20")
g_pCvarRespawnTeam = register_cvar("amx_respawn_team", "3")
RegisterHam(Ham_Killed, "player", "CBasePlayer_Killed_Post", true)
}
public CBasePlayer_Killed_Post(id)
{
remove_task(id + TASK_PLAYER_RESPAWN)
if( get_pcvar_num(g_pCvarRespawnTeam) & get_pdata_int(id, m_iTeam) )
{
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)
set_task(1.0, "fin", id + TASK_PLAYER_RESPAWN, .flags="b")
fin(id + TASK_PLAYER_RESPAWN)
}
}
public fin(task_id)
{
new id = task_id % 33
if( !is_user_connected(id) || is_user_alive(id) )
{
remove_task( task_id )
return
}
new iCountDown = g_iCountdown[id]
if(iCountDown <= 0)
{
remove_task(task_id)
ExecuteHam(Ham_CS_RoundRespawn, id)
return
}
set_hudmessage(0, 255, 0, -1.0, 0.4, 0, 6.0, 1.0, .channel = -1)
show_hudmessage(id, "Respawn za : %d", iCountDown)
--g_iCountdown[id]
}
__________________