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

[HELP] Save SteamID Accounts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-01-2020 , 03:22   [HELP] Save SteamID Accounts
Reply With Quote #1

I want the steam ID to be saved in the file and path below
Code:
configs/user-steams.ini
PHP Code:
#include <amxmodx>
#include <nvault>

#define MAX_PLAYERS 32

new const SteamIDList[][] =
{
    
"STEAM_6:0:40857791",
    
"STEAM_6:0:1543600141",
    
"STEAM_6:0:765433307"
};

new 
g_Vault g_szAuthIDMAX_PLAYERS ][ 34 ];

public 
plugin_init() 
{
    
g_Vault nvault_open"SteamIDMenu" );
    
    
LoadVault();
    
    
register_clcmd"say /menu" "ShowMenu" );
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) );    
}

public 
ShowMenuid )
{
    if ( 
nvault_getg_Vault g_szAuthIDid ] ) )
    {
        
//Player in vault
    
}


LoadVault()
{
    
nvault_pruneg_Vault get_systime() );
    for ( new 
sizeofSteamIDList ) ; i++ )
    {
        
nvault_setg_Vault SteamIDList] , "1" );
    }

user-steams.ini:
Code:
"STEAM_6:0:40857791"
"STEAM_6:0:1543600141"
"STEAM_6:0:765433307"
{
I think this code is for loading accounts

PHP Code:
format(configsDir63"%s/user-steams.ini"configsDir)
    
LoadVault(configsDir

Last edited by alferd; 06-03-2020 at 08:00.
alferd is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-01-2020 , 22:16   Re: [HELP] Save SteamID Accounts
Reply With Quote #2

The plugin doesn't do anything so there is nothing to do as it stands. In fact, it does something that it nonsensical. So, what exactly do you expect someone to do?
__________________
fysiks is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-01-2020 , 22:53   Re: [HELP] Save SteamID Accounts
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
The plugin doesn't do anything so there is nothing to do as it stands. In fact, it does something that it nonsensical. So, what exactly do you expect someone to do?
By the code, I believe he wants to enable a menu only for the Steamids in the file ... there are much better ways to do this but anyway ...
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-01-2020 , 23:06   Re: [HELP] Save SteamID Accounts
Reply With Quote #4

Quote:
Originally Posted by iceeedr View Post
By the code, I believe he wants to enable a menu only for the Steamids in the file ... there are much better ways to do this but anyway ...
But, since he's in a requests section, he needs to use his words and explain what he actually wants.
__________________
fysiks is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-01-2020 , 23:59   Re: [HELP] Save SteamID Accounts
Reply With Quote #5

Code:
#include <amxmodx> #include <amxmisc> new path[128]; new Trie:special_player; new bool: has_access[33]; public plugin_init(){     register_native("has_user_access", "_has_user_access", 1);     get_configsdir(path, charsmax(path));     add(path, charsmax(path), "/users-steams.ini");         special_player = TrieCreate();         ReadData(); } ReadData(){     new Line[32];     new j, f = fopen(path, "rt");     if (!f){         set_fail_state("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){         set_fail_state("No users found on %s file", path);     } } public plugin_end(){     TrieDestroy(special_player); } public client_authorized(id){     new steamid[32];     get_user_authid(id, steamid, charsmax(steamid));         has_access[id] = bool: (TrieKeyExists(special_player, steamid)); } public _has_user_access(id){     return is_user_connected(id) ? has_access[id] : false; }
Code:
#include <amxmodx> native has_user_access(id); public plugin_init(){     register_clcmd("say /test", "clcmd_test"); } public clcmd_test(id){     client_print(id, print_chat, "You %s access to this command", has_user_access(id) ? "have" : "don't have"); }
__________________
Relaxing is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-02-2020 , 03:53   Re: [HELP] Save SteamID Accounts
Reply With Quote #6

Quote:
Originally Posted by Relaxing View Post
Code:
#include <amxmodx> #include <amxmisc> new path[128]; new Trie:special_player; new bool: has_access[33]; public plugin_init(){     register_native("has_user_access", "_has_user_access", 1);     get_configsdir(path, charsmax(path));     add(path, charsmax(path), "/users-steams.ini");         special_player = TrieCreate();         ReadData(); } ReadData(){     new Line[32];     new j, f = fopen(path, "rt");     if (!f){         set_fail_state("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){         set_fail_state("No users found on %s file", path);     } } public plugin_end(){     TrieDestroy(special_player); } public client_authorized(id){     new steamid[32];     get_user_authid(id, steamid, charsmax(steamid));         has_access[id] = bool: (TrieKeyExists(special_player, steamid)); } public _has_user_access(id){     return is_user_connected(id) ? has_access[id] : false; }
Code:
#include <amxmodx> native has_user_access(id); public plugin_init(){     register_clcmd("say /test", "clcmd_test"); } public clcmd_test(id){     client_print(id, print_chat, "You %s access to this command", has_user_access(id) ? "have" : "don't have"); }
very Good,
Do you add the following feature?

Code:
amx_addsteam <playername|auth>
Errors:
Code:
//// Steam_Accounts.sma
// C:\server\hlds\cstrike\addons\amxmodx\scripting\Steam_Accounts.sma(23) : error 088: number of arguments does not match definition
// C:\server\hlds\cstrike\addons\amxmodx\scripting\Steam_Accounts.sma(41) : error 088: number of arguments does not match definition
//
// 2 Errors.
// Could not locate output file compiled\Steam_Accounts.amx (compile failed).
//
// Compilation Time: 0.09 sec
// ----------------------------------------

Last edited by alferd; 06-02-2020 at 04:00.
alferd is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-02-2020 , 04:05   Re: [HELP] Save SteamID Accounts
Reply With Quote #7

Code:
register_clcmd("amx_addsteam", "clcmd_addsteam"); public clcmd_addsteam(){     new arg[32];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         TrieSetCell(special_player, Arg, 1); }
__________________
Relaxing is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-02-2020 , 04:20   Re: [HELP] Save SteamID Accounts
Reply With Quote #8

Quote:
Originally Posted by Relaxing View Post
Code:
register_clcmd("amx_addsteam", "clcmd_addsteam"); public clcmd_addsteam(){     new arg[32];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         TrieSetCell(special_player, Arg, 1); }
thanks a lot
,

Quote:
Originally Posted by alferd View Post
Errors:
Code:
//// Steam_Accounts.sma
// C:\server\hlds\cstrike\addons\amxmodx\scripting\Steam_Accounts.sma(23) : error 088: number of arguments does not match definition
// C:\server\hlds\cstrike\addons\amxmodx\scripting\Steam_Accounts.sma(41) : error 088: number of arguments does not match definition
//
// 2 Errors.
// Could not locate output file compiled\Steam_Accounts.amx (compile failed).
//
// Compilation Time: 0.09 sec
// ----------------------------------------
alferd is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-02-2020 , 04:31   Re: [HELP] Save SteamID Accounts
Reply With Quote #9

Show some actual code, I can't guess the errors.


Use this code instead of that one because is the file doesn't exists or there's no valid content inside it, it's gonna throw an error that the native doesn't exists.
Code:
#include <amxmodx> #include <amxmisc> new path[128]; new Trie:special_player; new bool: has_access[33]; new f, j; public plugin_init(){     register_native("has_user_access", "_has_user_access", 1);     get_configsdir(path, charsmax(path));     add(path, charsmax(path), "/users-steams.ini");         special_player = TrieCreate();         ReadData(); } 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){     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; }
__________________

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

Quote:
Originally Posted by Relaxing View Post
Code:
register_clcmd("amx_addsteam", "clcmd_addsteam"); public clcmd_addsteam(){     new arg[32];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         TrieSetCell(special_player, Arg, 1); }
The steam ID was not added to the "users-steams.ini" file

Code:
register_clcmd("amx_addsteam", "clcmd_addsteam"); public clcmd_addsteam(){     new arg[32];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         TrieSetCell(special_player, Arg, 1); }

--->

Code:
register_clcmd("amx_addsteam", "clcmd_addsteam"); public clcmd_addsteam(){     new arg[32];     read_args(arg, charsmax(arg));         remove_quotes(arg);     trim(arg);         TrieSetCell(special_player, arg, 1);     return PLUGIN_HANDLED; }

Code:
] amx_addsteam STEAM_0:0:123456789
Unknown command: amx_addsteam
amxx plugins :
Code:
 [ 51] Steam Accounts          1.0         AlferD            steam.amxx       debug
 [ 52] Steam Accounts test     1.0         AlferD            steam2.amxx      running
----------------------------------------------------

plugins.ini:
steam.amxx debug

Code:
L 06/02/2020 - 15:44:05: Invalid trie handle provided (0)
L 06/02/2020 - 15:44:05: [AMXX] Displaying debug trace (plugin "steam.amxx")
L 06/02/2020 - 15:44:05: [AMXX] Run time error 10: native error (native "TrieSetCell")
L 06/02/2020 - 15:44:05: [AMXX]    [0] steam.sma::clcmd_addsteam (line 35)
------------------------------------------------------
Quote:
Originally Posted by Relaxing View Post
Show some actual code, I can't guess the errors.


Use this code instead of that one because is the file doesn't exists or there's no valid content inside it, it's gonna throw an error that the native doesn't exists.
Code:
#include <amxmodx> #include <amxmisc> new path[128]; new Trie:special_player; new bool: has_access[33]; new f, j; public plugin_init(){     register_native("has_user_access", "_has_user_access", 1);     get_configsdir(path, charsmax(path));     add(path, charsmax(path), "/users-steams.ini");         special_player = TrieCreate();         ReadData(); } 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){     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; }
Thanks

Last edited by alferd; 06-02-2020 at 07:23.
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 11:44.


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