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

[HELP] Admin Flags / Access


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 11-13-2016 , 01:27   [HELP] Admin Flags / Access
Reply With Quote #1

I have situation, when player admin connects to server then I want to check for his flags and then save it temporarily and remove those flags from admin and do some calculations and give those same flags that he had before !

How this can be achieved ?.

Sorry if I've posted this in wrong section.
__________________
All my work is here
xxxperts is offline
Infest
Member
Join Date: Mar 2005
Old 11-13-2016 , 02:08   Re: [HELP] Admin Flags / Access
Reply With Quote #2

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("Temp Remove Flags""1.0""meow")
}

// client_putinserver over client_connect because admin prefs are loaded after client_connect
public client_putinserver(id)
{    
    if(
is_user_admin(id))    // User is admin
    
{
        new 
iFlags get_user_flags(id// Store user flags
        
        
remove_user_flags(id// Remove user flags
        
handleUser(id// Function to execute while user has no admin flags
        
set_user_flags(idiFlags// Reassign user flags
    
}
}

public 
handleUser(id)
{
    
// Modify user while they have no admin flags


Last edited by Infest; 11-13-2016 at 02:23.
Infest is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-13-2016 , 02:15   Re: [HELP] Admin Flags / Access
Reply With Quote #3

ADMIN_USER does not mean that the user is an admin. To check if a player is an admin, you should use is_user_admin(id).

@xxxperts, your request doesn't make much sense. Please give more details about what you are actually trying to achieve so that you can get the answer that you actually need.
__________________
fysiks is offline
Infest
Member
Join Date: Mar 2005
Old 11-13-2016 , 02:23   Re: [HELP] Admin Flags / Access
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
ADMIN_USER does not mean that the user is an admin. To check if a player is an admin, you should use is_user_admin(id).

@xxxperts, your request doesn't make much sense. Please give more details about what you are actually trying to achieve so that you can get the answer that you actually need.
Good point, edited
Infest is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 11-13-2016 , 06:18   Re: [HELP] Admin Flags / Access
Reply With Quote #5

Suppose i have ( "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce" ) this in my users.ini, only one entry.

When this player connects to server, I want to remove his admin access completely and then do some calculations and give those exact flags he had before ( as per flags mentioned in users.ini ).

One more question at what moment admin preferences are loaded ? client_connect or client_putinserver ?
__________________
All my work is here

Last edited by xxxperts; 11-13-2016 at 06:19. Reason: Update.
xxxperts is offline
Infest
Member
Join Date: Mar 2005
Old 11-13-2016 , 06:25   Re: [HELP] Admin Flags / Access
Reply With Quote #6

Quote:
Originally Posted by xxxperts View Post
Suppose i have ( "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce" ) this in my users.ini, only one entry.

When this player connects to server, I want to remove his admin access completely and then do some calculations and give those exact flags he had before ( as per flags mentioned in users.ini ).
That is exactly what my code snippet does.

Quote:
Originally Posted by xxxperts View Post
One more question at what moment admin preferences are loaded ? client_connect or client_putinserver ?
For reals? Read my comments in the code
Infest is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 11-13-2016 , 06:51   Re: [HELP] Admin Flags / Access
Reply With Quote #7

So remove_user_flags will remove every flags that player has so after that does he will be having "z" flag (normal user).
__________________
All my work is here
xxxperts is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-13-2016 , 15:26   Re: [HELP] Admin Flags / Access
Reply With Quote #8

Quote:
Originally Posted by xxxperts View Post
When this player connects to server, I want to remove his admin access completely and then do some calculations and give those exact flags he had before ( as per flags mentioned in users.ini ).
That's exactly what you said the first time and it still makes no sense, especially since AMX Mod X sets flags in several different occasions. So, removing their access might not actually remove their access.

Explain what you are actually trying to do if you want a good answer.


Quote:
Originally Posted by xxxperts View Post
One more question at what moment admin preferences are loaded ? client_connect or client_putinserver ?
Admin access is checked on several different occasions including client_authorized(). Look at admin.sma to see where accessUser() is used.
__________________
fysiks 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 03:15.


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