Quote:
Originally Posted by Axelromero91
Te explico, tengo nivel 1, y para llegar a nivel 2 necesito 20 ammopacks, gano 25 ammopacks y subo a nivel 2
y gasto 5 ammopacks me quedan los 20 que necesiaba para el nivel 2, pero me salta el print que baje de nivel, osea gasto un ammopacks y me tira el print y me baja el level.....
En donde hira ese if(g_level[id] == 250) return; ?
|
ahhhh.... mmm..
PHP Code:
public update_ap(id, amount, check)
{
if (g_level[id] == 258) return; // aca...
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] < 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
}
y con lo otro no se... yo te recomendaria que uses macros..
ahh y ahora que me doy cuenta, en este sistema de levels no tienes que poner el nivel maximo.. porque ya lo defines.. mira
PHP Code:
new const NIVELES[5] = { 0 , 5, 10, 20 , 50 } // el 5 que esta en corchetes es el nivel maximo..
aunque .. tedigo? macros es la onda
, te ahorras mucho code.. aca te dejo el
TUT si tienes alguna duda MP o crea un thread, Nv.
__________________