Author Topic: Function for when someone is admin'd  (Read 1919 times)

What is the function that is called when someone gets admin'd and what are the parameters?

What do you mean, when someone is "admin'd"? Do you mean with RTB? Or do you mean by password?

I haven't got half a clue what RTB function is used to admin someone, it's probably some convoluted function meant to be interfaced via GUI rather than used directly by humans.

For becoming admin with a password, it's serverCmdSAD(%client, %password). %password can be either $pref::server::superAdminPassword or $pref::server::adminPassword. It should be obvious when to use either.

For auto admin, it's GameConnection::autoAdminCheck(%client). You can package it then reference the variables %client.isAdmin and %client.isSuperAdmin to figure out what kind of admin (if any) has been bestowed upon them.

Well, what I'm trying to do is cancel a schedule if someone receives admin.

In the function the schedule calls (if it calls a default function, package it. If it can't be packaged [torque function], use a shell function that just calls that function) check to see if(%client.isAdmin == true).

If you're detecting a change in adminship, you can set the variable %client.adminLevel = %client.isAdmin + %client.isSuperAdmin;. Then you can check if(%client.adminLevel != %client.isAdmin + %client.isSuperAdmin) and return; if that's true.

Yes, I would do that but basically it's setting someone admin for a temporary time and there is a schedule that de-admins them after a certain amount of time. But the goal is to have it if they get admin it will cancel the schedule so they don't lose their admin.

Well, the issue is that there's no generic function for someone getting admined. There's many different functions, and they all do pretty much the same thing, assign the is(super)admin variable on the client to true and update the player list. I think the primary issue with what you're doing is that if isAdmin is already set on the client, they will not be able to obtain admin again. Using the password will cause the function to prematurely return because they're already admin in the game's eyes, and using RTB won't work either because it also checks to make sure you can't set someone who's already admin to admin.

Also, I'm sure you've made due consideration, but setting someone to Admin, no matter how short the time, can be a very dangerous thing. You may want to switch to a custom variable and simply pick the functions you want them to be able to use, package them, and set admin to true right before and after you call the functions parent, that way there will be no misuses of trust.
« Last Edit: July 15, 2014, 01:53:59 AM by $trinick »

Alright. Thanks for the help. It was just a little bug that could be ran into. Not to big of a deal though.

Just use the function that's called at the end of the schedule and use a return if they're a in the auto admin or super admin list.

Just use the function that's called at the end of the schedule and use a return if they're a in the auto admin or super admin list.

Not all cases of people getting admined include them being added to the auto admin/super admin list.