Jump to content

Minecraft Ram Automatic Allocation


DaCrazyKiwi

Recommended Posts

Hey guys so i am trying to make it so when the Clients order the minecraft server thru our WHMCS order forum they click on one of the plans with a set RAM  Xms and Xmx Amount what is used when the server is made.

i have tried following the Example on the TCADMIN Documentation but cant seem to wrap my head around it.  On the whmcs forum we have added the Configurable option to pick the amount of ram they want.

dqwdqdqwdqw.PNG.e63a9a494ffa964bed19290529b5c79c.PNG

 

We have also made a php file in the tcadmin2_advanced with this code in it.   But when we order the server it just comes with the Default ram amount and not the amount selected from the list.  i know there is going to be some simple way of doing this but i am still learning on how to do all of this so forgive me about my constant lack of knowledge

<?php
include('default_values.php');
switch ($params["configoptions"]["Ram"])
{
case "1GB":
  $billing_api_values["gamevar_Xms"] = "1024";
  $billing_api_values["gamevar_Xmx"] = "1024";
  $billing_api_values["game_slots"] = 20;
  break;
case "2GB":
  $billing_api_values["gamevar_Xms"] = "2048";
  $billing_api_values["gamevar_Xmx"] = "2048";
  $billing_api_values["game_slots"] = 40;
  break;
case "3GB":
  $billing_api_values["gamevar_Xms"] = "3072";
  $billing_api_values["gamevar_Xmx"] = "3072";
  $billing_api_values["game_slots"] = 60;
  break;
case "4GB":
  $billing_api_values["gamevar_Xms"] = "4096";
  $billing_api_values["gamevar_Xmx"] = "4096";
  $billing_api_values["game_slots"] = 80;
  break;
case "5GB":
  $billing_api_values["gamevar_Xms"] = "5120";
  $billing_api_values["gamevar_Xmx"] = "5120";
  $billing_api_values["game_slots"] = 100;
  break;
case "6GB":
  $billing_api_values["gamevar_Xms"] = "6144";
  $billing_api_values["gamevar_Xmx"] = "6144";
  $billing_api_values["game_slots"] = 120;
  break;
}
?>

 

Edited by DaCrazyKiwi
Link to comment
Share on other sites

  • 6 months later...
  • 3 weeks later...
On 1/15/2021 at 5:20 AM, Dennis said:

@fcke could you post your WHMCS settings and your PHP script?

Spoiler

 

where is correct to put these codes like minecraft values? or you recommend create another file like minecraft.php and use default_values.php as include?

 

 

 

 

Screenshot_8.thumb.png.201687a5b508944799a7c53dc0128ef0.png

 

 

Edited by fcke123
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