Author Topic: The if statment?  (Read 4095 times)

How can I make commands do something for super admins but not anybody else?

Also, how can I make a script do something if the thing entered say, %dudename contains a word?

Code: [Select]
if(%client.issuperadmin == 1)
{
Blablabla
}

Do I get a cookie? :D

Actually, the ' == 1' part is not required for a binary answer.  A client either is or isn't a Super Admin, making the answer either 1 or 0.  So you can really just use the code:

if(%client.isSuperAdmin)
{
     <insert code here>
}

As for your second question, you'd have to know what you wanted the string to be.  You can't just say if(%dudename.isWord), lol.


example? I'm making my own chat,

Why do you want to do that?

Actually, the ' == 1' part is not required for a binary answer.  A client either is or isn't a Super Admin, making the answer either 1 or 0.  So you can really just use the code:

if(%client.isSuperAdmin)
{
     <insert code here>
}

As for your second question, you'd have to know what you wanted the string to be.  You can't just say if(%dudename.isWord), lol.
Still to complicated, you can optimize it even more:
Code: [Select]
if(%client.isSuperAdmin)
  code
Ofcourse, this is only if there is 1 line of code for the if....but it's still optimization. Just remember you need 2 spaces before the code so it applies to the if :D
« Last Edit: March 07, 2007, 11:25:57 PM by -=>RR<=-MasterCE »

example? I'm making my own chat,
If you're having trouble with IF statments, I can already see how far you will get in making your own chat...

Just remember you need 2 spaces before the code so it applies to the if :D
Ummm... no you don't

Well the 2 spaces helps the eye follow the code so you don't get confused....

ok, but it's not necessary, the code can even be on the same line as the IF statment, or 5 lines below it, the code is executed all the way to the semi-colon.

I know you can put a whole script fild on 1 line....but then it's even harder to read....I find putting it on another line better :o

ok but it's not necessary, like you implied.

There, ok? Didn't you hate BL and left it?


You may call it optimization, but I say   F U C K   code without brackets.