<?php
define('INSIDE' , true);
define('INSTALL' , false);
includeLang('INGAME');
$showmsg = 0;
$qrylevel = doquery("SELECT dmlevel FROM {{table}} WHERE `id` = '{$user['id']}'", 'users', true);
$level = $qrylevel ['dmlevel'];
$qrypuntos = doquery("SELECT total_points FROM {{table}} WHERE `id_owner` = '{$user['id']}'", 'statpoints', true);
$puntos = $qrypuntos ['total_points'];
$qrymateria = doquery("SELECT darkmatter FROM {{table}} WHERE `id` = '{$user['id']}'", 'users', true);
$parse = $lang;
if ( $level == 0 && $puntos >= 10000 )
{
$qrymateria = + 500;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 1 && $puntos >= 50000 )
{
$qrymateria = + 500;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 2 && $puntos >= 100000 )
{
$qrymateria = + 1000;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 3 && $puntos >= 250000 )
{
$qrymateria = + 1500;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 4 && $puntos >= 500000 )
{
$qrymateria = + 1500;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 5 && $puntos >= 750000 )
{
$qrymateria = + 2000;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 6 && $puntos >= 1000000 )
{
$qrymateria = + 2000;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 7 && $puntos >= 1500000 )
{
$qrymateria = + 2500;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 8 && $puntos >= 2000000 )
{
$qrymateria = + 3000;
$qrylevel = + 1;
$showmsg = + 1;
}
elseif ( $level == 9 && $puntos >= 2500000 )
{
$qrymateria = + 3000;
$qrylevel = + 1;
$showmsg = - 1;
}
else
{
}
$QryUpdateUser .= "UPDATE {{table}} SET ";
$QryUpdateUser .= "`darkmatter` = `darkmatter` + '". $qrymateria ."', ";
$QryUpdateUser .= "`dmlevel` = `dmlevel` + '". $qrylevel ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '{$user['id']}' ";
doquery( $QryUpdateUser, "users");
if ( $showmsg == 0 )
{
message($lang['nolevel'], '', '', true);
}
elseif ( $showmsg == 1 )
{
message($lang['levelup'], '', '', true);
}
elseif ( $showmsg == -1 )
{
message($lang['levelmax'], '', '', true);
}
else
{
}
?>