Raised This Month: $12 Target: $400
 3% 

Creating admins on the fly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FrostbyteX
Senior Member
Join Date: Dec 2007
Old 11-15-2009 , 18:29   Creating admins on the fly
Reply With Quote #1

I can't figure out how to dynamically create an admin. Here's what I have based on the given admin-users.sp plugin. What am I doing wrong?

PHP Code:
public GrantAdmin(userid)
{
    
decl GroupId:gidAdminId:id;

    if((
gid FindAdmGroup("TempAdmin")) == INVALID_GROUP_ID)
    {
        return 
false;
    }

    
decl String:steamid[MAX_STEAMID_LENGTH];
    
GetClientAuthString(useridsteamidMAX_STEAMID_LENGTH);

    if ((
id FindAdminByIdentity(AUTHMETHOD_STEAMsteamid)) == INVALID_ADMIN_ID)
    {
        
id CreateAdmin();
        if (!
BindAdminIdentity(idAUTHMETHOD_STEAMsteamid))
        {
            
RemoveAdmin(id);
            return 
false;
        }
        
PrintToChatAll("Bound STEAMID: %s"steamid);
    }

    
AdminInheritGroup(idgid);

    
SetAdminPassword(id"");

    
PrintToChat(userid"[SM] You've been granted temporary administrator privileges (STEAMID: %s/%i)",steamidid);

    
g_is_admin[userid] = true;

    return 
true;

Thanks,
-Steve

Last edited by FrostbyteX; 11-15-2009 at 18:31. Reason: forgot to thank anyone who helps !
FrostbyteX is offline
FrostbyteX
Senior Member
Join Date: Dec 2007
Old 11-15-2009 , 18:56   Re: Creating admins on the fly
Reply With Quote #2

Found the answer:

PHP Code:
SetUserAdmin(userididtrue); 
- Steve
FrostbyteX 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 21:07.


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