Bueno Este Tutorial Lo Publico Para Aquella Gente Que Quiere Crear Sus Niveles Por AmmoPack
Aclaro El Tut No Es Mio Y Yo Presento Mi Forma Que La Hice Para Zp 4.3
Link Del Post Niveles Por AmmoPack: https://forums.alliedmods.net/showthread.php?t=112692
Bueno Empecemos Al Principio Del Zp Abajo De Esto:
Pegamos Los Siguiente:
Primero Creamos La Variable De Los Niveles Para Eso Buscamos // Player vars
Y Abajo Creamos La Variable:
Segundo Buscamos Este Code En Donde Se Registra Si El Zombie y Nemesis Ganan AmmoPacks:
Y Abajo De Ese Code Ponemos:
Tercero Buscamos En Donde Se Registra El Daño Para Ganar AmmoPacks:
Cuarto Buscamos En Donde El Zombie Infecta Y Ganan AmmoPacks:
Y Para Que Pueda Subir De Nivel Agregamos Otro " update_ap "
Y Para Bajar De Nivel Al Gastar AmmoPack Buscamos:
Buscamos Esto Que Al Comprar Extra Items Redusca Los AmmoPacks Necesario Dependiendo De Cuanto Cueste.
Una Vez Echo Eso Buscamos:
Luego Nos Vamos Al Final De Zp Y Pegamos Esto
Y Para Mostrar En El Hud Cuantos AmmoPack Te Faltan Buscamos:
Y Todo Eso Lo Remplazamos Por Esto:
Aclaro El Tut No Es Mio Y Yo Presento Mi Forma Que La Hice Para Zp 4.3
Link Del Post Niveles Por AmmoPack: https://forums.alliedmods.net/showthread.php?t=112692
Bueno Empecemos Al Principio Del Zp Abajo De Esto:
Código PHP:
new const ZP_CUSTOMIZATION_FILE[] = "zombie_plague_advance.ini"
new const ZP_EXTRAITEMS_FILE[] = "zp_extraitems.ini"
new const ZP_ZOMBIECLASSES_FILE[] = "zp_zombieclasses.ini"
Pegamos Los Siguiente:
Código PHP:
#define Max_Level 250 // Aki Se Define Cuanto Niveles Son El Maximo
#define Level_Up(%1) (%1 * %1 * 10) // Aki Definimos Los AmmoPacks Para El Sig. Nivel
Primero Creamos La Variable De Los Niveles Para Eso Buscamos // Player vars
Y Abajo Creamos La Variable:
Código PHP:
g_level[33] // level
Segundo Buscamos Este Code En Donde Se Registra Si El Zombie y Nemesis Ganan AmmoPacks:
Código PHP:
// Zombie/nemesis killed human, reward ammo packs
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect)
Y Abajo De Ese Code Ponemos:
Código PHP:
update_ap(attacker) // <-- Esto Es Para Que Al Ganar AmmoPacks Se Pueda Subir De Nivel
Tercero Buscamos En Donde Se Registra El Daño Para Ganar AmmoPacks:
Código PHP:
// Reward ammo packs
if ((g_survivor[attacker] && !get_pcvar_num(cvar_survignoreammo)) || (!g_survivor[attacker])
{
// Store damage dealt
g_damagedealt[attacker] += floatround(damage)
// 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)
update_ap(attacker) // <-- Esto Hace Que El Humano y El Survivor Al Ganar AmmoPack Pueda Subir De Nivel
}
}
return HAM_IGNORED;
}
Cuarto Buscamos En Donde El Zombie Infecta Y Ganan AmmoPacks:
Y Para Que Pueda Subir De Nivel Agregamos Otro " update_ap "
Código PHP:
// Reward frags, deaths, health, and ammo packs
UpdateFrags(infector, id, get_pcvar_num(cvar_fragsinfect), 1, 1)
g_ammopacks[infector] += get_pcvar_num(cvar_ammoinfect)
fm_set_user_health(infector, pev(infector, pev_health) + get_pcvar_num(cvar_zombiebonushp))
update_ap(infector) // <-- Esto Es Para Que El Zombie Al Infectar Pueda Suba De Nivel
}
Y Para Bajar De Nivel Al Gastar AmmoPack Buscamos:
Código PHP:
// Deduce ammo packs, play clip purchase sound, and notify player
g_ammopacks[id]-- // <-- Aki Abajo De Esto Agregamos " update_ap(id) "
// Lo Que Hace Esto Es Disminuir Los AmmoPack Y Al Disminuir Los AmmoPacks Pueda Bajar De Nivel.
emit_sound(id, CHAN_ITEM, sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "AMMO_BOUGHT")
return PLUGIN_HANDLED;
}
Buscamos Esto Que Al Comprar Extra Items Redusca Los AmmoPacks Necesario Dependiendo De Cuanto Cueste.
Código PHP:
// Deduce item cost
g_ammopacks[id] -= ArrayGetCell(g_extraitem_cost, itemid)
update_ap(id) // <-- Aki Agregamos Otro " update_ap(id) " Para Que Al Gastar AmmoPack Llame La Funcion Y Pueda Baje De Nivel.
}
Una Vez Echo Eso Buscamos:
Código PHP:
if (resetall)
{
g_level[id] = 1 // <-- Esto Es Para Defini El Nivel Osea Empezaremos En Nivel 1
g_ammopacks[id] = get_pcvar_num(cvar_startammopacks)
g_zombieclass[id] = ZCLASS_NONE
g_zombieclassnext[id] = ZCLASS_NONE
g_damagedealt[id] = 0
WPN_AUTO_ON = 0
}
}
Luego Nos Vamos Al Final De Zp Y Pegamos Esto
Código PHP:
// Level System Macro
public update_ap(id) // <-- Aki Llamamos La Funcion " update_ap "
{
static level; level = g_level[id]
// Creamos Un while Para Que Si Los AmmoPack Es Mayor A Lo Que Pedimos Suba De Nivel.
while (g_ammopacks[id] >= Level_Up((g_level[id]+1)) && g_level[id] < Max_Level) // Max_Level Se Define Cuantos Niveles Quieres
g_level[id]++
// Creamos Otro while Para Que Si Los AmmoPack Es Menor A Lo Que Pedimos Baje De Nivel.
while (g_ammopacks[id] < Level_Up(g_level[id]) && g_level[id] > 1)
g_level[id]--
if (g_level[id] > level)
{
zp_colored_print(id, "^x04[ZP]^x01 Has Subido Al Nivel: ^x04%d^x01.", g_level[id]) // Mandamos Un Print Al Subir De Nivel.
}
else if (g_level[id] < level)
{
zp_colored_print(id, "^x04[ZP]^x01 Has Bajado Al Nivel: ^x04%d^x01", g_level[id]) // Mandamos Otro Print Al Bajar De Nivel.
}
}
Y Para Mostrar En El Hud Cuantos AmmoPack Te Faltan Buscamos:
Código PHP:
// Show health, class and ammo packs and armor
set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L: %d - %L %s - %L %d - %L %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS",
class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(ID_SHOWHUD, pev_armorvalue))
Y Todo Eso Lo Remplazamos Por Esto:
Código PHP:
// Show health, class and ammo packs and armor
set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 1, 2.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L: %d - %L %s - %L %d/%d - %L %d - %L %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class,
ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], Level_Up((g_level[id]+1)), ID_SHOWHUD, "ARMOR", pev(ID_SHOWHUD, pev_armorvalue), ID_SHOWHUD, "LEVEL", g_level[ID_SHOWHUD])