Author Topic: Making script admin-only?  (Read 9989 times)

I did search,no clear results.But anyway,how scripts can be made so that only admins and super-admins can use it?I`d like to get a piece of code what does it.Also,please tell if theres matter in what part of script it is.I will give credit,if I release it.

If you mean weapons, you're blind.

http://www.blockland.us/smf/index.php?topic=32546.0

If you mean admin only /commands, I hope you can do a little bit of scripting.

Code: [Select]
function serverCmdWhatever(%client){
 if (%client.isAdmin||%client.isSuperAdmin){
  //whatever it does
 }
}

Brackets shouldn't be on the same line as anything else generally, and you should really indent.
You should get into the habit of doing these things, for readability's sake:

function serverCmdWhatever(%client)
{
     if(%client.isAdmin || %client.isSuperAdmin)
     {
          //whatever it does
     }
}

Have you seen Aloshi's RPG? The lines are soooooooooo long, and there are brackets in between everywhere :o

So hard to read.

Yeah, lots of idiots people think that making their script take up as few lines as possible will noticeably reduce the execution time of it.

I did... apparently single spaces don't show up at the beginning of lines in the tags or something.

Code: [Select]
function serverCmdWhatever(%client){
  if (%client.isAdmin||%client.isSuperAdmin){
    //whatever it does
  }
}

Brackets shouldn't be on the same line as anything else generally


Brackets shouldn't be on the same line as anything else generally

Yes sir, whatever you say sir! *kiss ass*

Actually, it helps allot to have brackets on their own line, I was having problems with a script yesterday because I was basing it off another that wasn't indented right, and it caused me trouble.

Why is it that every bad scripting habit Ephi lists off applies to me?

Brackets shouldn't be on the same line as anything else generally

Yes sir, whatever you say sir! *kiss ass*

Its common sense, having well indented code and braces on individual lines allows you to see where a certain chunk starts and ends. But you can go right ahead and be an ignorant fool.

Brackets shouldn't be on the same line as anything else generally

Yes sir, whatever you say sir! *kiss ass*

Its common sense, having well indented code and braces on individual lines allows you to see where a certain chunk starts and ends. But you can go right ahead and be an ignorant fool.

you save space by removing extra space

Brackets shouldn't be on the same line as anything else generally

Who are you to tell us what we can and can't code like???  :nes:

Someone who earns money through knowing how to program well. Who are you?