Raised This Month: $ Target: $400
 0% 

variable from server config


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 16:42   Re: variable from server config
Reply With Quote #1

Wow, this makes no sense. All you need to do is register the cvar in the plugin. It's super easy.
__________________
fysiks is offline
sparkey
Senior Member
Join Date: May 2010
Old 05-08-2010 , 17:24   Re: variable from server config
Reply With Quote #2

sry did not mean to confuse you guys when are so kindly helpful.

I am going to run arount 20 servers and each server needs to have a specific id in the amxmodx plugin when updating the mysql database. I do not want to make one plugin for every server cause that feels kinda worthless.

Then my thought was to just make one config for every server but now when i am acctully thinking the best would be to give a startup parameter when starting the hlds instance that the amxmodx plugin later on grabs.

If really hope i did not confuse you any more now.

Thx for your help!
sparkey is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 17:28   Re: variable from server config
Reply With Quote #3

Just create a cvar like "server_id" and then add "server_id <numberhere>" to each server.cfg that is running the plugin (each number would be different of course).
__________________
fysiks is offline
sparkey
Senior Member
Join Date: May 2010
Old 05-08-2010 , 20:43   Re: variable from server config
Reply With Quote #4

that is exactly what i tried the frist i did. I know how to register the cvar if i define the value in the plugin but i cant really figure out how i can get the value from the server.cfg so i dont have to create one plugin for each server.
sparkey is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 21:11   Re: variable from server config
Reply With Quote #5

You have to have the same plugin on all 20 servers to update the database anyways so just register the cvar in that plugin. You don't need to change the source code for each server. Just add the cvar to amxx.cfg with that server's ID.
__________________
fysiks is offline
sparkey
Senior Member
Join Date: May 2010
Old 05-08-2010 , 22:08   Re: variable from server config
Reply With Quote #6

You cant understand how retarded i feel right now :p

But i still cant understand why it helps me if i add it to the amxx.cfg? How can the plugin know which server it is updating the information for?
sparkey is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 22:48   Re: variable from server config
Reply With Quote #7

When you put

Code:
server_id 34
in amxx.cfg then when you retrieve the value of "server_id" on that server it will return the number 34 and you can use it however you like.
__________________
fysiks 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 03:35.


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