0
Hello, I’m creating a system of levels But, the level updates according to the refresh of the page. example: Exp maxima is 100% which is = to 100.
If I add 1000 Exp to the user’s account, it uploads the level to the next one, but refresh, which will take forever to stop having 1000 Exp.
The code is
//update level and exp
$playert_exp = selectplayerexp($db);
$limit_exp = 100;
if($player_exp >= $limit_exp) {
$levelup = (int) ($player_exp / $limit_exp);
$withdraw = (int) (??????????????);
update_Level($con, $widthdraw);
if($player_level != $limit_level) {
echo "<script>alert('Boa! Atingiu o Nível $player_level_total.');</script>";
}
}
My goal is... clacular all Exp saved in DB $player_exp, make the sum for example 100exp = 1lvl , 1000 = 10 lvls.
I was thinking of a foreach, but I can’t...
Now I need 1 thing to finish, since I already have the calculation to give the appropriate level according to EXP, now I need to remove this EXP, example
Se o utilizador tiver 1050 de EXP, o calculo deverá retirar todos os valores iguais a 100, o que significa que retira os 1000 e deixa os 50.
I’m standing here..:
$withdraw = (int) (??????????????);
$level = (int) ($playert_exp / $limit_exp);
– fajuchem
does not work, because when I refresh it calculates lvl according to XP and adds + these levels, but XP gets buggy and is missing X Exp, which gives new levels...
– RuiAlvez
ok, this then makes it the right LEVEL of total EXP. Now I need to... REMOVE THE EXP unnecessary...
$deposit_exp = (int) ($player_exp - ????)
– RuiAlvez