Author Topic: Else if statement's?  (Read 639 times)

Ok well I made a bug fix for one of my script's but a syntax appear's right around the first else If but the first part work's perfectly. Here is the section of the code that it bug's at "Between ##* if(%#c#lient.quantity["silverore"] == 0)

Code: [Select]
if(%client.quantity["CopperOre"] == 0)
%client.quantity["CopperOre"] = 1;
%file.writeline("findclientbybl_id(" @  %client.bl_id @ ").quantity[\"CopperOre\"] = 1");
else if(%client.quantity["SilverOre"] == 0)
                %client.quantity["SilverOre"] = 1;
                %file.writeline("findclientbybl_id(" @  %client.bl_id @ ").quantity[\"SilverOre\"] = 1");

Code: [Select]
if(%client.quantity["CopperOre"] == 0)
{
%client.quantity["CopperOre"] = 1;
%file.writeline("findclientbybl_id(" @  %client.bl_id @ ").quantity[\"CopperOre\"] = 1");
}
else if(%client.quantity["SilverOre"] == 0)
{
%client.quantity["SilverOre"] = 1;
%file.writeline("findclientbybl_id(" @  %client.bl_id @ ").quantity[\"SilverOre\"] = 1");
}

Multi-line if() statements require brackets.  I recommend that you always use them and that you learn how to tab some code.

Wow can't belive it was that simple :O thank's so much trader.