Jump to content

Gameserver Custom Scripts


MerlinMan

Recommended Posts

Hello,

 

I was wondering if anyone had or knows how to make a script in TCAdmin that created a MySQL username and password/database so the client can run their gamemodes like HL2RP for Garry's Mod. I was also looking into scripts that would allow clients to automatically install SVN links onto their servers.

 

Any help would be appreciated. I can pay for a coder if necessary.

 

Regards,

Robert Hicks

Link to comment
Share on other sites


"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "CREATE USER '%ThisUser_UserName%'@'%%'"
"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "SET PASSWORD FOR '%ThisUser_UserName%'@'%%' = PASSWORD('%ThisUser_Password%')"
"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "GRANT USAGE ON * . * TO '%ThisUser_UserName%'@'%%' IDENTIFIED BY '%ThisUser_Password%' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0"

"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "CREATE DATABASE IF NOT EXISTS `%ThisService_IpAddress%:%ThisService_GamePort%`"
"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "GRANT ALL PRIVILEGES ON `%ThisService_IpAddress%:%ThisService_GamePort%` . * TO '%ThisUser_UserName%'@'%%'"

 

 

The above will create a database named serverip:serverport on localhost

User will be set using tca user name and password. It allows remote mysql connection.

 

You can edit the script to match your needs if they are specific.

 

Note that this is a conversion of a script Im using in v1 so it may require testing.

Edited by dimitrifrom31
fixed wrong variable names
Link to comment
Share on other sites

Do you also have a script that drops the MySQL user when the service is deleted?

 

"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "DROP USER '%ThisUser_UserName%'@'%%'"
"Path_to_your_bin_folder\mysql.exe" -h localhost -u root -pYour_Root_Pass -e "DROP DATABASE IF EXISTS `%ThisService_IpAddress%:%ThisService_GamePort%`"

Link to comment
Share on other sites

I realized I was editing the Windows version instead of the Linux version...

Anyhow, this is what happens when I try doing it:

System.Net.Sockets.SocketException: Connection refused

at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0

at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remoteEP) [0x00000] in <filename unknown>:0

at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0 - Parameters: minecraft, XX.XXX.XXX.XX, 25585, /home/tcagame_svc267/Dennis/267/, 267

Link to comment
Share on other sites

Okay, I got this far:

#!/bin/bash

"/opt/lampp/bin/mysql" -h localhost -u root -pMyPassword-e "CREATE USER '${ThisUser_UserName}'@'%%'"

"/opt/lampp/bin/mysql" -h localhost -u root -pMyPassword-e "SET PASSWORD FOR '${ThisUser_UserName}'@'%%' = PASSWORD('${ThisUser_Password}')"

"/opt/lampp/bin/mysql" -h localhost -u root -pMyPassword-e "GRANT USAGE ON * . * TO '${ThisUser_UserName}'@'%%' IDENTIFIED BY '${ThisUser_Password}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0"

 

As soon as I insert this line, the script doesn't work:

"/opt/lampp/bin/mysql" -h localhost -u root -pMyPassword-e "CREATE DATABASE IF NOT EXISTS ${ThisService_IpAddress}"

 

It doesn't work with any variable. Only if I input clean text. Can anyone help me?

Link to comment
Share on other sites

  • 3 months later...

Bump... Still can't create any databases with a variable.

 

Got it working. I had to declare a variable with the TCAdmin service id variable, and then load that variable.

Edited by DennisMidjord
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use