Raised This Month: $ Target: $400
 0% 

Solved get_cvar_string( returns empty string for amx_* cvars


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 08-18-2023 , 12:42   Re: get_cvar_string( returns empty string for amx_* cvars
Reply With Quote #3

I should have provided the code to you, my bad.

PHP Code:
get_cvar_string("amx_sql_host"hostcharsmax(host));
get_cvar_string("amx_sql_user"usercharsmax(user));
get_cvar_string("amx_sql_pass"passcharsmax(pass));
get_cvar_string("amx_sql_db"dbcharsmax(db));
server_print("host: %s^nuser: %s^npass: %s^ndb: %s"hostuserpassdb); 
It simply prints the content of these variables before I try to create a connection tuple.
From your comment I realized that it is the admin plugin that handles all the routine. And the reason why I get empty string is that I do not use this plugin) I thought these variables are read by amxmodx module itself or any other module, not plugins. I have checked admin.sma code, it first calls register_cvar to register custom variables, then it executes server command
PHP Code:
exec "path_to_config.cfg" 
to get real values. Thank you, it now works.
damage220 is online now
 



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 00:33.


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