06/11/2018, 05:34 PM
(Última modificación: 07/11/2019, 03:51 PM por [E]manuelitop15. Edited 45 times in total.)
[Guia/Mini-Tuto] - Sistema de Niveles por: Frags y Infecciones + Menu de Reset
Si hay alguno que otro error me lo hacen saber y lo edito
--------------------------------------
[Actualización: 26/07/19]
--------------------------------------
Comenzemos
Definimos las Infecciones y Frags (los marcos)
creamos las variables van a
Arriba de Agregamos
Quedaria
Ahora vamos a
Y agregamos despues del
Quedaria..
Ahora buscamos y en
Agregamos
Quedaria..
Bueno ahora vamos ay agregaremos debajo de
Quedaria...
Bueno ahora crearemos el check_level
- El nivel 200 es de ejemplo, de lo que seria el nivel maximo, pueden poner el que ustedes quieran
Bueno ahora editaremos el hud para que nos diga los frags y todo eso
Vamos a
Y reemplazan todo ese code por este.
Ahora agregaremos el Menu de Reset
Vamos al final del plugin o donde prefieran.
Si hay alguno que otro error me lo hacen saber y lo edito
--------------------------------------
[Actualización: 26/07/19]
--------------------------------------
Comenzemos
Definimos las Infecciones y Frags (los marcos)
Código PHP:
// El +1 seria los Frags/Infecciones que se agregan al subir de nivel. Ej: Nivel 2: Necesitaria (2 Infs y Frags), Lvl 3: (3 Infs y Frags)... Así cada vez al subir de nivel
#define FRAGS(%1) (%1 * 1) + 1
#define INFECCIONES(%1) (%1 * 1) + 1
#define Nivel_Maximo 200 // Nivel Maximo
#define Max_Reset 10 // Reset Maximo
creamos las variables van a
Código PHP:
Player Vars
Arriba de
Código PHP:
new g_zombie[33]
Código PHP:
new g_level[33]
new g_frags[33]
new g_infecciones[33]
new g_reset[33]
Quedaria
Código PHP:
new g_level[33] // Nivel
new g_frags[33] // Frags (Asesinatos)
new g_infecciones[33] // Infecciones
new g_reset[33] // Reset
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
//Mas codigo...
Código PHP:
public fw_PlayerKilled(victim, attacker, shouldgib)
Y agregamos despues del
Código PHP:
// Stop bleeding/burning/aura when killed
if (g_zombie[victim])
{
remove_task(victim+TASK_BLOOD)
remove_task(victim+TASK_AURA)
remove_task(victim+TASK_BURN)
}
Código PHP:
if (g_zombie[victim] || g_nemesis[victim])
{
g_frags[attacker]+= 1
check_level(attacker)
}
Quedaria..
Código PHP:
// Stop bleeding/burning/aura when killed
if (g_zombie[victim])
{
remove_task(victim+TASK_BLOOD)
remove_task(victim+TASK_AURA)
remove_task(victim+TASK_BURN)
}
if (g_zombie[victim] || g_nemesis[victim])
{
g_frags[attacker]+= 1
check_level(attacker)
}
Ahora buscamos
Código:
zombieme
Código PHP:
// Reward frags, deaths, health, and ammo packs
Agregamos
Código PHP:
// Ganara Infecciones al infectar
g_infecciones[infector]++
check_level(infector)
Código PHP:
// Show deathmsg and reward infector?
if (rewards && infector)
{
// Send death notice and fix the "dead" attrib on scoreboard
SendDeathMsg(infector, id)
FixDeadAttrib(id)
// 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))
// Ganara Infecciones
g_infecciones[infector]++
check_level(infector) // Actualiza el nivel (por si sube de lvl)
}
Bueno ahora vamos a
Código PHP:
reset_vars(id, resetall)
Código PHP:
if (resetall)
Código PHP:
g_level[id] = 1
g_reset[id] = 0
g_frags[id] = g_infecciones[id] = 0
Quedaria...
Código PHP:
if (resetall)
{
g_level[id] = 1
g_reset[id] = 0
g_frags[id] = g_infecciones[id] = 0
g_ammopacks[id] = 0
g_zombieclass[id] = ZCLASS_NONE
g_zombieclassnext[id] = ZCLASS_NONE
//.... Mas código
Bueno ahora crearemos el check_level
- El nivel 200 es de ejemplo, de lo que seria el nivel maximo, pueden poner el que ustedes quieran
Código PHP:
//Debajo de todo su plugin pongan esto
public check_level(id)
{
// Si es el nivel maximo no subira más!
if (g_level[id] == Max_Level)
return;
// Mientras los Frags/Infecciones sean igual o mayores a lo que pide el macro subira de nivel!
while (g_frags[id] >= FRAGS(g_level[id]) && g_infecciones[id] >= INFECCIONES(g_level[id]))
{
g_level[id]++
g_frags[id] = g_infecciones[id] = 0
zp_colored_print(id,"^x04[ZP]^x01 Subiste al nivel: ^x04%d", g_level[id])
}
}
Vamos a
Código PHP:
public ShowHUD(taskid)
Y reemplazan todo ese code por este.
Código PHP:
// Show HUD Task
public ShowHUD(taskid)
{
static id
id = ID_SHOWHUD;
// Player died?
if (!g_isalive[id])
{
// Get spectating target
id = pev(id, PEV_SPEC_TARGET)
// Target not alive
if (!g_isalive[id]) return;
}
// Format classname
static class[32]
if (g_zombie[id]) // zombies
{
if (g_nemesis[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_NEMESIS")
else
copy(class, charsmax(class), g_zombie_classname[id])
}
else // humans
{
if (g_survivor[id])
formatex(class, charsmax(class), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")
else
copy(class, charsmax(class), g_human_classname[id])
}
// Spectating someone else?
if (id != ID_SHOWHUD)
{
static name[32]
get_user_name(id, name, sizeof name - 1)
// Show name, health, class, and ammo packs
set_hudmessage(255, 255, 255, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", name, pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id])
}
else
{
static szIncompleto[20]; formatex( szIncompleto, 19, "%d/%d", g_frags[id], FRAGS(g_level[id]), FRAGS(g_level[id]) - g_frags[id])
static szCompleto[20]; formatex( szCompleto, 19, "[COMPLETADO]" )
static siIncompleto[20]; formatex( siIncompleto, 19, "%d/%d", g_infecciones[id], INFECCIONES(g_level[id]), INFECCIONES(g_level[id]) - g_infecciones[id])
static siCompleto[20]; formatex( siCompleto, 19, "[COMPLETADO]" )
// Show health, class and ammo packs
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, "Vida: %d - Clase %s - Aps %d^nNivel: %d - Reset: %d - Frags: %s - Infecciones: %s", get_user_health(id), class, g_ammopacks[id], g_level[id], g_reset[id], g_frags[id] >= FRAGS(g_level[id]) ? szCompleto : szIncompleto, g_infecciones[id] >= INFECCIONES(g_level[id]) ? siCompleto : siIncompleto)
}
}
Ahora agregaremos el Menu de Reset
Vamos al final del plugin o donde prefieran.
Código PHP:
// Menu de Reset
show_menu_reset(id)
{
static menu[300], len
len = 0
// Titulo
len += formatex(menu[len], charsmax(menu) - len, "\yMenu de Reset \r - \yMaximo de Resets:\d %d^n^n", Max_Reset)
// Texto Agregado
len += formatex(menu[len], charsmax(menu) - len, "\r Condicion para Resetear^n\r- \w Nivel Necesario:\y %d^n^n", Max_Level)
// 1. Key (boton) para resetear
if (g_level[id] == Max_Level) // Si es igual al nivel maximo, puede resetear
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Resetear Personaje \y[Lvl: %d]^n^n", Max_Level)
else // Sino, vuelve al menu anterior!
len += formatex(menu[len], charsmax(menu) - len, "\r1.\d Resetear Personaje [Lvl: %d]^n^n", Max_Level)
// 0. Salir
len += formatex(menu[len], charsmax(menu) - len, "^n\r0.\w Salir")
show_menu(id, KEYSMENU, menu, -1, "Reset Menu")
}
// Public del menu
public menu_reset(id, key)
{
// Bug si se desconecta.
if (!g_isconnected[id]) return PLUGIN_HANDLED;
// Si no esta muerto no va a resetear!
if (g_isalive[id])
{
zp_colored_print(id, "^x04[ZP]^x01 Tienes que estar muerto para resetear")
return PLUGIN_HANDLED;
}
switch (key)
{
case 0:
{
if (g_reset[id] >= Max_Resets) // Si ya tiene muchos resets, no podra resetear
{
zp_colored_print(id, "^x04[ZP]^x01 Ya Tienes Muchos Resetes")
return PLUGIN_HANDLED
}
else if (g_level[id] == Max_Level)
{
g_level[id] = 1
g_infecciones[id] = g_frags[id] = 0
g_reset[id]++
zp_colored_print(id, "^x04[ZP]^x01 Perfil Reseteado!")
}
else
{
zp_colored_print(id, "^x04[ZP]^x01 No tienes lo requerido para resetear!")
show_menu_reset(id)
}
}
}
return PLUGIN_HANDLED;
}
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15