Ok well I made a money system it save's fine but I can't get it to save Ore/Wood what would I do?
//Gold
function serverCmdGrantGold(%client,%victim,%amount)
{
if(!%client.isSuperAdmin)
return;
%victim = findClientByBL_ID(%victim);
if(!isobject(%victim)){return;}//dont let them give Gold to non-existant people
%victim.Gold+=%amount;
messageClient(%victim,'Given $%2 by %1',%client.name,%amount);
messageClient(%client,'Gave %1 $%2',%victim.name, %amount);
}
function serverCmdgiveGold(%client,%victim,%amount)
{
if(%amount<=0||%Amount>%client.Gold)
messageClient(%client,'','Not enough Gold! Gold: %1',%client.Gold);
return;
%victim = findClientByBL_ID(%victim);
if(!isobject(%victim)){return;}//dont let them give Gold to non-existant people
%victim.Gold+=%amount;
%client.Gold-=%amount;
messageClient(%victim,'Given %2 Gold by %1',%client.name,%amount);
}
function serverCmdCheckGold(%client)
{
messageClient(%client,'','Gold Left : %1',%client.Gold);
}
function serverCmdSaveBank(%client){
if(%client.inBank){
%Gold = %client.Gold;
%file = new FileObject();
%file.openforRead("Add-Ons/Client/BLBank/" @ %Client.BL_Id @ ".txt");
while(!%file.isEOF())
{
%line = %file.readLine();
switch$(firstWord(%line))
{
case "ID": %ID = restWords(%line);
case "Gold": %ExistingGold = restWords(%line);
}
}
%file.openForWrite("Add-Ons/Client/BLBank/" @ %Client.BL_Id @ ".txt");
%file.writeline("ID " @ %client.BL_ID);
%file.writeline("Gold " @ %client.Gold+%ExistingGold);
%file.close();
%file.delete();
%client.Gold = %client.Gold-%client.Gold;
Messageclient(%client,"","\c6You have successfully deposited " @ $Currency @ "\c0" @ %Gold);
CenterPrint(%client,"<just:left> < " @ ($CurrencyFront ? ($Currency @ "\c0" @ %client.Gold) : ("\c0" @ %client.Gold @ "\c6" @ $currency)) @" >",2);
%client.hasWithdrawn = 0;
}
}
function serverCmdLoadBank(%client){
if(%client.inBank && !%client.hasWithdrawn){
%client.hasWithdrawn = 1;
%file = new FileObject();
%file.openforRead("Add-Ons/client/BLBank/" @ %client.BL_ID @ ".txt");
while(!%file.isEOF())
{
%line = %file.readLine();
switch$(firstWord(%line))
{
case "ID": %ID = restWords(%line);
case "Gold": %Gold = restWords(%line);
}
}
if(%client.BL_ID $= %ID){
%client.Gold = %client.Gold+%Gold;
%file.openForWrite("Add-Ons/client/BLBank/" @ %client.BL_ID @ ".txt");
%file.writeLine("ID " @%client.BL_Id);
%file.writeLine("Gold 0");
messageclient(%client,"","\c6You have successfully withdrawn " @ $Currency @ "\c0" @ %Gold);
CenterPrint(%client,"<just:left> < " @ ($CurrencyFront ? ($Currency @ "\c0" @ %client.Gold) : ("\c0" @ %client.Gold @ "\c6" @ $currency)) @" >",2);
%file.close();
%file.delete();
}
}
}
function serverCmdWithdraw(%client){
if(%client.isAdmin || %client.isSuperAdmin){
%i = new Trigger() {
position = %client.player.getTransform();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = bankWithdraw;
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};
if(%i){
messageclient(%client,"","\c0Withdrawal \c6trigger has successfully been laid");
}
}
}
function serverCmdDeposit(%client){
if(%client.isAdmin || %client.isSuperAdmin){
%i = new Trigger() {
position = %client.player.getTransform();
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = bankDeposit;
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};
if(%i){
messageclient(%client,"","\c0Deposition \c6trigger has successfully been laid");
}
}
}
activatepackage(Gold);
datablock TriggerData(bankDeposit){
tickPeriodMS = 100;
};
function bankDeposit::OnEnterTrigger(%this, %trigger, %obj){
%client = %obj.client;
%client.inBank = 1;
if(%client.Gold >= "1"){
serverCmdSaveBank(%client);
}
}
function bankDeposit::OnLeaveTrigger(%this, %trigger, %obj){
%client = %obj.client;
%client.inBank = 0;
}
function bankDeposit::onTickTrigger(%trigger){}
datablock TriggerData(bankWithdraw){
tickPeriodMS = 100;
};
function bankWithdraw::OnEnterTrigger(%this, %trigger, %obj){
%client = %obj.client;
%client.inBank = 1;
serverCmdLoadBank(%client);
}
function bankWithdraw::OnLeaveTrigger(%this, %trigger, %obj){
%client = %obj.client;
%client.inBank = 0;
}
function bankWithdraw::OnTickTrigger(%trigger){}