Blockland Forums > Modification Help
Point taxing doesn't save
Big Brother:
This is a mod made by Fluffy - basically, every 10 minutes you are taxed a small percentage of your points. Your points are stored as a client variable used in VCE and are used to buy stuff on my server. The problem is, after you get taxed - it doesn't save. You can load your game again by clicking a brick on my server and you'll get the points back that you lost from tax. Let me just say that I am not deleting this load brick, because it also loads lots of other information.
--- Quote ---$Interest::CutOff[0] = "100";
$Interest::Percentage[0] = "1";
$Interest::CutOff[2] = "20000";
$Interest::Percentage[2] = "4";
$Interest::TickTime = 10;
function intrestTick()
{
cancel($interestTickShed);
$interestTickShed = schedule(60000, 0, intrestTick);
$InterestTickCount++;
if($InterestTickCount < ($Interest::TickTime - 1))
return;
for(%i = 0; %i < clientGroup.getCount(); %i++)
{
%client = clientGroup.getObject(%i);
%var = VariableGroup_8294.getVariabl e("Client", "points", %client);
%num = %var;
%per = 0;
if(%var > $Interest::CutOff[0])
{
%per = %var * (0.01 * $Interest::Percentage[0]);
%num = %var - %per;
}
if(%var > $Interest::CutOff[2])
{
%per = %var * (0.01 * $Interest::Percentage[2]);
%num = %var - %per;
}
%num = mCeil(%num);
%per = mCeil(%per);
messageClient(%client, '', "\c2You have been taxed \c6" @ %per @ "\c2 points.");
messageClient(%client, '', "\c2You now have a total of \c6" @ %num @ "\c2 points.");
VariableGroup_8294.setVariabl e("Client", "points", %num, %client);
%client.setScore(%num);
}
VariableGroup_8294.saveAllVar iables($VCE::Server::SavePath);
$InterestTickCount = 0;
}
intrestTick();
--- End quote ---
That's the code. I'm going to take a swing that the following line has been giving me the business:
VariableGroup_8294.saveAllVar iables($VCE::Server::SavePath);
So if anybody can find a way so that your points are saved straight after tax by fixing up this code, I'd be grateful.
I can't ask Fluffy because he's away.
Big Brother:
man, waste of time. no help. :C
SpreadsPlague:
well your ID is 8294 and that number is 8294 so I assume it's saving only yours
I don't actually know how variable groups work though so don't quote me on anything :cookieMonster:
Headcrab Zombie:
This is why I don't approve of using VCE for gamemodes, especially when you mix it with script, it just complicates things.
To save your data, either write your own saving function, or use a default feature
Big Brother:
--- Quote from: SpreadsPlague on April 08, 2012, 07:20:32 PM ---well your ID is 8294 and that number is 8294 so I assume it's saving only yours
I don't actually know how variable groups work though so don't quote me on anything :cookieMonster:
--- End quote ---
No, silly. It doesn't work on me either.