Jump to content
Sign in to follow this  
Desrat

Run script only if admin error.

Recommended Posts

Trying to add a radio trigger that can only be used by a logged in admin. I've tried the code below and get a missing ; message on line 2 (the beginning of the if statmentI don't see any broken syntax), anyone shed any light on it?

_isAdmin = serverCommandAvailable "#lock";
if (_isAdmin) {
  // run command
} else {
  // dont run command
};

Share this post


Link to post
Share on other sites

sorry no, radio trigger runs this in a script file.

Share this post


Link to post
Share on other sites

that might be the problem, check it on a dedicated server ^^

Share this post


Link to post
Share on other sites

nope helps if you actually use SQF for your if's correctly instead of PHP :), thats the day job biting me in the ass.

[color=#3E3E3E]_isAdmin = serverCommandAvailable "#lock";[/color]
if (_isAdmin) [font=arial black][u][color=#ff0000][b]then[/b][/color][/u][/font] {
  // run command
} else {
  // dont run command 
[color=#3E3E3E]};[/color]

Share this post


Link to post
Share on other sites

Yes. "Missing ;" is usually some sort of syntax error or a typo in one of your commands/variables that makes the engine not understand what you want and thus expect the command to end with a ;. In this case you are indeed missing the all annoying then. Sometimes, "missing ;" actually means you are missing a ;. :)

Share this post


Link to post
Share on other sites
nope helps if you actually use SQF for your if's correctly instead of PHP :), thats the day job biting me in the ass.

[color=#3E3E3E]_isAdmin = serverCommandAvailable "#lock";[/color]
if (_isAdmin) [font=arial black][u][color=#ff0000][b]then[/b][/color][/u][/font] {
  // run command
} else {
  // dont run command 
[color=#3E3E3E]};[/color]

omg, lol. Dunno, how i couldn't see that! The most obvious things... :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×