Author Topic: Script_CheckForAdmins  (Read 2524 times)

A simple server-sided script which tells your clients how many admins are online when they first join the server.  For those who are too lazy to hit F2.

Use /checkforadmins to check manually.

http://www.mediafire.com/download/ls7980aa3s89lsp/Script_CheckForAdmins.zip

If someone is too lazy to hit F2, why would they use a longer process to find out who is admin?

Make the command shorter.

Useful for those without a keybind and don't want to open escape menu while loading

Can you make it so it lists the admins' names when you first join as well?

If someone is too lazy to hit F2, why would they use a longer process to find out who is admin?

Can you make it so it lists the admins' names when you first join as well?

tells your clients how many admins are online when they first join the server.

Um?

Um?
1. This mod only shows the number of admins on a server, not the admin names
2.Yes it shows the admin count for those who are "too lazy" to press F2 when they connect, however after they connect it is much quicker to press F2 rather than type a command.
« Last Edit: April 20, 2014, 01:09:40 PM by Danny Boy »

I'm not a TorqueScript genius, but I do have some background in programming languages.
I believe I've found two problems with your script:

1. The variable which stores how many admins are on ('%admins') has not been set to reset at the start of your serverCmd function. As far as I know, I could rejoin a server with this script five times (or use the command) where one admin is present, and the script will notify the client that there are five admins on because the variable isn't being reset.

2.
Code: [Select]
if(%admins*1==0)Why do you need to multiply it by 1? I don't think it's necessarily a problem, but more of a "why?" or "lack of purpose" sort of thing.

If a more experienced coder can correct or confirm me on this, that'd be appreciated because I'm learning too.

I learned, thanks.
« Last Edit: April 20, 2014, 05:26:44 PM by Crazycom »

I'm not a TorqueScript genius, but I do have some background in programming languages.
I believe I've found two problems with your script:

1. The variable which stores how many admins are on ('%admins') has not been set to reset at the start of your serverCmd function. As far as I know, I could rejoin a server with this script five times (or use the command) where one admin is present, and the script will notify the client that there are five admins on because the variable isn't being reset.

2.
Code: [Select]
if(%admins*1==0)Why do you need to multiply it by 1? I don't see a purpose in this.

If a more experienced coder can correct or confirm me on this, that'd be appreciated because I'm learning too.
The first part is wrong. He is using a local variable(%) so the value is always blank at the start of the function. You would be right if he were using a global variable($).

The first part is wrong. He is using a local variable(%) so the value is always blank at the start of the function. You would be right if he were using a global variable($).

Oh, nevermind then.
Thanks for clarifying.

I'm not a TorqueScript genius, but I do have some background in programming languages.
I believe I've found two problems with your script:

1. The variable which stores how many admins are on ('%admins') has not been set to reset at the start of your serverCmd function. As far as I know, I could rejoin a server with this script five times (or use the command) where one admin is present, and the script will notify the client that there are five admins on because the variable isn't being reset.

2.
Code: [Select]
if(%admins*1==0)Why do you need to multiply it by 1? I don't think it's necessarily a problem, but more of a "why?" or "lack of purpose" sort of thing.

If a more experienced coder can correct or confirm me on this, that'd be appreciated because I'm learning too.
Torquescript is weird in how it doesn't have any data types. A blank variable starts as a null string (""). Multiplying the null string by 1 will cause torque to convert it to a number (strings always evaluate to 0), this ensures that his == 0 statement works correctly. Although, it does not actually matter much since comparing if the null string equals zero would still return true.

if ur really lazy to press a button, and you think pressing more buttons is easier, then ur just pathetic.

Torquescript is weird in how it doesn't have any data types. A blank variable starts as a null string (""). Multiplying the null string by 1 will cause torque to convert it to a number (strings always evaluate to 0), this ensures that his == 0 statement works correctly. Although, it does not actually matter much since comparing if the null string equals zero would still return true.
why not just
if(!%admins)

that would work for both 0 and a null string

why not just
if(!%admins)

that would work for both 0 and a null string
That's why I said it didn't really matter.