Jump to content

Allow user to set map or other settings during order


Dennis

Recommended Posts

When using the TCAdmin2_advanced module for WHMCS, you can allow your user to predefine basically anything that can be controlled using a variable in TCAdmin.

 

Set up the variable

Start by going to System > Settings > Games & Other Voice Servers > Game > Variables and create a new variable (if you haven't already done so yet).

I've already created a variable called 'Map' for ARK: Survival Evolved that will control what map the service is starting with.

B1ihLVr.png

Some variables will require you to set a default value (like in my case, as the server can't start without a map being specified).

If the variable is going to be specified in a command line, specify it under 'Variable Options' and set any other options here as well.

 

 

If you're setting up a variable that's used for a commandline

 

Go to System > Settings > Games & Other Voice Servers > Game and select the Commandlines tab. Specify the default commandline as such:

![Map]?MultiHome=$[service.IpAddress]?Port=$[service.GamePort]?QueryPort=$[service.QueryPort]?RCONPort=$[service.RConPort]?MaxPlayers=$[service.Slots]?listen 

If you're setting up a variable that's used for a configuration file

 

Go to System > Settings > Games & Other Voice Servers > Game and select Configuration Files. Either add or edit the file that will contain the setting for the variable. Go to the 'Template' tab of the configuration file.

example.cfg

 


//This is just a fictional configuration file
server.Hostname=$[HostName]
server.IpAddress=$[service.IpAddress]
server.GamePort=$[service.GamePort]
server.QueryPort=$[service.QueryPort]
server.MaxPlayers=$[service.Slots]
server.Map=![Map]

Now we've added our 'Map' variable to the server.Map setting.

 

 

Configure WHMCS

For the sake of this tutorial, I'll be adding a Custom Field to a product using the TCAdmin2_Advanced module in WHMCS, but you can also use Configurable Options in WHMCS. If you do that, remember to swap out 'CustomField' with 'ConfigOption' in your php file later in this tutorial.

 

Go to Setup > Products/Services > Click the edit button next to your game and choose the Custom Fields tab.

 

 

I've setup the field like this:

EkwSBOt.pngYou can specify a value that is sent to TCAdmin and a value that is shown to the client when ordering like this:

TCAdminValue|VisibleToClient

The code from my screenshot will therefore look like this:

7btWXOQ.png

 

 

Now we just need to tell TCAdmin to use this value.

Go to yourwhmcsinstallation/modules/servers/tcadmin2_advanced and create a new file (called gamename.php fx). Include the following code in the file:

<!--?php
include('default_values.php');
$billing_api_values["gamevar_[i]NameOfYourTCAdminVariable[/i]"] = "CustomField:[i]NameOfYouCustomField[/i]";
?>

Be sure to update NameOfYourTCAdminVariable and NameOfYouCustomField with whatever you've named them in TCAdmin and WHMCS.

Example:

<!--?php
include('default_values.php');
$billing_api_values["gamevar_Map"] = "CustomField:Server Map";
?>

Once you have that, save the file and you should be good to go :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 26 Guests (See full list)

    • There are no registered users currently online
×
×
  • 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