Blockland Forums > Modification Help

AFKbot issue

Pages: << < (2/3) > >>

adam savage:


--- Quote from: Ipquarx on March 08, 2012, 01:15:04 PM ---At first I couldn't figure out what was wrong, because I assumed your case's were correct.
My assumption was wrong.

I fixed the code, along with replacing the ^'s with actuall indentation.

--- Code: ---case "--AdamBot_Code5":
CommandToServer('messageSent', "Code 5 initiating...");
if($IAmAdmin)
{
schedule(1000,0,shutdown);
}

case "AFK":
if(!hasItemOnList(%name, $AFKBot::List))
{
commandToServer('messageSent', "AdamBot: " @ %name @ " is now AFK.");
$AFKBot::list = addItemToList($AFKbot::List, %name);
}
case "Back":
if(hasItemOnList(%name, $AFKBot::List))
{
$AFKBot::list = removeItemfromList($AFKbot::List, %name);
commandToServer('messageSent', "AdamBot: " @ %name @ " is back!");
}
case: "BRB": commandToServer('messageSent', "AdamBot: " @ %name @ " will Be Right Back.");
--- End code ---
Also, using $IAmAdmin is not a smart idea, as you can just change it anytime you want.
You should check through the player list and check if the player is admin like that.

--- End quote ---
Ok... I still need the error fix.

Brian Smithers:

you did
case: "back":
you should be doing
case "back":


Lugnut:

case "stringhere": is valid?
TIL!

Nexus:


--- Quote from: Lugnut1206 on March 08, 2012, 07:47:23 PM ---case "stringhere": is valid?
TIL!

--- End quote ---

That is proper switch syntax, yes

Destiny/Zack0Wack0:


--- Quote from: Lugnut1206 on March 08, 2012, 07:47:23 PM ---case "stringhere": is valid?
TIL!

--- End quote ---
switch$

Pages: << < (2/3) > >>

Go to full version