Jump to content

Tcadmin Advanced


Recommended Posts

This post is to show how the module can be customized.

 

We will start with the Configurable Options

 

In order to access the Config Options array easier we will add this line of code

$ConfigOption_c = $params["configoptions"];

 

Next - Since we are trying to allow customers to select what fps / tickrate / server they want we will create the following code

 

Note these are bits of code, you will have to add each part manually.

 

//////////////////////////////////////////////////////////////////////
$gameID = "ID OF NORMAL SERVER";//ID OF NORMAL
$gameIDBOOSTED = "IDOFBOOSTED SERVER";//ID OF BOOSTED
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
//If customer request a normal server set id as $gameID
//////////////////////////////////////////////////////////////////////
if($ConfigOption_c["Server FPS"] == "NOT BOOSTED"){
$gameSet = $gameID1;
}
else
$gameSet = $gameIDBOOSTED;

//////////////////////////////////////////////////////////////////////
//If customer request a source tv server or doesn't
//////////////////////////////////////////////////////////////////////


if($ConfigOption_c["Add SourceTv"] == true){
if($customfields["SourceTv Bot Name"] ==""){
$sourceS = "+tv_enable 1 +tv_allow_camera_man 1 +tv_maxclients 5 +tv_snapshotrate 66 +tv_name SourceTV -tvmasteronly ";
}
else
$sourceS = "+tv_enable 1 +tv_allow_camera_man 1 +tv_maxclients 5 +tv_snapshotrate 66 +tv_name ".$customfields["SourceTv Bot Name"]. "-tvmasteronly ";
}
else
$sourceS = "-tvdisable";


//////////////////////////////////////////////////////////////////////
//Have clients enter a slot number
//////////////////////////////////////////////////////////////////////
//Slot setup
$numberS = $ConfigOption_c["Player Slots"];
if($ConfigOption_c["Server Private"] == true){
$gameslots_c = "PRI".$numberS;
$setPrivate = 1;
}
else
if($ConfigOption_c["Server Private"] ==""){
$gameslots_c = "PUB".$numberS;
$setPrivate = 0;
}

//Set api
$billing_api_values["game_id"] = $gameSet;
$billing_api_values["game_slots"] = $gameslots_c;
$billing_api_values["game_private"] = $setPrivate;
$billing_api_values["game_branded"] = $params["configoption9"];
$billing_api_values["game_datacenter"] = $params["configoption11"];
$billing_api_values["game_hostname"] = $params["configoption13"];
$billing_api_values["game_rcon_password"] = $params["configoption15"];
$billing_api_values["game_private_password"] = $params["configoption17"];

 

If more people request help I will build a better tutorial.

Link to comment
Share on other sites

Finished example

 

<?php

/*
tcadmin_advanced version 1.03
Copyright (c) 2009 Luis Alvarenga
http://www.tcadmin.com

Change Log
v1.03 : Service password is updated when using a custom field for the TCAdmin password.
v1.02 : Self signed certificates are supported.
v1.01 : Added support for WHMCS 3.8.1.
        Service password is updated correctly.
v1.0  : Initial release.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

if(count(get_included_files()) ==1) exit("Direct access not permitted.");

$billing_api_values = array();

/* *************** */
/* Advanced Values */
/* *************** */
$customfields = $params["customfields"];
$ConfigOption_c = $params["configoptions"];

$gameID1 = "10";
$gameIDBOOSTED = "10";
if($ConfigOption_c["Server FPS"] == 700){
$gameSet = $gameID1;
}
else
$gameSet = $gameIDBOOSTED;

if($ConfigOption_c["Add SourceTv"] == true){
if($customfields["SourceTv Bot Name"] ==""){;
$sourceS = "+tv_enable 1 +tv_allow_camera_man 1 +tv_maxclients 5 +tv_snapshotrate 66 +tv_name SourceTV -tvmasteronly ";
}
else
$sourceS = "+tv_enable 1 +tv_allow_camera_man 1 +tv_maxclients 5 +tv_snapshotrate 66 +tv_name ".$customfields["SourceTv Bot Name"]. "-tvmasteronly ";
}
else
$sourceS = "-tvdisable";

//Slot setup
$numberS = $ConfigOption_c["Player Slots"];
if($ConfigOption_c["Server Private"] == true){
$gameslots_c = "PRI".$numberS;
$setPrivate = 1;
}
else
if($ConfigOption_c["Server Private"] == false || $ConfigOption_c["Server Private"] ==""){
$gameslots_c = "PUB".$numberS;
$setPrivate = 0;
}

$billing_api_values["skip_page"]="1";


$billing_api_values["game_additional_slots"]="0";
$billing_api_values["game_additional_arguments"]="-tickrate ".$ConfigOption_c["Server Tickrate"]." +max_fps ".$ConfigOption_c["Server FPS"]." ".$sourceS;
$billing_api_values["game_level"]="";

$billing_api_values["voice_additional_slots"]="0";
$billing_api_values["voice_additional_arguments"]="";
$billing_api_values["voice_level"]="";

/* ************** */
/* Game Switching */
/* ************** */

