Aca es donde llamo al la funcion Update_ap:
PHP Code:
public fw_PlayerKilled(victim, attacker, shouldgib)
{
// code code ... ...
// Zombie/nemesis killed human, reward ammo packs
if (g_zombie[attacker] && (!g_nemesis[attacker] || !get_pcvar_num(cvar_nemignoreammo)))
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0)
// Code code ... ...
}
y en:
PHP Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
// Code Code ... ...
// Reward ammo packs for every [ammo damage] dealt
while (g_damagedealt[attacker] >= ammodamage)
{
update_ap(attacker, 1, 0)
g_damagedealt[attacker] -= ammodamage
}
// code code ... ...
// 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
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // attacker gets bonus HP for the infection
return HAM_SUPERCEDE;
}
PHP Code:
infection_explode(ent)
{
// Code Code ... ...
// Infected victim's sound
engfunc(EngFunc_EmitSound, victim, CHAN_VOICE, grenade_infect_player[random_num(0, sizeof grenade_infect_player - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
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 & deaths
zombieme(victim, attacker, 0, 1) // turn into zombie
update_ap(attacker, get_pcvar_num(cvar_ammoinfect), 0) // ammo packs given to zombie for infection
fm_set_user_health(attacker, pev(attacker, pev_health)+get_pcvar_num(cvar_zombiebonushp)) // infection HP bonus
}
Y aca esta la funcion con la forma de capostrike93:
PHP Code:
public update_ap(id, amount, check)
{
if (!check)
{
/*if (g_ammopacks[id] + amount > NIVELES[sizeof NIVELES - 1] - 1)
return PLUGIN_HANDLED*/
g_ammopacks[id] += amount
}
else
{
if(amount < 0)
{
if(g_ammopacks[id] < EXPLVL(g_lvl[id]))
{
g_lvl[id]--
client_print(id, print_center, "Bajaste de nivel")
update_ap(id, -1, 1)
}
}
else
{
if(g_ammopacks[id] >= EXPLVL(g_lvl[id]))
{
g_lvl[id]++
client_print(id, print_center, "Subiste de nivel")
update_ap(id, 0, 1)
}
}
}
return PLUGIN_HANDLED
}
aclaro que la linea que esta "comentada" la tube que poner asi porque use macros para la experiencia de cada nivel y con eso me tiraba error