Post by blazz3r420 on Jul 6, 2018 12:50:07 GMT
Original Tutorial: forums.alliedmods.net/showthread.php?t=169040
Step #1: Search for "// Task offsets"
You will find something like this:
Now you will have to edit it adding those:
So after editing it should look like this:
Step #2: Search for "// IDs inside tasks"
You will find something like this:
Now you will have to edit it adding those:
So after editing it should look like this:
Step #3: Search for "// Player vars"
You will find something like this:
Now you will have to edit it adding those:
So after editing it should look like this:
Step #4: Search for "new g_MsgSync, g_MsgSync2"
Add "g_MsgSync3"
So after editing it should look like this:
Also in plugin_init search for "g_MsgSync"
You will find this:
Add this "g_MsgSync3 = CreateHudSyncObj()
" after g_MsgSync2.
So it should look like this:
Step #5: Search for "// Ham Take Damage Forward"
Scroll down until you find "// Store damage dealt"
It should look something like this:
Now edit it adding "new bool:up"
So after editing it should look like this:
Now after "new bool:up" add this code:
Step #6: Search for "// Client leaving"
You will find something like this:
Edit it adding this:
So it should look like this:
Step #Final: At the very end of your zp.sma add this codes:
Note: If you want the hud in english or other language, you will have to translate it manually.
Step #1: Search for "// Task offsets"
You will find something like this:
// Task offsets
enum (+= 100)
{
TASK_MODEL = 2000,
TASK_TEAM,
TASK_SPAWN,
TASK_BLOOD,
TASK_AURA,
TASK_BURN,
TASK_NVISION,
TASK_FLASH,
TASK_CHARGE,
TASK_SHOWHUD,
TASK_MAKEZOMBIE,
TASK_WELCOMEMSG,
TASK_THUNDER_PRE,
TASK_THUNDER,
TASK_AMBIENCESOUNDS
}
Now you will have to edit it adding those:
TASK_INFO_COMBO, // el task muestra información de combo
TASK_FINISH_COMBO, // el task hace finalización de combo
TASK_RESET_COMBO // el task restablece el combo
So after editing it should look like this:
// Task offsets
enum (+= 100)
{
TASK_MODEL = 2000,
TASK_TEAM,
TASK_SPAWN,
TASK_BLOOD,
TASK_AURA,
TASK_BURN,
TASK_NVISION,
TASK_FLASH,
TASK_CHARGE,
TASK_SHOWHUD,
TASK_MAKEZOMBIE,
TASK_WELCOMEMSG,
TASK_THUNDER_PRE,
TASK_THUNDER,
TASK_AMBIENCESOUNDS
,
TASK_INFO_COMBO, // el task muestra información de combo
TASK_FINISH_COMBO, // el task hace finalización de combo
TASK_RESET_COMBO // el task restablece el combo
}
Step #2: Search for "// IDs inside tasks"
You will find something like this:
// IDs inside tasks
#define ID_MODEL (taskid - TASK_MODEL)
#define ID_TEAM (taskid - TASK_TEAM)
#define ID_SPAWN (taskid - TASK_SPAWN)
#define ID_BLOOD (taskid - TASK_BLOOD)
#define ID_AURA (taskid - TASK_AURA)
#define ID_BURN (taskid - TASK_BURN)
#define ID_NVISION (taskid - TASK_NVISION)
#define ID_FLASH (taskid - TASK_FLASH)
#define ID_CHARGE (taskid - TASK_CHARGE)
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
Now you will have to edit it adding those:
#define ID_INFO_COMBO (taskid - TASK_INFO_COMBO) // definimos la información del combo
#define ID_FINISH_COMBO (taskid - TASK_FINISH_COMBO) // definimos el finalizado del combo
#define ID_RESET_COMBO (taskid - TASK_RESET_COMBO) // definimos el restablecimiento del combo
So after editing it should look like this:
// IDs inside tasks
#define ID_MODEL (taskid - TASK_MODEL)
#define ID_TEAM (taskid - TASK_TEAM)
#define ID_SPAWN (taskid - TASK_SPAWN)
#define ID_BLOOD (taskid - TASK_BLOOD)
#define ID_AURA (taskid - TASK_AURA)
#define ID_BURN (taskid - TASK_BURN)
#define ID_NVISION (taskid - TASK_NVISION)
#define ID_FLASH (taskid - TASK_FLASH)
#define ID_CHARGE (taskid - TASK_CHARGE)
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
#define ID_INFO_COMBO (taskid - TASK_INFO_COMBO) // definimos la información del combo
#define ID_FINISH_COMBO (taskid - TASK_FINISH_COMBO) // definimos el finalizado del combo
#define ID_RESET_COMBO (taskid - TASK_RESET_COMBO) // definimos el restablecimiento del combo
Step #3: Search for "// Player vars"
You will find something like this:
// Player vars
new g_zombie[33] // is zombie
new g_nemesis[33] // is nemesis
new g_survivor[33] // is survivor
new g_firstzombie[33] // is first zombie
new g_lastzombie[33] // is last zombie
new g_lasthuman[33] // is last human
new g_frozen[33] // is frozen (can't move)
new g_nodamage[33] // has spawn protection/zombie madness
new g_respawn_as_zombie[33] // should respawn as zombie
new g_nvision[33] // has night vision
new g_nvisionenabled[33] // has night vision turned on
new g_zombieclass[33] // zombie class
new g_zombieclassnext[33] // zombie class for next infection
new g_flashlight[33] // has custom flashlight turned on
new g_flashbattery[33] = { 100, ... } // custom flashlight battery
new g_canbuy[33] // is allowed to buy a new weapon through the menu
new g_ammopacks[33] // ammo pack count
new g_damagedealt[33] // damage dealt to zombies (used to calculate ammo packs reward)
new Float:g_lastleaptime[33] // time leap was last used
new Float:g_lastflashtime[33] // time flashlight was last toggled
new g_playermodel[33][32] // current model's short name [player][model]
new g_menu_data[33][5] // data for some menu handlers
new g_ent_playermodel[33] // player model entity
new g_ent_weaponmodel[33] // weapon model entity
new g_burning_duration[33] // burning task duration
Now you will have to edit it adding those:
new g_damagecombo[33]
new g_damagehits[33]
new g_combo[33]
new g_info_combo[33][64]
#define ammount_damage(%1) (%1 + 1) * 300
So after editing it should look like this:
// Player vars
new g_zombie[33] // is zombie
new g_nemesis[33] // is nemesis
new g_survivor[33] // is survivor
new g_firstzombie[33] // is first zombie
new g_lastzombie[33] // is last zombie
new g_lasthuman[33] // is last human
new g_frozen[33] // is frozen (can't move)
new g_nodamage[33] // has spawn protection/zombie madness
new g_respawn_as_zombie[33] // should respawn as zombie
new g_nvision[33] // has night vision
new g_nvisionenabled[33] // has night vision turned on
new g_zombieclass[33] // zombie class
new g_zombieclassnext[33] // zombie class for next infection
new g_flashlight[33] // has custom flashlight turned on
new g_flashbattery[33] = { 100, ... } // custom flashlight battery
new g_canbuy[33] // is allowed to buy a new weapon through the menu
new g_ammopacks[33] // ammo pack count
new g_damagedealt[33] // damage dealt to zombies (used to calculate ammo packs reward)
new Float:g_lastleaptime[33] // time leap was last used
new Float:g_lastflashtime[33] // time flashlight was last toggled
new g_playermodel[33][32] // current model's short name [player][model]
new g_menu_data[33][5] // data for some menu handlers
new g_ent_playermodel[33] // player model entity
new g_ent_weaponmodel[33] // weapon model entity
new g_burning_duration[33] // burning task duration
new g_damagecombo[33]
new g_damagehits[33]
new g_combo[33]
new g_info_combo[33][64]
#define ammount_damage(%1) (%1 + 1) * 300
Step #4: Search for "new g_MsgSync, g_MsgSync2"
Add "g_MsgSync3"
So after editing it should look like this:
new g_MsgSync, g_MsgSync2, g_MsgSync3
Also in plugin_init search for "g_MsgSync"
You will find this:
g_MsgSync = CreateHudSyncObj()
g_MsgSync2 = CreateHudSyncObj()
Add this "g_MsgSync3 = CreateHudSyncObj()
" after g_MsgSync2.
So it should look like this:
g_MsgSync = CreateHudSyncObj()
g_MsgSync2 = CreateHudSyncObj()
g_MsgSync3 = CreateHudSyncObj()
Step #5: Search for "// Ham Take Damage Forward"
Scroll down until you find "// Store damage dealt"
It should look something like this:
// Store damage dealt
g_damagedealt[attacker] += floatround(damage)
Now edit it adding "new bool:up"
So after editing it should look like this:
// Store damage dealt
g_damagedealt[attacker] += floatround(damage)
new bool:up // agregamos una variable con boolean la que aumentará el combo durante más hits hagamos
Now after "new bool:up" add this code:
// Almacenamos daño por combo
g_damagecombo[attacker] += floatround(damage) // le asignamos el damage
g_damagehits[attacker]++ // acumula los hits hecho por el player
show_current_combo(attacker, floatround(damage)) // llamamos el task al atacante
remove_task(attacker+TASK_RESET_COMBO)
if (g_damagehits[attacker] > 5) // creamos la condición
{
while (g_damagecombo[attacker] >= ammount_damage(g_combo[attacker])) //hacemos un while para detectar la subida del damage en el combo
{
g_combo[attacker]++ // sumamos 1 combo más
up = true // verifica si el combo fue sumado
}
if (up) // condición para seguir el combo
{
formatex(g_info_combo[attacker], 63, "Combo %d completado!", g_combo[attacker]) // completamos el combo
remove_task(attacker+TASK_INFO_COMBO) // removemos el task
set_task(3.0, "info_combo", attacker+TASK_INFO_COMBO) // task en 0,3 segundos para finalizar el combo
}
remove_task(attacker+TASK_FINISH_COMBO) // removemos el task
set_task(3.0, "finish_combo", attacker+TASK_FINISH_COMBO) // finaliza el combo y nos dará los ammopacks correspondientes
}
else
{
set_task(1.0, "reset_combo", attacker+TASK_RESET_COMBO) // task en 0,1 segundo para reiniciar el combo en cero
}
So after adding the code it should look like this:
// Reward ammo packs
if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
{
// Store damage dealt
g_damagedealt[attacker] += floatround(damage)
new bool:up
// Almacenamos daño por combo
g_damagecombo[attacker] += floatround(damage)
g_damagehits[attacker]++
show_current_combo(attacker, floatround(damage))
remove_task(attacker+TASK_RESET_COMBO)
if (g_damagehits[attacker] > 5)
{
while (g_damagecombo[attacker] >= ammount_damage(g_combo[attacker]))
{
g_combo[attacker]++
up = true
}
if (up)
{
formatex(g_info_combo[attacker], 63, "Combo %d completado!", g_combo[attacker])
remove_task(attacker+TASK_INFO_COMBO)
set_task(3.0, "info_combo", attacker+TASK_INFO_COMBO)
}
remove_task(attacker+TASK_FINISH_COMBO)
set_task(3.0, "finish_combo", attacker+TASK_FINISH_COMBO)
}
else
{
set_task(1.0, "reset_combo", attacker+TASK_RESET_COMBO)
}
// Reward ammo packs for every [ammo damage] dealt
while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
{
g_ammopacks[attacker]++
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
}
}
return HAM_IGNORED;
}
// Attacker is zombie...
Step #6: Search for "// Client leaving"
You will find something like this:
remove_task(id+TASK_TEAM)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_NVISION)
remove_task(id+TASK_SHOWHUD)
Edit it adding this:
remove_task(id+TASK_INFO_COMBO) // remueve el task del combo
remove_task(id+TASK_FINISH_COMBO) // remueve el task que indica que finalizó el combo
remove_task(id+TASK_RESET_COMBO) // remueve el combo & lo reinicia
So it should look like this:
remove_task(id+TASK_TEAM)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_NVISION)
remove_task(id+TASK_SHOWHUD)
remove_task(id+TASK_INFO_COMBO)
remove_task(id+TASK_FINISH_COMBO)
remove_task(id+TASK_RESET_COMBO)
Step #Final: At the very end of your zp.sma add this codes:
public show_current_combo(id, idamage) // public para el combo ocurrido funcione
{
static combo; combo = g_combo[id]
set_hudmessage(255, 0, 0, -1.0, 0.6, 1, 3.0, 3.0, 0.01, 0.01)
if (!combo)
{
ShowSyncHudMsg(id, g_MsgSync3, "%d", idamage)
}
else
{
ShowSyncHudMsg(id, g_MsgSync3, "%s^n^nCombo %d^n%d | %d", g_info_combo[id], combo + 1, g_damagecombo[id], ammount_damage(combo))
}
}
public finish_combo(taskid) // public que finaliza el combo
{
static id, ap, info[32];
id = ID_FINISH_COMBO // finaliza el combo
ap = (g_combo[id] * 2) // nos dará los aps
set_hudmessage(255, 255, 255, -1.0, 0.6, 0, 3.0, 3.0, 0.01, 0.01) // colores para el hud del combo
if (ap) // condicion para proseguir
{
formatex(info, charsmax(info), "Extra AP ganados: %d", ap) // nos dará los ammopacks correspondientes
}
else
{
info[0] = '^0'
}
ShowSyncHudMsg(id, g_MsgSync3, "Combo finalizado!^nTotal: %d, danio: %d, hits: %d^n^n%s", g_combo[id], g_damagecombo[id], g_damagehits[id], info) // hud que índica que el combo ha finalizado
g_combo[id] = 0 // reinicia el combo en cero
g_damagecombo[id] = 0 // reinicia el damage
g_damagehits[id] = 0 // reinicia los hits por el damage
}
public info_combo(taskid) // public que nos dará la info del combo
{
static id;
id = ID_INFO_COMBO
g_info_combo[id][0] = '^0' // nos dará cierta información
}
public reset_combo(taskid) // public que reinicia el combo
{
static id;
id = ID_RESET_COMBO
g_combo[id] = 0
g_damagecombo[id] = 0
g_damagehits[id] = 0
}
Note: If you want the hud in english or other language, you will have to translate it manually.