[GUIA] Crear Niveles a Frags e Infecciones - Cr3470r - 25/04/2014
Bueno.. Hoy les enseñare a hacer niveles a frags.. Si ven algun error me avisan
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(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) }
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] = 0
Compilan y Listo.
RE: [ZP][TUT] Crear Niveles a Frags e Infecciones - K.-' - 25/04/2014
no veo ningun tutorial , es una guia esto modificale el nombre
con respecto al theard no entiendo tanto de Zp pero creo que esta bien explicado las cosas.
RE: [ZP][TUT] Crear Niveles a Frags e Infecciones - Cr3470r - 25/04/2014
Okey.. Me alegro que te haya gustado
RE: [GUIA] Crear Niveles a Frags e Infecciones - Nike - 25/04/2014
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(attacker, victim) // noticia por infectar FixDeadAttrib(victim) // mostramos el score que fue infectado UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // + 1 frag por infectar g_infecciones[attacker]++ check_level(attacker) zombieme(victim, attacker, 0, 0) // a la victima lo covertimos en zombie g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect) // gano X ap por infectar fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // bonus de vida por infectar return HAM_SUPERCEDE; }
RE: [GUIA] Crear Niveles a Frags e Infecciones - CSAxel - 25/04/2014
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
RE: [GUIA] Crear Niveles a Frags e Infecciones - Cr3470r - 26/04/2014
Okey.. Gracias.
RE: [GUIA] Crear Niveles a Frags e Infecciones - Nike - 26/04/2014
(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?
RE: [GUIA] Crear Niveles a Frags e Infecciones - [E]manuelitop15 - 04/11/2018
(25/04/2014, 02:38 AM)Cr3470r escribió: Bueno.. Hoy les enseñare a hacer niveles a frags.. Si ven algun error me avisan
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(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) }
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] = 0
Compilan y Listo.
Jamas defines Puntuacion. Definelo o saltara error!
|