Bueno.. Hoy les enseñare a hacer niveles a frags.. Si ven algun error me avisan
Empezamos:
Abajo de los includes:
Ahora tenemos que crear las variables. Pueden ponerle el nombre que ustedes mas gusten..
Ahora vamos a hacer que gane frags para eso nos vamos a:
public fw_PlayerKilled(victim, attacker, shouldgib)
Aca estamos diciendo que si el zombie o el nemesis es la victima
el atacante ganaria frags. Caso contrario si el survivor es la victima. El atacante ganaria infecciones
Ahora nos vamos a: public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) - Para que gane infecciones
Aca estamos diciendo que si el Zombie ataca al ultimo Humano. No ganaria infecciones. Bloqueamos el Modo Swarm Y Modo Plague Por que hay que matar al Humano o Survivor y si no bloqueamos esos dos modos al atacar ganaria infecciones.
Ahora vamos a poner en el hud los frags/infecciones, frags/infecciones restantes y el COMPLETADO:
Ahora vamos a chequear que suba de nivel al final del zp ponen:
Ahora.. Ultimo paso.. Vamos a if (resetall) - Y ponen
Compilan y Listo.
Empezamos:
Abajo de los includes:
Código PHP:
#define FRAGS(%1) (%1 * 1)
#define INFECCIONES(%1) (%1 * 1) + 2
Código PHP:
new g_nivel[33]
new g_frags[33]
new g_infecciones[33]
Ahora vamos a hacer que gane frags para eso nos vamos a:
public fw_PlayerKilled(victim, attacker, shouldgib)
Aca estamos diciendo que si el zombie o el nemesis es la victima
el atacante ganaria frags. Caso contrario si el survivor es la victima. El atacante ganaria infecciones
Código PHP:
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (g_zombie[victim] || g_nemesis[victim])
{
g_frags[attacker]++
check_level(attacker)
}
else if (!g_zombie[victim] || g_survivor[victim])
{
g_infecciones[attacker]++
check_level(attacker)
}
}
Ahora nos vamos a: public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) - Para que gane infecciones
Aca estamos diciendo que si el Zombie ataca al ultimo Humano. No ganaria infecciones. Bloqueamos el Modo Swarm Y Modo Plague Por que hay que matar al Humano o Survivor y si no bloqueamos esos dos modos al atacar ganaria infecciones.
Código PHP:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (g_zombie[attacker] && !g_nemesis[attacker] && !g_swarmround && g_plagueround)
{
g_infecciones[attacker]++
check_level(attacker)
}
}
Ahora vamos a poner en el hud los frags/infecciones, frags/infecciones restantes y el COMPLETADO:
Código PHP:
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 [%s]", g_frags[id], FRAGS(g_nivel[id]), Puntuacion(FRAGS(g_nivel[id]) - g_frags[id]))
static szCompleto[20]; formatex( szCompleto, 19, "COMPLETADO [0]" )
static siIncompleto[20]; formatex( siIncompleto, 19, "%d/%d [%s]", g_infecciones[id], INFECCIONES(g_nivel[id]), Puntuacion(INFECCIONES(g_nivel[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, "%L: %d - %L %s - %L %d - Nivel: %d - Frags: %s - Infecciones: %s", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], g_nivel[id], g_frags[id] >= FRAGS(g_nivel[id]) ? szCompleto : szIncompleto, g_infecciones[id] >= INFECCIONES(g_nivel[id]) ? siCompleto : siIncompleto)
}
Código PHP:
public check_level(id)
{
if( g_nivel[id] >= 500 ) // Nivel Maximo = 500
{
g_nivel[id] = 500 // Nivel Maximo = 500
return;
}
while (g_frags[id] >= FRAGS(g_nivel[id]) && g_infecciones[id] >= INFECCIONES(g_nivel[id]))
{
g_nivel[id]++
g_frags[id] = 0
g_infecciones[id] = 0
}
}
Ahora.. Ultimo paso.. Vamos a if (resetall) - Y ponen
Código PHP:
g_nivel[id] = 1
g_frags[id] = 0
g_infecciones[id] = 0