I'd do something like this:
if(isFile("config/server/XP/data.cs")) {
exec("config/server/XP/data.cs");
}
function storeXP()
{
export("$XPSave_*","config/server/XP/data.cs");
}
//Function to add XP to client, by carrying out an action or whatever, call it with giveXP(%client,%amt);
// %client is the client, obviously. %amt is the amount of XP.
function giveXP(%client,%amt)
{
$XPSave_[%client.BL_ID] += %amt; // Add to variable (You could also deduct by using minus numbers.)
storeXP();
}
package LoadXP
{
function gameConnection::autoAdminCheck(%client)
{
if($XPSave_[%client.BL_ID]) {
messageClient(%client, '', "\c6Welcome back,\c3" SPC %client.name SPC"\c6. Your XP (\c3" @ $XPSave_[%client.BL_ID] @ "\c6) has been restored.");
%client.XP = $XPSave_[%client.BL_ID];
} else {
%client.XP = 0;
}
return Parent::autoAdminCheck(%client);
}
};
activatePackage(LoadXP);
The export function will export every variable that has a prefix of "$XPSave_"
The * works as a wildcard and in the data.cs file, it'll record it in variable form.
For example:
$XPSave_14911 = 31;
$XPSave_14553 = 33;
$XPSave_14552 = 43;
Also, returning a function that already exists is important.