Ok, so it executes without syntax now, but it doesn't seem to be leveling up the client.
Here is how I wrote the function:
function addExperience(%client,%tempexp,%class)
{
$claslovep+=%tempexp;
$classreqexp = mPow($classlevel,2);
if($claslovep == $classreqexp)
{
$claslovep = 0;
$classlevel++;
%client.centerPrint("\c6Level Up! Your \c3"@ %class @"\c6 level is now \c3"@ $classlevel @"\c6!","3");
}
}
This is what happens when they set their class:
function servercmdsetclass(%client,%class) //This is for setting class
{
if(%class !$= "Wizard")
{
%client.centerPrint("\c6You may only choose \c3Wizard \c6right now","3");
}
else
{
%client.class = "Wizard"; //Sets class
$class = %client.class;
$classlevel = 1;
$claslovep = 0;
%client.centerPrint("\c6You are now a \c3Wizard\c6.","3");
}
}
Here is one of the spells you can do:
function servercmdfly(%client)
{
if($class $= Wizard)
{
%client.player.addVelocity("0 0 20");
$claslovep.addExperience(%client,1,Wizard);
%client.centerPrint("\c6+1 Exp","1");
}
else
{
%client.centerPrint("\c3You must be a wizard to cast a spell!","3");
}
}
And this is what to use when checking your level:
function servercmdlevel(%client)
{
if($class !$= "")
{
%client.centerPrint("\c3Your "@ $class @" level is "@ $classlevel @"!","3");
}
else
{
%client.centerPrint("\c3You don't have a class!","3");
}
}
Now when I do a spell multiple times, it doesn't seem to really be adding to my experience. When I type /level, it always displays it as 1. I think I have my variables screwed up, but idk. Any help?