I wrote up this currency code and was wondering if this would work before I put it in and probably earn a syntax error.
I thought I'd check with you guys beforehand
registerOutputEvent(GameConnection, "addRupees","int 1 10000 25", 1);
function GameConnection::addRupees(%client, %amount)
{
%oldRup = %client.rupees;
%client.rupees = (%oldRup + %amount);
commandToClient(%client, 'bottomprint', "You now have" SPC %client.rupees SPC "rupees", 1);
}
registerOutputEvent(GameConnection, "subtractRupees","int 1 10000 25", 1);
function GameConnection::subtractRupees(%client, %amount)
{
{
if(%client.rupees >= %amount)
{
%oldRup = %client.rupees;
%client.rupees = (%oldRup - %amount);
commandToClient(%client, 'bottomprint', "You now have" SPC %client.rupees SPC "rupees", 1);
}
else
{
commandToClient(%client, 'bottomprint', "You do not have enough rupees to do this", 1);
}
}
}
registerOutputEvent(GameConnection, "setRupees","int 1 10000 25", 1);
function GameConnection::setRupees(%client, %amount)
{
%client.rupees = %amount;
commandToClient(%client, 'bottomprint', "You now have" SPC %client.rupees SPC "rupees", 1);
}