#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#define PLUGIN_NAME "Show Nemesis/Survior Hp!"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "Dare-Devil"
new id_survior[2]
new id_nemesis[2]
new hud_nsp[2]
new g_maxplayers
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
// Fwd's
RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers()
}
public event_round_start(id)
{
hud_nsp[1] = 0
}
public Fwd_PlayerSpawn_Post(id)
{
static zp_survivors , zp_nemesis
zp_survivors = id_survior[1]
zp_nemesis = id_nemesis[1]
if (zp_is_nemesis_round())
{
if ( zp_nemesis != 0 )
{
if (id == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
}
}
}
else if (zp_is_survivor_round())
{
if ( zp_survivors != 0 )
{
if (id == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
}
}
}
else if (zp_is_plague_round())
{
if ( zp_survivors != 0 )
{
if (id == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
}
}
if ( zp_nemesis != 0 )
{
if (id == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
}
}
}
}
public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
{
static zp_survivors , zp_nemesis
zp_survivors = id_survior[1]
zp_nemesis = id_nemesis[1]
if (zp_is_nemesis_round())
{
if ( zp_nemesis != 0 )
{
if (victim == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
}
}
}
else if (zp_is_survivor_round())
{
if ( zp_survivors != 0 )
{
if (victim == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
}
}
}
else if (zp_is_plague_round())
{
if ( zp_survivors != 0 )
{
if (victim == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
}
}
if ( zp_nemesis != 0 )
{
if (victim == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
}
}
}
}
public client_disconnect(id)
{
static zp_survivors , zp_nemesis
zp_survivors = id_survior[1]
zp_nemesis = id_nemesis[1]
if (zp_is_nemesis_round())
{
if ( zp_nemesis != 0 )
{
if (id == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
check_again_nsp(id)
}
}
}
else if (zp_is_survivor_round())
{
if ( zp_survivors != 0 )
{
if (id == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
check_again_nsp(id)
}
}
}
else if (zp_is_plague_round())
{
if ( zp_survivors != 0 )
{
if (id == zp_survivors)
{
hud_nsp[1] = 0
id_survior[1] = 0
check_again_nsp(id)
}
}
if ( zp_nemesis != 0 )
{
if (id == zp_nemesis)
{
hud_nsp[1] = 0
id_nemesis[1] = 0
check_again_nsp(id)
}
}
}
}
public zp_round_started(mode, id)
{
if (mode == MODE_NEMESIS)
{
hud_nsp[1] = 1
check_status_event_nsp(id)
set_task(1.0, "hud_nsp_notice", id)
return
}
else if (mode == MODE_SURVIVOR)
{
hud_nsp[1] = 1
check_status_event_nsp2(id)
set_task(1.0, "hud_nsp_notice", id)
return
}
else if (mode == MODE_PLAGUE)
{
hud_nsp[1] = 1
check_status_event_nsp2(id)
set_task(1.0, "hud_nsp_notice", id)
return
}
}
public check_again_nsp(id)
{
if (zp_is_nemesis_round())
{
hud_nsp[1] = 0
check_status_event_nsp(id)
set_task(1.0, "hud_nsp_notice", id)
hud_nsp[1] = 1
return
}
else if (zp_is_survivor_round())
{
hud_nsp[1] = 0
check_status_event_nsp2(id)
set_task(1.0, "hud_nsp_notice", id)
hud_nsp[1] = 1
return
}
else if (zp_is_plague_round())
{
hud_nsp[1] = 0
check_status_event_nsp3(id)
set_task(1.0, "hud_nsp_notice", id)
hud_nsp[1] = 1
return
}
}
public check_status_event_nsp(id)
{
static iPlayersnum
iPlayersnum = ZPGetNemesis()
if(iPlayersnum == 1)
{
id_nemesis[1] = ZPGetRandomNemesis(random_num(1, iPlayersnum))
}
}
public check_status_event_nsp2(id)
{
static iPlayersnum
iPlayersnum = ZPGetSurvivor()
if(iPlayersnum == 1)
{
id_survior[1] = ZPGetRandomSurvivors(random_num(1, iPlayersnum))
}
}
public check_status_event_nsp3(id)
{
static iPlayersnum , iPlayersnum2
iPlayersnum = ZPGetSurvivor()
iPlayersnum2 = ZPGetNemesis()
if(iPlayersnum == 1)
{
id_survior[1] = ZPGetRandomSurvivors(random_num(1, iPlayersnum))
}
if(iPlayersnum2 == 1)
{
id_nemesis[1] = ZPGetRandomNemesis(random_num(1, iPlayersnum))
}
}
public zp_round_ended(id)
{
hud_nsp[1] = 0
}
public hud_nsp_notice(id)
{
if (zp_is_nemesis_round())
{
static zp_nemesis
zp_nemesis = id_nemesis[1]
if (hud_nsp[1] == 1 && zp_nemesis != 0)
{
set_hudmessage(237, 28, 36, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Nemesis Elete : %d", get_user_health(zp_nemesis))
}
}
else if (zp_is_survivor_round())
{
static zp_survivors
zp_survivors = id_survior[1]
if (hud_nsp[1] == 1 && zp_survivors != 0)
{
set_hudmessage(0, 128, 192, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Tulelo Elete : %d", get_user_health(zp_survivors))
}
}
else if (zp_is_plague_round())
{
static zp_survivors, zp_nemesis
zp_survivors = id_survior[1]
zp_nemesis = id_nemesis[1]
if (hud_nsp[1] == 1)
{
if (zp_survivors != 0 && zp_nemesis != 0)
{
if (is_user_alive(zp_survivors) && is_user_alive(zp_nemesis))
{
set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Tulelo Elete : %d - Nemesis Elete : %d", get_user_health(zp_survivors), get_user_health(zp_nemesis))
}
else if (is_user_alive(zp_survivors) && !is_user_alive(zp_nemesis))
{
set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Tulelo Elete : %d - Nemesis Elete : Halott", get_user_health(zp_survivors))
}
else if (!is_user_alive(zp_survivors) && is_user_alive(zp_nemesis))
{
set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Tulelo Elete : Halott - Nemesis Elete : %d", get_user_health(zp_nemesis))
}
else if (!is_user_alive(zp_survivors) && !is_user_alive(zp_nemesis))
{
set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
show_hudmessage(0, "Tulelo Elete : Halott - Nemesis Élete : Halott")
}
}
}
}
else // Bug fix
{
hud_nsp[1] = 0
}
// Make it call every time when hudnsp is on
if (hud_nsp[1] == 1)
{
set_task(1.0, "hud_nsp_notice", id)
}
}
// Now get id or value (bug fix)
ZPGetNemesis()
{
static iNemesis, id
iNemesis = 0
for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_alive(id) && zp_get_user_nemesis(id))
iNemesis++
}
return iNemesis;
}
ZPGetSurvivor()
{
static iSurvivors, id
iSurvivors = 0
for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_alive(id) && zp_get_user_survivor(id))
iSurvivors++
}
return iSurvivors;
}
ZPGetRandomNemesis(n)
{
static iAlive, id
iAlive = 0
for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_alive(id) && zp_get_user_nemesis(id))
iAlive++
if (iAlive == n)
return id;
}
return -1;
}
ZPGetRandomSurvivors(n)
{
static iAlive, id
iAlive = 0
for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_alive(id) && zp_get_user_survivor(id))
iAlive++
if (iAlive == n)
return id;
}
return -1;
}