$billing_api_values["switch_at_once"]=1;
$billing_api_values["game_id_switch_1"]="";
$billing_api_values["game_slots_switch_1"]="";
$billing_api_values["game_id_switch_2"]="";
$billing_api_values["game_slots_switch_2"]="";
$billing_api_values["game_id_switch_3"]="";
$billing_api_values["game_slots_switch_3"]="";
$billing_api_values["game_id_switch_4"]="";
$billing_api_values["game_slots_switch_4"]="";
$billing_api_values["game_id_switch_5"]="";
$billing_api_values["game_slots_switch_5"]="";
$billing_api_values["game_id_switch_6"]="";
$billing_api_values["game_slots_switch_6"]="";
$billing_api_values["game_id_switch_7"]="";
$billing_api_values["game_slots_switch_7"]="";
$billing_api_values["game_id_switch_8"]="";
$billing_api_values["game_slots_switch_8"]="";
$billing_api_values["game_id_switch_9"]="";
$billing_api_values["game_slots_switch_9"]="";
$billing_api_values["game_id_switch_10"]="";
$billing_api_values["game_slots_switch_10"]="";
$billing_api_values["game_id_switch_11"]="";
$billing_api_values["game_slots_switch_11"]="";
$billing_api_values["game_id_switch_12"]="";
$billing_api_values["game_slots_switch_12"]="";
$billing_api_values["game_id_switch_13"]="";
$billing_api_values["game_slots_switch_13"]="";
$billing_api_values["game_id_switch_14"]="";
$billing_api_values["game_slots_switch_14"]="";
$billing_api_values["game_id_switch_15"]="";
$billing_api_values["game_slots_switch_15"]="";
$billing_api_values["game_id_switch_16"]="";
$billing_api_values["game_slots_switch_16"]="";
$billing_api_values["game_id_switch_17"]="";
$billing_api_values["game_slots_switch_17"]="";
$billing_api_values["game_id_switch_18"]="";
$billing_api_values["game_slots_switch_18"]="";
$billing_api_values["game_id_switch_19"]="";
$billing_api_values["game_slots_switch_19"]="";
$billing_api_values["game_id_switch_20"]="";
$billing_api_values["game_slots_switch_20"]="";
$billing_api_values["game_id_switch_21"]="";
$billing_api_values["game_slots_switch_21"]="";
$billing_api_values["game_id_switch_22"]="";
$billing_api_values["game_slots_switch_22"]="";
$billing_api_values["game_id_switch_23"]="";
$billing_api_values["game_slots_switch_23"]="";
$billing_api_values["game_id_switch_24"]="";
$billing_api_values["game_slots_switch_24"]="";
$billing_api_values["game_id_switch_25"]="";
$billing_api_values["game_slots_switch_25"]="";

/* ************************** */
/* Client UserId and Password */
/* ************************** */
$billing_api_values["user_name"] = $customfields["Username"];
$billing_api_values["user_password"] = $customfields["Password"];
/*
$billing_api_values["user_name"] = $params["username"];
$billing_api_values["user_password"] = $params["password"];
*/

/* *************************************************************************************** */
/*                              DON'T CHANGE BELLOW THIS LINE                              */
/* *************************************************************************************** */


/* **************************************** */
/* Values found in the module settings page */
/* **************************************** */

$billing_api_values["game_package_id"] = $params["serviceid"];
$billing_api_values["voice_package_id"] = $params["serviceid"];
$billing_api_values["client_package_id"] = $params["serviceid"];

$billing_api_values["game_id"] = $gameSet;
$billing_api_values["game_slots"] = $gameslots_c;
$billing_api_values["game_private"] = $setPrivate;
$billing_api_values["game_branded"] = $params["configoption9"];
$billing_api_values["game_datacenter"] = $params["configoption11"];
$billing_api_values["game_hostname"] = $params["configoption13"];
$billing_api_values["game_rcon_password"] = $params["configoption15"];
$billing_api_values["game_private_password"] = $params["configoption17"];

$billing_api_values["voice_id"] = $params["configoption4"];
$billing_api_values["voice_slots"] = $params["configoption6"];
$billing_api_values["voice_private"] = $params["configoption8"];
$billing_api_values["voice_branded"] = $params["configoption10"];
$billing_api_values["voice_datacenter"] = $params["configoption12"];
$billing_api_values["voice_hostname"] = $params["configoption14"];
$billing_api_values["voice_rcon_password"] = $params["configoption16"];
$billing_api_values["voice_private_password"] = $params["configoption18"];

/* ****************** */
/* Client Information */
/* ****************** */

$billing_api_values["client_id"] = $params["clientsdetails"]["userid"];
$billing_api_values["user_email"] = $params["clientsdetails"]["email"];
$billing_api_values["user_fname"] = $params["clientsdetails"]["firstname"];
$billing_api_values["user_lname"] = $params["clientsdetails"]["lastname"];
$billing_api_values["user_address1"] = $params["clientsdetails"]["address1"];
$billing_api_values["user_address2"] = $params["clientsdetails"]["address2"];
$billing_api_values["user_city"] = $params["clientsdetails"]["city"];
$billing_api_values["user_state"] = $params["clientsdetails"]["state"];
$billing_api_values["user_zip"] = $params["clientsdetails"]["postcode"];
$billing_api_values["user_country"] = $params["clientsdetails"]["country"];
$billing_api_values["user_phone1"] = $params["clientsdetails"]["phonenumber"];
$billing_api_values["user_phone2"] = "";

/* ****************************** */
/* Billing API Login and Password */
/* ****************************** */
$billing_api_values["response_type"] = "text";
$billing_api_values["tcadmin_username"] = $params["serverusername"];
$billing_api_values["tcadmin_password"] = $params["serverpassword"];

?>

Link to comment
Share on other sites

  • 1 month later...

Instructions:

 

Place in whmcs_root/modules/servers/

 

Login into whmcs admin area:

 

Create a new server for tcadmin_darkstar module

 

Then create a new product with this module.

 

Create 2 custom fields: , Server Address

1. Name: Voice Setting

-Set as text box

-Admin only

 

2. Server Address

-Set as text box

 

Config option examples

Voice Server:

false = no server

_ = the id separator

 

In the image id2 and id3 would be the tcadmin id's

 

_# represents the number of slots

 

voice_slots.jpg

 

In the image TC1, TC2, TC3 would be the data center id's and the _# would represent the darkstar location

 

location.jpg

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, 9 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