Raised This Month: $ Target: $400
 0% 

Give temporary admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-23-2015 , 00:27   Give temporary admin
Reply With Quote #1

Is there a way to give a client a temporary admin flag, and then later remove it if needed?

Don't ask why I want this (no it's not an XY-problem). Just say if it's possible or not, and if so, how I can do it.

I am looking at these functions:

https://sm.alliedmods.net/new-api/admin/CreateAdmin
https://sm.alliedmods.net/new-api/admin/SetAdminFlag
https://sm.alliedmods.net/new-api/admin/RemoveAdmin
https://sm.alliedmods.net/new-api/ad...nImmunityLevel

Examples would be useful. Thanks!

EDIT: I want to note that the given information is a steam ID, not a client index or client name. So basically, what do I write in the function below?

PHP Code:
public void GrantTempAdmin(const char[] SteamID)
{
    
// what goes in here?


Last edited by Potato Uno; 11-23-2015 at 00:39. Reason: Added more info
Potato Uno is offline
Chokitu
Senior Member
Join Date: Oct 2013
Old 11-23-2015 , 05:00   Re: Give temporary admin
Reply With Quote #2

Depends, how much time are u looking to?
Chokitu is offline
Send a message via Skype™ to Chokitu
Nanochip
Senior Member
Join Date: Jan 2014
Old 11-23-2015 , 06:08   Re: Give temporary admin
Reply With Quote #3

Yep, definitely possible. Take a look at this plugin and its "trial" admin stuff.
__________________
Nanochip is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-23-2015 , 09:39   Re: Give temporary admin
Reply With Quote #4

So it's something like:

PHP Code:
public void SetTempAdmin(int iClient)
{
    
AdminId admin CreateAdmin();
    
SetAdminFlag(adminADMFLAG_GENERICtrue);
        
SetUserAdmin(iClientadmintrue);

And maybe I should put that under OnClientAuthorized so I can do the steam2 ID comparison?
Potato Uno is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-23-2015 , 09:53   Re: Give temporary admin
Reply With Quote #5

You're missing BindAdminIdentity from your list.

The auth type for Steam IDs is just "steam" (as seen in admins.cfg)
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Nanochip
Senior Member
Join Date: Jan 2014
Old 11-23-2015 , 10:02   Re: Give temporary admin
Reply With Quote #6

Keep in mind, that only adds them to the admin cache, and the cache gets refreshed for that player when they reconnect, or map changes.
__________________
Nanochip is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-24-2015 , 23:17   Re: Give temporary admin
Reply With Quote #7

I'll give it a try and post back when I got something. Thanks for all the advice!
Potato Uno is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 11-24-2015 , 23:19   Re: Give temporary admin
Reply With Quote #8

You could do something like this
PHP Code:
        bool bHasRootFlag GetAdminFlag(admClientAdmin_Root);
        
SetAdminFlag(admClientAdmin_Roottrue); // Give them root flag
        
FakeClientCommand(client"sm_addban %d \"%s\" \"%s\""minutessteamidreason); // Add ban
        
SetAdminFlag(admClientAdmin_RootbHasRootFlag); // Remove root flag 
From https://forums.alliedmods.net/showthread.php?p=2356071

But, this is a very quick way of doing it and for one flag. I'm not sure if this'll help you at all, but if it does then you are welcome lol

Last edited by headline; 11-24-2015 at 23:20.
headline is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode