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

Player whitelist for joining the server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ddag1
Member
Join Date: Apr 2020
Old 09-16-2021 , 07:18   Player whitelist for joining the server
Reply With Quote #1

Hi there, I need a plugin that prevents players from connecting to the server except for those who are in a whitelist (a file where I'd put their Steam IDs). Can someone please make that one for me? I've been looking for that but can't find anything but "Player register" kind of plugins, which is not exactly what I need. Thank you so much in advance!
ddag1 is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 09-16-2021 , 08:23   Re: Player whitelist for joining the server
Reply With Quote #2

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "check whitelist"
#define VERSION "1.0"
#define AUTHOR "bugsy"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}


public 
client_authorized(id)
{
    if( !
IsWhiteListed(id) )
        
server_cmd("kick #%d ^"%s^""get_user_userid(id), "Not registered. Register at XXXX")
}
        
public 
IsWhiteListed(id)
{
    new 
szAdminFile[64]
    new 
szItem[35]
    new 
szAuthID[35]
    new 
iItems
    
new iLen
    
    get_user_authid
id szAuthID 34)
    
    
get_configsdir(szAdminFile63)
    
formatszAdminFile 63 "%s/admins.txt" szAdminFile )
    
    
iItems file_sizeszAdminFile )
    
    if( 
iItems == -)
    {
        return 
0
    
}
    else
    {    
        if( 
file_sizeszAdminFile ) == 1)
            
iItems--
            
        for( new 
0iItems i++)
        {
            
read_fileszAdminFile szItem 34 iLen );
            
            if ( 
equalszAuthIDszItem strlen(szAuthID) ) )
                return 
1
        
}    
    }
    
    return 
0

create a file named admins.txt and add steamIDs
__________________

Last edited by DruGzOG; 09-16-2021 at 08:25.
DruGzOG is offline
Send a message via AIM to DruGzOG
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-16-2021 , 22:35   Re: Player whitelist for joining the server
Reply With Quote #3

You should be able to do this without any special plugins. Simply set amx_mode to 2 in amxx.cfg and then add users to users.ini with only the "z" flag:

Code:
"STEAM_0:0:1234" "" "z" "ce"
As a reminder, for admins, make sure that they don't have the "z" flag.
__________________

Last edited by fysiks; 09-16-2021 at 22:43.
fysiks is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-19-2022 , 21:40   Re: Player whitelist for joining the server
Reply With Quote #4

Is it possible to make this NOT block bots in Condition Zero? amx_mode 2 does the same thing
Ark_Procession is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-19-2022 , 23:24   Re: Player whitelist for joining the server
Reply With Quote #5

Add

Code:
&& !is_user_bot(id)
after
Code:
!IsWhiteListed(id)
in the above plugin or after
Code:
result & 2
in admin.sma here.
__________________

Last edited by fysiks; 01-19-2022 at 23:34.
fysiks is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 01-20-2022 , 09:09   Re: Player whitelist for joining the server
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Add

Code:
&& !is_user_bot(id)
after
Code:
!IsWhiteListed(id)
in the above plugin or after
Code:
result & 2
in admin.sma here.
Thank you
Ark_Procession is offline
Reply


Thread Tools
Display Modes

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 05:16.


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