Raised This Month: $ Target: $400
 0% 

Easiest way..?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Feren6
Junior Member
Join Date: May 2006
Old 05-20-2006 , 09:01   Easiest way..?
Reply With Quote #1

What is the easiest way to search a file for steamID on connect and kick them if they arent on the list?
Feren6 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-20-2006 , 09:37  
Reply With Quote #2

Untested, and I've never used the new file natives before.

Code:
#include <amxmodx> #include <amxmisc> #define MAX_USERS 50 new g_szFileLocation[128] new g_szFileName[] = "allowed_users.ini" new g_szUsers[MAX_USERS][36] public plugin_init() {     register_plugin("File Search","1.0","Hawk552")         fnLoadFile     fnLoadUsers } public client_authorized(id) {     new szAuthid[36]     get_user_authid(id,szAuthid,35)         for(new iCount = 0;iCount < MAX_USERS;iCount++)         if(equali(szAuthid,g_szUsers[iCount]))             return PLUGIN_CONTINUE         server_cmd("kick #%d",get_user_userid(id))         return PLUGIN_CONTINUE } fnLoadFile() {     new szConfigsdir[64]     get_configsdir(szConfigsdir,63)         format(g_szFileLocation,127,"%s/%s",szConfigsdir,g_szFileName) } fnLoadUsers() {     new iFile = fopen(g_szFileLocation,"rt"), iNum     while(!feof(iFile))     {         if(iNum > MAX_USERS - 1)             break                     fgets(iFile,g_szUsers[iNum],35)         replace(g_szUsers[iNum++],35,"^n","")     } }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Feren6
Junior Member
Join Date: May 2006
Old 05-20-2006 , 10:53  
Reply With Quote #3

TY, but where does it call client_authorized? How does it know to execute it? (i'm new to this)
Feren6 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 16:21.


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