Raised This Month: $32 Target: $400
 8% 

[HELP] Save SteamID Accounts


Post New Thread Reply   
 
Thread Tools Display Modes
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-02-2020 , 13:08   Re: [HELP] Save SteamID Accounts
Reply With Quote #11

write_file(path, arg) will save the steamid to file
__________________
Relaxing is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-02-2020 , 13:35   Re: [HELP] Save SteamID Accounts
Reply With Quote #12

Quote:
Originally Posted by Relaxing View Post
write_file(path, arg) will save the steamid to file
Very Thanks ;)
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-03-2020 , 08:31   Re: [HELP] Save SteamID Accounts
Reply With Quote #13

When I add the steam ID of the person I add with the command "amx_addsteam", I must restart the server to load that steam ID.

sn't there a way to load her steam ID when a player enters the server?
alferd is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-03-2020 , 18:49   Re: [HELP] Save SteamID Accounts
Reply With Quote #14

This

Code:
TrieDestroy(special_player); ReadData(); new players[MAX_PLAYERS], num, id; new steamid[32]; get_players(players, num, "ch"); for (new i = 0; i < num; i++){     id = players[i];     get_user_authid(id, steamid, charsmax(steamid));     has_access[id] = bool: (TrieKeyExists(special_player, steamid)); }
__________________

Last edited by Relaxing; 06-03-2020 at 21:10.
Relaxing is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-04-2020 , 07:08   Re: [HELP] Save SteamID Accounts
Reply With Quote #15

Quote:
Originally Posted by Relaxing View Post
This

Code:
TrieDestroy(special_player); ReadData(); new players[MAX_PLAYERS], num, id; new steamid[32]; get_players(players, num, "ch"); for (new i = 0; i < num; i++){     id = players[i];     get_user_authid(id, steamid, charsmax(steamid));     has_access[id] = bool: (TrieKeyExists(special_player, steamid)); }
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "SA" #define VERSION "1.0" #define AUTHOR "Relaxing" #define MAX_PLAYERS 32 new path[128]; new Trie:special_player; new bool: has_access[33]; new f, j; public plugin_init(){         register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("amx_addsteam", "clcmd_addsteam")         get_configsdir(path, charsmax(path));     add(path, charsmax(path), "/users-steams.ini");         special_player = TrieCreate();         TrieDestroy(special_player);         ReadData();         new players[MAX_PLAYERS], num, id;     new steamid[32];     get_players(players, num, "ch");         for (new i = 0; i < num; i++){     id = players[i];     get_user_authid(id, steamid, charsmax(steamid));     has_access[id] = bool: (TrieKeyExists(special_player, steamid));     } } public plugin_natives() {     register_native("steam_users", "_has_user_access", 1); } public clcmd_addsteam(){     new arg[1010];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         write_file(path, arg)         TrieSetCell(special_player, arg, 1);         return PLUGIN_HANDLED; } ReadData(){     new Line[32];     f = fopen(path, "rt");     if (!f){         log_amx("Error opening %s file", path);     }     while (!feof(f)){         fgets(f, Line, charsmax(Line));         trim(Line);         remove_quotes(Line);                 if (Line[0] == ';' || !Line[0] || Line[0] == '^n'){             continue;         }                 TrieSetCell(special_player, Line, 1);         j++;     }     fclose(f);         if (!j){         log_amx("No users found on %s file", path);         TrieDestroy(special_player);     } } public plugin_end(){     if (j) TrieDestroy(special_player); } public client_authorized(id){     ReadData();     if (j){         new steamid[32];         get_user_authid(id, steamid, charsmax(steamid));         has_access[id] = bool: (TrieKeyExists(special_player, steamid));     } else has_access[id] = false; } public _has_user_access(id){     new bool: _return = bool: (is_user_connected(id) ? has_access[id] : false);     return j ? _return : false; }

Did I do it right?
Should this plugin work now?
alferd 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 07:47.


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