Here is the cod :
Code: Select all
#include <zombie_escape>
#include <ze_levels>
#define TASK_SHOWHUD 2020
#define REPEAT_TIME 60.0
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
new g_pCvarZombieInfectNum, g_pCvarXP
new g_iInfections[33]
new g_MsgSync
const Float:HUD_SPECT_X = 0.01
const Float:HUD_SPECT_Y = 0.3
const Float:HUD_STATS_X = 0.01
const Float:HUD_STATS_Y = 0.3
public plugin_init()
{
register_plugin("ZM Rewards", "1.0", "Eg.")
g_pCvarZombieInfectNum = register_cvar("ze_infect_humans_num", "5")
g_pCvarXP = register_cvar("ze_xp_reward", "1")
g_MsgSync = CreateHudSyncObj()
}
public client_putinserver(id)
{
if(is_user_hltv(id) || is_user_bot(id))
return
set_task(1.0, "Show_Hud", id+TASK_SHOWHUD, _, _, "b")
}
public Show_Hud(taskid)
{
new iPlayer = ID_SHOWHUD
if (!is_user_alive(iPlayer))
iPlayer = pev(iPlayer, pev_iuser2)
if (ze_is_user_zombie(iPlayer))
return
if(iPlayer != ID_SHOWHUD)
{
set_hudmessage(0, 255, 0, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "^nInfections : %d/5", g_iInfections[iPlayer])
}
else if (ze_is_user_zombie(iPlayer))
{
set_hudmessage(0, 255, 0, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "^nInfections : %d/5", g_iInfections[ID_SHOWHUD])
}
else
{
set_hudmessage(0, 255, 0, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "^nInfections : %d/5", g_iInfections[ID_SHOWHUD])
}
}
public ze_user_humanized (id)
{
g_iInfections[id] = 0
}
public ze_user_infected(iVictim, iInfector)
{
if (g_iInfections[iInfector] >= get_pcvar_num(g_pCvarZombieInfectNum))
{
ze_set_user_xp(iInfector, ze_get_user_xp(iInfector) + get_pcvar_num(g_pCvarXP))
g_iInfections[iInfector] = 0
}
else
{
g_iInfections[iInfector]++
}
}