Help whit special respawn

Сообщения
12
Реакции
2
Ошибка
In a round, the nemesis respawns the player as a Zombie
Компилятор
Локальный
Amx Mod X
1.9.0
Исходный код
#include <amxmodx>
#include <fakemeta>

native zp_is_swarm_round()
native zp_is_plague_round()
native zp_is_lnj_round()
native zp_is_survivor_round()
native zp_is_nemesis_round()
native zp_is_sniper_round()
native zp_is_assassin_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_LnjSpawn, g_NormalSpawn,
g_TypeCvarString[8], g_SwarmSpawnString[3], g_PlagueSpawnString[3], g_LnjSpawnString[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", "h")
g_PlagueSpawn = register_cvar("zp_special_plague_sp", "h")
g_LnjSpawn = register_cvar("zp_special_lnj_sp", "s")
g_NormalSpawn = register_cvar("zp_special_normal_sp", "h")
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()
|| contain(g_TypeCvarString, "e") != -1 && zp_is_sniper_round()
|| contain(g_TypeCvarString, "f") != -1 && zp_is_assassin_round()
|| contain(g_TypeCvarString, "g") != -1 && zp_is_lnj_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_sniper_round() || zp_is_survivor_round())
{
zp_infect_user(id)

return PLUGIN_HANDLED
}

if (zp_is_lnj_round())
{
switch(g_LnjSpawnString[0])
{
case 's':
zp_make_user_survivor(id)

case 'n':
zp_make_user_nemesis(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[ZP]^x01 You have been^x03 Respawned^x01 by server!")
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_LnjSpawn, g_LnjSpawnString, charsmax(g_LnjSpawnString))
get_pcvar_string(g_NormalSpawn, g_NormalSpawnString, charsmax(g_NormalSpawnString))
}
Hello, if this is the wrong section please move it.
I need help with a minor code edit! I'll gladly send a few bucks to PayPal for the help!

I have this CVAR set in cfg to "Z" which means Zombie, unfortunately in the nemesis round it probably uses this cvar and spawns players joining as Zombies.

Can anyone help me edit the plugin so that:
1. In the "Normal Infection" round - it spawns only Zombies
2. In the "Multiple Infection or Multi" round - it spawns only Zombies
3. In the "Nemesis" round - it spawns only Humans

The rest is unchanged.

Oryginal plugin link: https://forums.alliedmods.net/showthread.php?t=150313
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу