[GUIA] Crear Niveles a Frags e Infecciones
#1
Bueno.. Hoy les enseñare a hacer niveles a frags.. Si ven algun error me avisan Lengua

Empezamos:

Abajo de los includes:
Código PHP:
#define FRAGS(%1)    (%1 * 1)
#define INFECCIONES(%1)    (%1 * 1) + 2 
Ahora tenemos que crear las variables. Pueden ponerle el nombre que ustedes mas gusten..

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(victimattackershouldgib)
{
        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(victiminflictorattackerFloat:damagedamage_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(idnamesizeof name 1)
        
        
// Show name, health, class, and ammo packs
        
set_hudmessage(255255255HUD_SPECT_XHUD_SPECT_Y06.01.10.00.0, -1)
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %s^nHP: %d - %L %s - %L %d"ID_SHOWHUD"SPECTATING"namepev(idpev_health), ID_SHOWHUD"CLASS_CLASS", class, ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[id])
    }
    else
    {
        static 
szIncompleto[20]; formatexszIncompleto19"%d/%d [%s]"g_frags[id], FRAGS(g_nivel[id]), Puntuacion(FRAGS(g_nivel[id]) - g_frags[id]))
        static 
szCompleto[20]; formatexszCompleto19"COMPLETADO [0]" )
        
        static 
siIncompleto[20]; formatexsiIncompleto19"%d/%d [%s]"g_infecciones[id], INFECCIONES(g_nivel[id]), Puntuacion(INFECCIONES(g_nivel[id]) - g_infecciones[id]))
        static 
siCompleto[20]; formatexsiCompleto19"COMPLETADO" )
        
        
// Show health, class and ammo packs
        
set_hudmessage(redgreenblueHUD_STATS_XHUD_STATS_Y06.01.10.00.0, -1)
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L: %d - %L %s - %L %d - Nivel: %d - Frags: %s - Infecciones: %s"id"ZOMBIE_ATTRIB1"pev(ID_SHOWHUDpev_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 szIncompletog_infecciones[id] >= INFECCIONES(g_nivel[id]) ? siCompleto siIncompleto)
    } 
Ahora vamos a chequear que suba de nivel al final del zp ponen:
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] = 
Compilan y Listo.
(15/12/2020, 07:06 PM)Mario AR. escribió: Cuando tu acatante conozca de tu nuevo puerto, te volverá a atacar
Responder
#2
no veo ningun tutorial , es una guia esto modificale el nombre Sonrisa

con respecto al theard no entiendo tanto de Zp pero creo que esta bien explicado las cosas.
(10/10/2014, 06:38 PM)RauliTop escribió:
(10/10/2014, 04:40 PM)ivan escribió: no sabía que se podia poner los iconos gestuales cuando das reputacion negativa/positiva.
ui, peligro...
pronto habrán reputaciones de ivan:
hace muy muy muii DafuqYao mingGenius buenos Thats what she saidtutoriales Proud me encataan Whatever
Responder
#3
Okey.. Me alegro que te haya gustado
(15/12/2020, 07:06 PM)Mario AR. escribió: Cuando tu acatante conozca de tu nuevo puerto, te volverá a atacar
Responder
#4
A mi no me gusto...

en ninguna parte de la infeccion no verificas el ultimo humano en un modo enfeccion o multi, tampoco es necesario hacer esa parte del code por que lo podes chekear desde la infeccion del zp...

Código PHP:
    // Original infect
    
SendDeathMsg(attackervictim// noticia por infectar
    
FixDeadAttrib(victim// mostramos el score que fue infectado
    
UpdateFrags(attackervictimget_pcvar_num(cvar_fragsinfect), 11// + 1 frag por infectar
    
g_infecciones[attacker]++
        
check_level(attacker)
    
zombieme(victimattacker00// a la victima lo covertimos en zombie
    
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect// gano X ap por infectar
    
fm_set_user_health(attackerpev(attackerpev_health)+get_pcvar_num(cvar_zombiebonushp)) // bonus de vida por infectar
    
    
return HAM_SUPERCEDE;
    

[Guia] Granada de Droga [actulizado 01/04/14]
[Guia] Cambio de leap zp 4.2 a 4.3

Zp 4.2 Extincion [Beta+Lvl] Edicion 0.1 (%95) terminado
Responder
#5
Agregale lo que te dijo Nike arriba.. Es mejor hacerlo de esa forma.. Y tambien ojo con la bomba de infeccion, ahi infectas y no te da nada de frags o infecciones.. Fijate y te recomiendo ver donde se suma la variable "g_ammopacks" y vas a ver donde ganan las infecciones los zombies y los frags Guiño
Responder
#6
Okey.. Gracias.
(15/12/2020, 07:06 PM)Mario AR. escribió: Cuando tu acatante conozca de tu nuevo puerto, te volverá a atacar
Responder
#7
(26/04/2014, 12:43 AM)Cr3470r escribió: Okey.. Gracias.

Lo vas a cambiar o vas a dejar el code con ese error... O no es tuyo el code?
[Guia] Granada de Droga [actulizado 01/04/14]
[Guia] Cambio de leap zp 4.2 a 4.3

Zp 4.2 Extincion [Beta+Lvl] Edicion 0.1 (%95) terminado
Responder
#8
(25/04/2014, 02:38 AM)Cr3470r escribió: Bueno.. Hoy les enseñare a hacer niveles a frags.. Si ven algun error me avisan Lengua

Empezamos:

Abajo de los includes:
Código PHP:
#define FRAGS(%1)    (%1 * 1)
#define INFECCIONES(%1)    (%1 * 1) + 2 
Ahora tenemos que crear las variables. Pueden ponerle el nombre que ustedes mas gusten..

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(victimattackershouldgib)
{
        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(victiminflictorattackerFloat:damagedamage_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(idnamesizeof name 1)
        
        
// Show name, health, class, and ammo packs
        
set_hudmessage(255255255HUD_SPECT_XHUD_SPECT_Y06.01.10.00.0, -1)
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %s^nHP: %d - %L %s - %L %d"ID_SHOWHUD"SPECTATING"namepev(idpev_health), ID_SHOWHUD"CLASS_CLASS", class, ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[id])
    }
    else
    {
        static 
szIncompleto[20]; formatexszIncompleto19"%d/%d [%s]"g_frags[id], FRAGS(g_nivel[id]), Puntuacion(FRAGS(g_nivel[id]) - g_frags[id]))
        static 
szCompleto[20]; formatexszCompleto19"COMPLETADO [0]" )
        
        static 
siIncompleto[20]; formatexsiIncompleto19"%d/%d [%s]"g_infecciones[id], INFECCIONES(g_nivel[id]), Puntuacion(INFECCIONES(g_nivel[id]) - g_infecciones[id]))
        static 
siCompleto[20]; formatexsiCompleto19"COMPLETADO" )
        
        
// Show health, class and ammo packs
        
set_hudmessage(redgreenblueHUD_STATS_XHUD_STATS_Y06.01.10.00.0, -1)
        
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L: %d - %L %s - %L %d - Nivel: %d - Frags: %s - Infecciones: %s"id"ZOMBIE_ATTRIB1"pev(ID_SHOWHUDpev_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 szIncompletog_infecciones[id] >= INFECCIONES(g_nivel[id]) ? siCompleto siIncompleto)
    } 
Ahora vamos a chequear que suba de nivel al final del zp ponen:
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] = 
Compilan y Listo.

Jamas defines Puntuacion. Definelo o saltara error!
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)