10/01/2019, 10:56 PM
eh usado los niveles de kiske y el check level se bugea, no me sube los niveles, hasta el reinicio del mapa.
Quería saber que niveles por ammopacks me recomiendan.
Quería saber que niveles por ammopacks me recomiendan.
(10/01/2019, 11:36 PM)El pirucho XP-007 escribió: [ -> ]No seria mejor que pases el código o modificación que usaste en tu ZP.
No se digo yo :/
// Abajo de los Includes de tu ZombiePlague, pones:
new const NIVELES[5] = { 0, 5, 10, 20, 50 }
// Como veran, ahi estamos Creando una Constante con el Nombre "NIVELES" que abarcara (Para Explicarlo de una Manera que lo Entiendan), unos 5 Niveles.
// Si van a poner mas Niveles, deberan cambiar ese "5" por la Cantidad de Niveles que vayan a poner.
// Abajo de esa Constante creamos una Variable que contendra 33 Lugares.
new g_level[33]
// Nos dirigimos a la Forward:
public fw_PlayerKilled(victim, attacker, shouldgib)
{
// Adentro de este Public, buscamos la siguiente linea:
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect)
// Y lo reemplazamos por esto:
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
// La Funcion "update_ap" la llamaremos mas tarde.
}
// Ahora nos dirigimos a la Forward:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
// Y adentro de este Public buscamos esta linea:
g_ammopacks[attacker]++
// La reemplazamos por:
update_ap(attacker, 1, 0)
// El primer numero(1), que esta despues del Index(attacker), son los AmmoPacks que recibira el Index(attacker=atacante).
// El otro numero no nos servira por ahora.
// En este mismo Public buscamos esta linea que se encuentra mas abajo:
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect) // ammo packs given to zombie for infection
// La reemplazamos por:
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
}
// Buscamos el CLCMD:
public clcmd_buyammo(id)
{
// Y adentro de este Public buscamos esta linea:
g_ammopacks[id]--
// Y la reemplazamos por:
update_ap(id, -1, 0)
}
// Ahora buscamos lo siguiente en el Plugin:
buy_extra_item(id, itemid)
{
// Aca adentro buscamos una linea que diga lo siguiente:
// Deduce item cost
g_ammopacks[id] -= g_extraitem_cost[itemid]
// La reemplazamos por:
update_ap(id, 0 - g_extraitem_cost[itemid], 0)
}
// Ahora buscamos la Funcion:
infection_explode(ent)
{
// Aca adentro buscamos la siguiente Linea:
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect) // ammo packs given to zombie for infection
// Y la reemplazamos por:
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
}
// Buscamos la Native:
public native_set_user_ammo_packs(id, amount)
{
// Reemplazamos todo lo que esta aca adentro por:
return update_ap(id, 0 - g_ammopacks[id] + amount, 0)
}
// Ahora nos vamos al FINAL DEL PLUGIN, incluso abajo de un: "#endif", y ponemos lo siguiente:
// FORMA DE SPEED! [CON EL "goto"]
// FORMA DE SPEED! [CON EL "goto"]
// FORMA DE SPEED! [CON EL "goto"]
public update_ap(id, amount, check)
{
if (check) goto check2 // Lo que hace el "goto" es, si la Funcion esta se llamo desde "check", el Plugin lo que hara, es llamar directamente a "check2".
// Aca detectamos que si es Nivel Maximo no suba mas.
if (g_ammopacks[id] + amount > NIVELES[sizeof NIVELES - 1] - 1)
return PLUGIN_HANDLED
// Le damos los APs correspondientes.
g_ammopacks[id] += amount
// Ya lo dijimos antes ^^.
check2:
if(amount < 0)
{
if(g_ammopacks[id] < NIVELES[g_level[id]] )
{
g_level[id]--
client_print(id, print_center, "Bajaste de nivel")
update_ap(id, -1, 1)
}
}
else
{
if(g_ammopacks[id] >= NIVELES[g_level[id]] )
{
g_level[id]++
client_print(id, print_center, "Subiste de nivel")
update_ap(id, 0, 1)
}
}
return PLUGIN_HANDLED
}
(11/01/2019, 01:45 AM)totopizza escribió: [ -> ]Te recomiendo mejor leer este: https://amxmodx-es.com/Thread-Guia-defin...l-10-11-18
public update_ap(id, amount, check)
{
if (check) goto check2
if (g_ammopacks[id] + amount > levels[sizeof levels - 1] - 1)
return PLUGIN_HANDLED
g_ammopacks[id] += amount
check2:
if(amount < 0)
{
if(g_ammopacks[id] < levels[g_level[id] - 1] )
{
g_level[id]--
client_print(id, print_center, "Bajaste de nivel")
update_ap(id, -1, 1)
}
}
else
{
if(g_ammopacks[id] >= levels[g_level[id]] )
{
g_level[id]++
client_print(id, print_center, "Subiste de nivel!")
update_ap(id, 0, 1)
}
}
return PLUGIN_HANDLED
}
// Adentro de este Public, buscamos la siguiente linea:
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect)
// Y lo reemplazamos por esto:
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
// Reward ammo packs for every [ammo damage] dealt
while (g_damagedealt[attacker] >= ammodamage)
{
g_ammopacks[attacker]++
g_damagedealt[attacker] -= ammodamage
}
// Reward ammo packs for every [ammo damage] dealt
while (g_damagedealt[attacker] >= ammodamage)
{
g_ammopacks[attacker]++
update_ap(attacker, 1, 0)
g_damagedealt[attacker] -= ammodamage
}
// Infection allowed
SendDeathMsg(attacker, victim) // send death notice
FixDeadAttrib(victim) // fix the "dead" attrib on scoreboard
UpdateFrags(attacker, victim, get_pcvar_num(cvar_fragsinfect), 1, 1) // add corresponding frags and deaths
zombieme(victim, attacker, 0, 0) // turn into zombie
g_ammopacks[attacker] += get_pcvar_num(cvar_ammoinfect) // ammo packs given to zombie for infection
update_ap(attacker, 1, 0)
fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // attacker gets bonus HP for the infection
// Deduce item cost
g_ammopacks[id] -= g_extraitem_cost[itemid]
update_ap(id, g_extraitem_cost[itemid], 0)
// Native: zp_set_user_ammo_packs
public native_set_user_ammo_packs(id, amount)
{
g_ammopacks[id] = amount;
}
// Native: zp_set_user_ammo_packs
public native_set_user_ammo_packs(id, amount)
{
return update_ap(id, 0 - g_ammopacks[id] + amount, 0)
}
(11/01/2019, 01:45 AM)totopizza escribió: [ -> ]Te recomiendo mejor leer este: https://amxmodx-es.com/Thread-Guia-defin...l-10-11-18