Blockland Forums > Modification Help
ADD-ON script_moneymod contains syntax errors...?
mp7964:
I get this error while trying to test my money mod (More of playing around with varibles, really...)
(Note, I did write package correctly, and I don't even know about servercmdmoneyadd...)
VVV-Error Report-VVV
--- Code: ---Loading Add-On: script_moneymod (CRC:1537974462)
Add-Ons/script_moneymod/moneyscript.cs Line: 3 - Syntax error.
>>> Some error context, with ## on sides of error halt:
ackage MPcash
function ##S##erverCmdMoneyAdd()
{
%money += %5;
messageclient(%client, "", "You have been granted 5!");
messageclient(%client, 'bottomprint', %money, 10);
}
function ServerCmdMoneySubtract()
{
%money -= 5;
messageclient(%client "","You lost 5!");
messageclient(%client, 'bottomprint', %money, 10);
>>> Error report complete.
ADD-ON "script_moneymod" CONTAINS SYNTAX ERRORS
--- End code ---
VVV-Actual Script-VVV
--- Code: ---package MPcash
function ServerCmdMoneyAdd()
{
%money += %5;
messageclient(%client, "", "You have been granted 5!");
messageclient(%client, 'bottomprint', %money, 10);
}
function ServerCmdMoneySubtract()
{
%money -= 5;
messageclient(%client "","You lost 5!");
messageclient(%client, 'bottomprint', %money, 10);
}
function ServerCmdMoneySave()
{
export("$money*", "config/money.cs");
messageclient(%client "","Money saved!");
messageclient(%client, 'bottomprint', %money, 10);
}
function ServerCmdMoneyLoad()
{
exec("config/money.cs");
echo("Money.cs loaded!");
messageclient(%client "","Money loaded!");
messageclient(%client, 'bottomprint', %money, 10);
}
function ServerCmdMoneyHelp()
{
messageclient(%client "","Hello, welcome to moneymod. The commands for this mod are...");
messageclient(%client "","MoneySubtract - Subtracts 5 dollars from cash.");
messageclient(%client "","MoneySave - Saves money to a file.");
messageclient(%client "","MoneyLoad - Loads money from file.");
messageclient(%client "","MoneyHelp - Lists MoneyMod commands.");
}
};
--- End code ---
Can someone help, or just fix the script completely? I have to go for the night, but just PM the script to me or post it in comments, either works.
Thanks :D
Pah1023:
Forgot a bracket after package.
mp7964:
--- Quote from: Pah1023 on September 01, 2011, 12:30:02 AM ---Forgot a bracket after package.
--- End quote ---
Ah, you see, even WITH the bracket, it has the error, I. Believe. I will try that tomorrow, posting from an android is hard. ,_.
jes00:
I see multiple things wrong with this script.
Fluff-is-back:
--- Quote from: jes00 on September 01, 2011, 07:31:45 AM ---I see multiple things wrong with this script.
--- End quote ---
Stating the errors would be more help.
I had a look at the script and fixed the syntax errors, and incorrect usage of messageclient, This should work however there may be a problem I overlooked.
--- Code: ---package MPcash
{
function ServerCmdMoneyAdd(%client)
{
$money += 5;
messageclient(%client , '', "You have been granted 5!");
messageclient(%client , 'bottomprint', %money, 10);
}
function ServerCmdMoneySubtract(%client)
{
$money -= 5;
messageclient(%client , '', "You lost 5!");
messageclient(%client , 'bottomprint', %money, 10);
}
function ServerCmdMoneySave(%client)
{
export("$money*", "config/money.cs");
messageclient(%client , '', "Money saved!");
messageclient(%client , 'bottomprint', %money, 10);
}
function ServerCmdMoneyLoad(%client)
{
exec("config/money.cs");
echo("Money.cs loaded!");
messageclient(%client , '', "Money loaded!");
messageclient(%client , 'bottomprint', %money, 10);
}
function ServerCmdMoneyHelp(%client)
{
messageclient(%client , '', "Hello, welcome to moneymod. The commands for this mod are...");
messageclient(%client , '', "MoneySubtract - Subtracts 5 dollars from cash.");
messageclient(%client , '', "MoneySave - Saves money to a file.");
messageclient(%client , '', "MoneyLoad - Loads money from file.");
messageclient(%client , '', "MoneyHelp - Lists MoneyMod commands.");
}
};
activatePackage(MPcash);
--- End code ---