Nearly, you missed a } though:
function blah(%client){
if(%client.isSuperAdmin)
{
//Super
}
else if(%client.isAdmin)
{
//Admin
}
else
{
//None
}
}
Also, for certain uses the
switch and
switch$ statements exist:
function ChooseClass(%client)
{
%classNum = getRandom(0,3);
switch(%classNum)
{
case 0:
return "Warrior";
case 1:
%client.player.tool[0] = bowItem;
messageclient(%client,'msgItemPickup',"",0,nametoID("bowItem"));
return "Archer";
case 2:
messageclient(%client,"","\c5You are now a White Mage! Go to the Rune Shop and buy magical Runes.");
return "White Mage";
default:
echo("It's not any of the ones above, return the default:");
return "Trader";
}
}
switch$ functions in the same way, except it checks for strings:
function servercmdLoadType(%client,%filename)
{
if(!%client.isSuperAdmin){return;}
if(%filename $= ""){messageclient(%client,"","\c0ERROR: \c3No filename given.");return;}
messageclient(%client,"","\c5Loading bot type from file \c3Add-Ons/Client/" @ %filename @ ".bottype\c5...");
$BotSettings[%filename]=0;
%file=new fileObject();
%file.openForRead("Add-Ons/Client/" @ %filename @ ".bottype");
while(!%file.isEOF())
{
%line=%file.readLine();
switch$(firstWord(%line))
{
case "DECAL":
$BotDecal[%filename] = restWords(%line);
case "FACE":
$BotFace[%filename] = restWords(%line);
case "DATA":
$BotData[%filename] = restWords(%line);
case "NAME":
$BotName[%filename] = restWords(%line);
default: //Setting appearance
$BotAppear[%filename,$BotSettings[%filename]++] = firstWord(%line);
$BotColor[%filename,$BotSettings[%filename]] = restWords(%line);
}
}
%file.close();
%file.delete();
messageclient(%client,"","\c5Finished loading. Bot type added: \c3" @ %filename);
}