Raised This Month: $ Target: $400
 0% 

Authid.ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 11-07-2005 , 14:04   Authid.ini
Reply With Quote #1

I need to know how to retrieve a users authid, and write it to the specified .ini file.

Then I need to know how to open the file and check to see if a player's ID has a match, then go to a function.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-07-2005 , 14:43  
Reply With Quote #2

Try this:
Code:
#include <amxmodx> #include <amxmisc> new g_szCfgsDir[64]; new g_szFile[] = "authid.ini"; public plugin_init() {   // ...   get_configsdir(g_szCfgsDir, 63); } public WriteIt( id ) {   new szAuthID[33];   get_user_authid(id, szAuthID, 32);   new szFileStr[64];   format(szFileStr, 63, "%s/%s", g_szCfgsDir, g_szFile);   new szText[64]   format(szText, 63, "^n^"%s^"", szAuthID);   if(file_exists(szFileStr))   {     write_file(szFileStr, szText, -1);     console_print(id, "Added %s", szAuthID);   }   else   {     log_amx("File not found: %s", szFileStr);   }   return PLUGIN_HANDLED; } public client_putinserver( id ) {   get_configsdir(g_szCfgsDir, 63);       new szFileStr[64];   format(szFileStr, 63, "%s/%s", g_szCfgsDir, g_szFile);   if(file_exists(szFileStr))   {     new szAuthID[64];     get_user_authid(id, szAuthID, 63);         new szText[164];     new nLen=0, nLine=0;     while(read_file(szFileStr, nLine++, szText, 163, nLen))     {       if(szText[0] == ';') continue;               remove_quotes(szText);       new szUserName[33];       get_user_name(id, szUserName, 32);       if(equali(szAuthID,szText))       {         FoundID(id);         server_print("Found positive match for %s", szAuthID);       }       else       {         server_print("No match for %s", szAuthID);       }     }   }   else   {     log_amx("File not found: %s", szFileStr);   } } public FoundID( id ) {   // Hooray! We found it! }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 11-07-2005 , 18:38  
Reply With Quote #3

Sweet, thanks.

Now if I wanted to make a HUD message for a player. How can I check to see if their Steam ID is in the .ini

And I don't want it to, like log steam ids.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-07-2005 , 20:19  
Reply With Quote #4

A pre-defined HUD message in the file?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 11-07-2005 , 20:50  
Reply With Quote #5

This is what I have, without your code.

I would like it to do this.

I'll make a command, or you could, and it let's admins add steam ids to the .ini And another cvar will control whether the hud displays for EVERYONE or just the people on the "list"

But I don't know how to write a steam id to the file with a command, and show the HUD to only those people.


Code:
#include <amxmodx> #include <amxmisc> #include <csstats> #define HUD_INTERVAL 1.0 new msgtext public plugin_init() {     register_plugin("Stats Display","1.0","Kensai")     msgtext = get_user_msgid("StatusText") } public client_putinserver(id) {       set_task(HUD_INTERVAL,"ShowHUD",id); }   public ShowHUD(id)     {       if(!is_user_connected(id))         return 0;     new stats[8]     new hits[8]     get_user_stats(id,stats,hits)     new name[33]     get_user_name(id,name,32)     new HUD[51]     format(HUD, 50, "%s [Kills: %i] [Deaths: %i] [Headshots: %i]",name,stats[0],stats[1],stats[2])     message_begin(MSG_ONE, msgtext, {0,0,0}, id)       write_byte(0)       write_string(HUD)       message_end()       set_task(HUD_INTERVAL,"ShowHUD",id);     return PLUGIN_CONTINUE }
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
[C]oN -X-
Member
Join Date: Nov 2005
Old 11-07-2005 , 21:15   bah
Reply With Quote #6

bah CS hack coding is so much easier...

there its just tmp say "blah blah blah %d"

and so on.. coded hacks half my cs palying.. now i stopped cuz hacking got gay :-]
[C]oN -X- is offline
Striker
Senior Member
Join Date: Mar 2004
Location: Germany
Old 11-13-2005 , 07:18  
Reply With Quote #7

hello,

I edited the plugin like this:

Code:
#include <amxmodx> #include <amxmisc> new g_szCfgsDir[64]; new g_szFile[] = "authid.ini"; public plugin_init(){     register_plugin("Plugin Name","0.1","Author")     get_configsdir(g_szCfgsDir, 63); } public WriteIt( id ){     new szAuthID[33];     get_user_authid(id, szAuthID, 32);     new szFileStr[64];     format(szFileStr, 63, "%s/%s", g_szCfgsDir, g_szFile);     new szText[64]     format(szText, 63, "^n^"%s^"", szAuthID);     if(file_exists(szFileStr)){         write_file(szFileStr, szText, -1);         console_print(id, "Added %s", szAuthID);     }else{         log_amx("File not found: %s", szFileStr);     }     return PLUGIN_HANDLED; } public client_putinserver( id ){     get_configsdir(g_szCfgsDir, 63);           new szFileStr[64];     format(szFileStr, 63, "%s/%s", g_szCfgsDir, g_szFile);     if(file_exists(szFileStr)){         new szAuthID[64];         get_user_authid(id, szAuthID, 63);               new szText[164];         new nLen=0, nLine=0;         while(read_file(szFileStr, nLine++, szText, 163, nLen)) {             if(szText[0] == ';') continue;                       remove_quotes(szText);             new szUserName[33];             get_user_name(id, szUserName, 32);             if(equali(szAuthID,szText)){                 server_print("Found positive match for %s", szAuthID);             }else{                 server_print("No match for %s, creating one", szAuthID);                 client_cmd(id, "resetattribs")                 client_cmd(id, "resetresists")                 set_task(5.0, "WriteIt", id)             }         }     }else{         log_amx("File not found: %s", szFileStr);     } }

But it doesn't work.

Can someone help me please ?
__________________
Striker is offline
Send a message via ICQ to Striker Send a message via MSN to Striker
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 11-13-2005 , 09:36  
Reply With Quote #8

I gave up using the .ini file for this. Too many issues, and wasn't working at all. Might wanna try having something other then writing steam ids in that.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-13-2005 , 13:01  
Reply With Quote #9

What's wrong with using a .ini file?

Code:
#define FILENAME "addons/amxmodx/data/authids.ini"  public write_authid(id) {     if(check_authid(id)) return 0;     new authid[32];     get_user_authid(id,authid,31);     return write_file(FILENAME,authid);  }  public check_authid(id) {     new authid[32];     get_user_authid(id,authid,31);     new line, text[32], txtLen;     while((line = read_file(FILENAME,line,text,31,txtLen)) != 0) {         if(equali(authid,text)) return 1;     }     return 0;  }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 11-13-2005 , 13:36  
Reply With Quote #10

There's nothing really wrong with using a .ini Just doesn't really work for what I was trying to do.

Someone wanted my Stats Display plugin to have a .ini So only people with their Stema ID's in the file could have the HUD Display. I thought that kind of defeated the purpose.

Thanks for the help anyways.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
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 23:44.


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