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

Not Recognising Admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jackpf
Senior Member
Join Date: Dec 2009
Location: Uhm...
Old 12-17-2009 , 11:21   Not Recognising Admin
Reply With Quote #1

Hi all,

Basically, I'm trying to prefix admin's names with "[Admin]".

I though
Code:
if(GetUserAdmin(client) != INVALID_ADMIN_ID)
would check if a user is an admin, but it doesn't.

Obviously I'm an admin on my own server, but it doesn't recognise me as one from my plugin.

Basically, my code is something like this:
Code:
public OnClientPutInServer(client)
{
       decl String:name[65];

        if(GetUserAdmin(client) != INVALID_ADMIN_ID)
            Format(name, sizeof(name), "[Admin]%s", client);

       SetClientInfo(client, "name", name);
}
which doesn't seem to change anyone's name, admin or not.

Any help would be great.

Thanks,
Jack.

Last edited by jackpf; 12-17-2009 at 11:31.
jackpf is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-17-2009 , 11:35   Re: Not Recognising Admin
Reply With Quote #2

Try OnClientPostAdminCheck ?

And you're doing the name bit wrong, use something like this:

PHP Code:
public OnClientPutInServer(client)
{
    
decl String:name[MAX_NAME_LENGTH];
    
    if(
IsClientInGame(client) && GetUserAdmin(client) != INVALID_ADMIN_ID)
    {
        
Format(namesizeof(name), "[Admin]%N"client);
    }
    
SetClientInfo(client"name"name);


Last edited by Dragonshadow; 12-17-2009 at 11:50.
Dragonshadow is offline
Peoples Army
SourceMod Donor
Join Date: Mar 2007
Old 12-17-2009 , 11:41   Re: Not Recognising Admin
Reply With Quote #3

Yea a client isn't checked for admin when he enters the servers , catch the post check .
__________________
Peoples Army is offline
jackpf
Senior Member
Join Date: Dec 2009
Location: Uhm...
Old 12-21-2009 , 05:30   Re: Not Recognising Admin
Reply With Quote #4

Hmm, I had a go, but I can't get it to work.

The thing is, I'm also trying to use geoip to set their country flag as well. So, it's a bit more complicated.

Currently, the country flag part works, but I cannot get it to display an [Admin] tag for admins for the life of me.

Here's my current code.
PHP Code:
new string:name[MAX_NAME_LENGTH];
public 
OnClientPutInServer(client)
{
    if(
GetConVarInt(Nick_Updater) == 1)
    {
        if(!
IsFakeClient(client) && client != 0)
        {
            
decl String:ip[16];
            
decl String:flag[5];
            
decl String:GeoIP[3];
            
            
GetClientIP(clientip16);
            
            if(
GeoipCode2(ipGeoIP))
                
Format(flagsizeof(flag), "[%2s]"GeoIP);
            else
                
Format(flagsizeof(flag), "[--]");
            
            
Format(namesizeof(name), "%s%N"flagclient);
            
            
SetClientInfo(client"name"name);
        }
    }
}
public 
OnClientPostAdminCheck(client)
{
    if(
GetConVarInt(Nick_Updater) == 1)
    {
        if(
IsClientInGame(client) && GetUserAdmin(client) != INVALID_ADMIN_ID)
            
Format(namesizeof(name), "[Admin]%N"name);
        
        
SetClientInfo(client"name"name);
    }

I'll understand if you can't be bothered...I've kind of given up hope on this :p

Thanks anyway,
Jack.
jackpf 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 15:39.


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