#include < amxmodx >
#include < fakemeta >
native zp_is_swarm_round()
native zp_is_plague_round()
native zp_is_survivor_round()
native zp_is_nemesis_round()
native zp_infect_user(a)
native zp_make_user_nemesis(a)
native zp_make_user_survivor(a)
new bool:g_IsRespawned[33],
g_TeleEffCvar, g_TypeCvar, g_SwarmSpawn, g_PlagueSpawn, g_NormalSpawn,
g_TypeCvarString[8], g_SwarmSpawnString[3], g_PlagueSpawnString[3], g_NormalSpawnString[3]
public plugin_init()
{
register_plugin("[ZP] Special Respawn", "1.0", "Hattrick")
register_event("TeamInfo", "event_TeamInfo", "a", "2=TERRORIST", "2=CT")
g_TeleEffCvar = register_cvar("zp_special_tele_effect", "1")
g_TypeCvar = register_cvar("zp_special_respawn", "abcdefg")
g_SwarmSpawn = register_cvar("zp_special_swarm_sp", "z")
g_PlagueSpawn = register_cvar("zp_special_plague_sp", "z")
g_NormalSpawn = register_cvar("zp_special_normal_sp", "z")
set_task(1.0, "FuncCache")
}
public plugin_cfg()
server_cmd("exec addons/amxmodx/configs/zp_special_respawn.cfg")
public client_putinserver(id)
g_IsRespawned[id] = false
public event_TeamInfo()
{
static id
id = read_data(1)
if (!g_IsRespawned[id])
{
set_task(4.0, "FuncRespawn", id)
set_task(4.5, "FuncAnnounce", id)
g_IsRespawned[id] = true
}
}
public FuncRespawn(id)
{
if (is_user_alive(id) || !g_TypeCvarString[0])
return PLUGIN_HANDLED
if (contain(g_TypeCvarString, "a") != -1 && zp_is_swarm_round()
|| contain(g_TypeCvarString, "b") != -1 && zp_is_plague_round()
|| contain(g_TypeCvarString, "c") != -1 && zp_is_survivor_round()
|| contain(g_TypeCvarString, "d") != -1 && zp_is_nemesis_round())
{
dllfunc(DLLFunc_Spawn, id)
if (get_pcvar_num(g_TeleEffCvar))
set_task(0.2, "FuncTeleport", id)
set_task(0.8, "FuncDecision", id)
return PLUGIN_HANDLED
}
dllfunc(DLLFunc_Spawn, id)
if (get_pcvar_num(g_TeleEffCvar))
set_task(0.2, "FuncTeleport", id)
set_task(0.8, "FuncDecision", id)
return PLUGIN_HANDLED
}
public FuncDecision(id)
{
if (!is_user_connected(id))
return PLUGIN_HANDLED
if (zp_is_swarm_round() && contain(g_SwarmSpawnString, "z") != -1
|| zp_is_plague_round() && contain(g_PlagueSpawnString, "z") != -1
|| zp_is_survivor_round())
{
zp_infect_user(id)
return PLUGIN_HANDLED
}
if (contain(g_NormalSpawnString, "z") != -1)
zp_infect_user(id)
return PLUGIN_HANDLED
}
public FuncTeleport(id)
{
if (!is_user_alive(id))
return
static Float:iOrigin[3]
pev(id, pev_origin, iOrigin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, iOrigin, 0)
write_byte(TE_TELEPORT)
engfunc(EngFunc_WriteCoord, iOrigin[0])
engfunc(EngFunc_WriteCoord, iOrigin[1])
engfunc(EngFunc_WriteCoord, iOrigin[2])
message_end()
}
public FuncAnnounce(id)
{
if (!is_user_alive(id))
return
static iSayTextMsg
if (!iSayTextMsg)
iSayTextMsg = get_user_msgid("SayText")
message_begin(MSG_ONE_UNRELIABLE, iSayTextMsg, _, id)
write_byte(id)
write_string("^x04[Play-ZP]^x01 Chame Os Amigos Para Jogar e Compre Vip Para Manter o Servidor!")
message_end()
}
public FuncCache()
{
get_pcvar_string(g_TypeCvar, g_TypeCvarString, charsmax(g_TypeCvarString))
get_pcvar_string(g_SwarmSpawn, g_SwarmSpawnString, charsmax(g_SwarmSpawnString))
get_pcvar_string(g_PlagueSpawn, g_PlagueSpawnString, charsmax(g_PlagueSpawnString))
get_pcvar_string(g_NormalSpawn, g_NormalSpawnString, charsmax(g_NormalSpawnString))
}