Resource icon

Teamspeak 3 Rank System 2017-08-26

No permission to download
Status
Not open for further replies.

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
Alligatoras submitted a new resource:

Teamspeak 3 Rank System - Teamspeak 3 Rank System

Hello everyone,
I know that many people using a Rank System on their teamspeak 3 server.
Many of us (including my self) we use the TeamSpeak 3 - Rank/Level up system which is very good and personnaly i would like to thank the author.

Anyway...

What i want to show here is another Rank System that is much easier for some users to install and run and also is lighter from the other....

Read more about this resource...
 
Last edited:

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
Looks simple, will definitely try it out. :)
I always have a test server on my computer. I thought it would be difficult....but it wasn't at all and the best part was when it worked! ;)
 

hackerpedro

Member
May 7, 2016
34
1
43
Hello everyone,
I know that many people using a Rank System on their teamspeak 3 server.
Many of us (including my self) we use the TeamSpeak 3 - Rank/Level up system which is very good and personnaly i would like to thank the author.

Anyway...

What i want to show here is another Rank System that is much easier for some users to install and run and also is lighter from the other.

Download: https://mega.nz/#!AVth2I5Z!cz-6p97WLJz0_H9AEALyfSAeml3W5wzppULTixo4UyI
Virustotal: https://www.virustotal.com/el/url/7...2ba513e14cc585f8e8d0f6cf04bf112f755/analysis/

In this script you just set the time and the servergroup id and that's all.
Just run the script with a cron job and the script will work on your server!

How to save the code and run it? Just follow the steps bellow!
1) Use an FTP Client like Filezilla and transfer the rank.php file in a folder of your choice!
2) On the console use this command: sudo crontab -e (if you don't have it install it: sudo apt-get install cron)
3) At the end of the file put these two lines: a) * * * * * php /path/to/your/script/rank.php b) @reboot php /path/to/your/script/rank.php
The first line will run the script for ever.
The second one will run the script on your vps reboot.

The Script is not mine , so special thanks to the author: YanekThebill
If you need any help...just remember we are here to help one each other!
It gives me an error:

Warning: feof() expects parameter 1 to be resource, boolean given in MY DIRECTORY on line 148

Warning: fgets() expects parameter 1 to be resource, boolean given in MY DIRECTORY on line 150
 

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
It gives me an error:

Warning: feof() expects parameter 1 to be resource, boolean given in MY DIRECTORY on line 148

Warning: fgets() expects parameter 1 to be resource, boolean given in MY DIRECTORY on line 150
It shouldn't give you an error. Make sure that you have added the correct server groups IDs and NOT the sort ID.
If you have set less server than the 15 that the php file has, make sure to delete the no-needed lines!
 

hackerpedro

Member
May 7, 2016
34
1
43
It shouldn't give you an error. Make sure that you have added the correct server groups IDs and NOT the sort ID.
If you have set less server than the 15 that the php file has, make sure to delete the no-needed lines!
I've cheacked, the groups are ok, but if I only want to use 1 group update i sould erase only these lines right?:
$Rank2 = "89";
$timetoget2 = "604800"; // 7 days
$name2 = "Rank 2";
$Rank3 = "90";
$timetoget3 = "1209600"; //14 days
$name3 = "Rank 3";
$Rank4 = "91";
$timetoget4 = "1814400"; //21 days
$name4 = "Rank 4";
$Rank5 = "92";
$timetoget5 = "2678400"; // 31 days
$name5 = "Rank 5";
$Rank6 = "93";
$timetoget6 = "5184000"; //60 days
$name6 = "Rank 6";
$Rank7 = "94";
$timetoget7 = "7776000"; //90 days
$name7 = "Rank 7";
$Rank8 = "95";
$timetoget8 = "10368000"; //120 days
$name8 = "Rank 8";
$Rank9 = "96";
$timetoget9 = "15552000"; //180 days
$name9 = "Rank 9";
$Rank10 = "97";
$timetoget10 = "21600000"; //250 days
$name10 = "Rank 10";
$Rank11 = "98";
$timetoget11 = "31556926"; // 1 year
$name11 = "Rank 11";
$Rank12 = "99";
$timetoget12 = "47335389"; //1,5 year
$name12 = "Rank 12";
$Rank13 = "100";
$timetoget13 = "63113851"; // 2 years
$name13 = "Rank 13";
$Rank14 = "101";
$timetoget14 = "94670777"; // 3 years
$name14 = "Rank 14";
$Rank15 = "102";
$timetoget15 = "157784630"; //5 years
$name15 = "Rank 15";
Or I should delete anything else?
 
Last edited by a moderator:

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
I've cheacked, the groups are ok, but if I only want to use 1 group update i sould erase only these lines right?:

$Rank2 = "89";
$timetoget2 = "604800"; // 7 days
$name2 = "Rank 2";
$Rank3 = "90";
$timetoget3 = "1209600"; //14 days
$name3 = "Rank 3";
$Rank4 = "91";
$timetoget4 = "1814400"; //21 days
$name4 = "Rank 4";
$Rank5 = "92";
$timetoget5 = "2678400"; // 31 days
$name5 = "Rank 5";
$Rank6 = "93";
$timetoget6 = "5184000"; //60 days
$name6 = "Rank 6";
$Rank7 = "94";
$timetoget7 = "7776000"; //90 days
$name7 = "Rank 7";
$Rank8 = "95";
$timetoget8 = "10368000"; //120 days
$name8 = "Rank 8";
$Rank9 = "96";
$timetoget9 = "15552000"; //180 days
$name9 = "Rank 9";
$Rank10 = "97";
$timetoget10 = "21600000"; //250 days
$name10 = "Rank 10";
$Rank11 = "98";
$timetoget11 = "31556926"; // 1 year
$name11 = "Rank 11";
$Rank12 = "99";
$timetoget12 = "47335389"; //1,5 year
$name12 = "Rank 12";
$Rank13 = "100";
$timetoget13 = "63113851"; // 2 years
$name13 = "Rank 13";
$Rank14 = "101";
$timetoget14 = "94670777"; // 3 years
$name14 = "Rank 14";
$Rank15 = "102";
$timetoget15 = "157784630"; //5 years
$name15 = "Rank 15";

Or I should delete anything else?
You should delete these lines and if you scroll down there are some more lines:

Code:
elseif ($torank["TsTOTALONLINE"] >= $timetoget2)
        {
            if (!in_array($Rank2, explode(',', $torank["TsSERVGIDs"])))
            {
                if (in_array($Rank1, explode(',', $torank["TsSERVGIDs"])))
                {
                    $ts3_VirtualServer->serverGroupClientDel($Rank1, ($torank["TsDBID"]));
                }
                $ts3_VirtualServer->serverGroupClientAdd($Rank2, ($torank["TsDBID"]));
                $ts3_VirtualServer->clientGetByDbid($torank["TsDBID"])->message("\nYour all time online is: " .
                    $torank["TsTotalTime"] . "\n You get promoted to: $name2 ");
            }
        } elseif ($torank["TsTOTALONLINE"] >= $timetoget1)
YOu will find them down...just scroll and check...just keep the last one!
 
Last edited by a moderator:

ahmadazab66

Member
May 9, 2016
1
0
33
You should delete these lines and if you scroll down there are some more lines:

Code:
elseif ($torank["TsTOTALONLINE"] >= $timetoget2)
        {
            if (!in_array($Rank2, explode(',', $torank["TsSERVGIDs"])))
            {
                if (in_array($Rank1, explode(',', $torank["TsSERVGIDs"])))
                {
                    $ts3_VirtualServer->serverGroupClientDel($Rank1, ($torank["TsDBID"]));
                }
                $ts3_VirtualServer->serverGroupClientAdd($Rank2, ($torank["TsDBID"]));
                $ts3_VirtualServer->clientGetByDbid($torank["TsDBID"])->message("\nYour all time online is: " .
                    $torank["TsTotalTime"] . "\n You get promoted to: $name2 ");
            }
        } elseif ($torank["TsTOTALONLINE"] >= $timetoget1)
YOu will find them down...just scroll and check...just keep the last one!

i can not understand you .
 
Last edited by a moderator:

hackerpedro

Member
May 7, 2016
34
1
43
You should delete these lines and if you scroll down there are some more lines:


elseif ($torank["TsTOTALONLINE"] >= $timetoget2)
{
if (!in_array($Rank2, explode(',', $torank["TsSERVGIDs"])))
{
if (in_array($Rank1, explode(',', $torank["TsSERVGIDs"])))
{
$ts3_VirtualServer->serverGroupClientDel($Rank1, ($torank["TsDBID"]));
}
$ts3_VirtualServer->serverGroupClientAdd($Rank2, ($torank["TsDBID"]));
$ts3_VirtualServer->clientGetByDbid($torank["TsDBID"])->message("\nYour all time online is: " .
$torank["TsTotalTime"] . "\n You get promoted to: $name2
");
}
} elseif ($torank["TsTOTALONLINE"] >= $timetoget1)

YOu will find them down...just scroll and check...just keep the last one!
I don't think I'm getting it :(
Like this?:

Code:
<?php
//-----------------------------------------------------------------------------------------------------------------
// TEAMSPEAK SETTINGS
$botname = ""; //Bot Name
$TSaddress = ""; // TS server Adrress
$TSqueryport = ""; //Ts server query port
$TSport = ""; //TS Port
$TSadminNickname = ""; //TS Admin Nickname
$TSpassword = ""; // Ts Admin Pass
//-----------------------------------------------------------------------------------------------------------------
// RANK SETTINGS
$Rank1 = "7";  //Rank SG ID
$timetoget1 = "86400"; //24h  Time to get
$name1 = "Rank 1"; //Rank Name
//------------------------------------------------------------------------------------------------------------------
function time_elapsed($time)
{
    $bit = array(
        'y' => $time / 31556926 % 12,
        'w' => $time / 604800 % 52,
        'd' => $time / 86400 % 7,
        'h' => $time / 3600 % 24,
        'm' => $time / 60 % 60,
        's' => $time % 60);
    foreach ($bit as $k => $v)
        if ($v > 0)
            $ret[] = $v . $k;
    return join(' ', $ret);
}
// ERROR REPORT
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$filename = "OnlineStatus.txt";
$totaltime = "TotalTime.txt";
set_time_limit(0);
date_default_timezone_set('Europe/Warsaw');
require_once dirname(__file__) .
    "/libraries/TeamSpeak3/TeamSpeak3.php";
try
{
    $ts3_VirtualServer = TeamSpeak3::factory("serverquery://$TSadminNickname:$TSpassword@$TSaddress:$TSqueryport/?server_port=$TSport&nickname=$botname");
}
catch (TeamSpeak3_Exception $e)
{
    // print the error message returned by the server
    echo "Error " . $e->getCode() . ": " . $e->getMessage();
}
$arr_ClientList = $ts3_VirtualServer->clientList();
$TSuserdata = array();
foreach ($arr_ClientList as $TSClid => $TSArray)
{
    if ($TSArray->client_unique_identifier->toString() == "serveradmin")
    {
    } elseif ($TSArray->client_unique_identifier->toString() == "ServerQuery")
    {
    } else
    {
        array_push($TSuserdata, array(
            "TsNICK" => $TSArray->client_nickname->toString(),
            "TsDBID" => $TSArray->client_database_id,
            "TsUID" => $TSArray->client_unique_identifier->toString(),
            "TsSERVGIDs" => $TSArray->client_servergroups,
            "TsCHANGIDs" => $TSArray->client_channel_group_id,
            "TsCLIENTID" => $TSArray->clid,
            "TsCONTIME" => $TSArray->client_lastconnected,
            "TsIDLTIME" => $TSArray->client_idle_time,
            "TsCLIENTCHANID" => $TSArray->cid));
    }
}
foreach ($TSuserdata as $timeonline)
{
    $searchfor = "" . $timeonline["TsUID"] . "";
    $file = file_get_contents($filename);
    if (strpos($file, $searchfor) == false)
    {
        $timecon = $timeonline["TsCONTIME"];
        $data = "" . $timeonline["TsUID"] . ",$timecon\n";
        file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
    }
}
$fh = fopen($filename, 'r');
$members = array();
$onlinedata = array();
$i = 0;
while (!feof($fh))
{
    $huj = fgets($fh);
    $huj = trim($huj);
    $members[] = $huj;
}
fclose($fh);
foreach ($members as $Mem)
{
    $MemS = explode(",", $Mem);
    if (!empty($MemS[0]))
    {
        $a = ($MemS[0]);
        $b = ($MemS[1]);
        array_push($onlinedata, array("TsUID" => $a, "TsCONTIME" => $b));
    }
}
$tt = fopen($totaltime, 'r');
$members2 = array();
$totalonlinedata = array();
$i = 0;
while (!feof($tt))
{
    $chuj = fgets($tt);
    $chuj = trim($chuj);
    $members2[] = $chuj;
}
fclose($tt);
foreach ($members2 as $Mem2)
{
    $MemS2 = explode(",", $Mem2);
    if (!empty($MemS2[0]))
    {
        $a = ($MemS2[0]);
        $b = ($MemS2[1]);
        $time = $b;
        $c = time_elapsed($time);
        array_push($totalonlinedata, array(
            "TsUID" => $a,
            "TsTOTALONLINE" => $b,
            "TsTotalTime" => $c));
    }
}
$uilist = "";
foreach ($TSuserdata as $tsuid)
{
    $ui = $tsuid["TsUID"];
    $uilist = $uilist . $ui . ",";
}
foreach ($onlinedata as $ondat)
{
    if (!in_array($ondat["TsUID"], explode(',', $uilist)))
    {
        $file2 = file_get_contents($totaltime);
        $searchfor2 = $ondat["TsUID"];
        if (strpos($file2, $searchfor2) == false)
        {
            $sesiontime = time() - $ondat["TsCONTIME"];
            if ($sesiontime > 0)
            {
                $data = "" . $ondat["TsUID"] . ",$sesiontime\n";
                file_put_contents($totaltime, $data, FILE_APPEND | LOCK_EX);
            }
            $deleteEntry = "" . $ondat["TsUID"] . "," . $ondat["TsCONTIME"] . "";
            $file = file_get_contents($filename);
            $file = rtrim(str_replace("$deleteEntry", '', $file));
            $file = file_put_contents($filename, $file);
            file_put_contents($filename, "\n", FILE_APPEND | LOCK_EX);
        } elseif (strpos($file2, $searchfor2) !== false)
        {
            foreach ($totalonlinedata as $tsdat)
            {
                if ($ondat["TsUID"] == $tsdat["TsUID"])
                {
                    $sesiontime = time() - $ondat["TsCONTIME"];
                    $totalTime = $sesiontime + $tsdat["TsTOTALONLINE"];
                    if ($totalTime > 0)
                    {
                        $delEntry = "" . $tsdat["TsUID"] . "," . $tsdat["TsTOTALONLINE"] . "";
                        $dataentry = "" . $ondat["TsUID"] . ",$totalTime";
                        $file2 = file_get_contents($totaltime);
                        $file2 = rtrim(str_replace("$delEntry", "$dataentry", $file2));
                        $file2 = file_put_contents($totaltime, $file2);
                        file_put_contents($totaltime, "\n", FILE_APPEND | LOCK_EX);
                    }
                    $deleteEntry = "" . $ondat["TsUID"] . "," . $ondat["TsCONTIME"] . "";
                    $file = file_get_contents($filename);
                    $file = rtrim(str_replace("$deleteEntry", '', $file));
                    $file = file_put_contents($filename, $file);
                    file_put_contents($filename, "\n", FILE_APPEND | LOCK_EX);
                }
            }
        }
    }
}
foreach ($TSuserdata as $key => $s1)
{
    foreach ($totalonlinedata as $tr)
    {
        if ($s1["TsUID"] == $tr["TsUID"])
        {
            foreach ($tr as $k => $c)
            {
                $TSuserdata[$key][$k] = $c;
            }
            $find = 1;
            break;
        }
    }
}
foreach ($TSuserdata as $torank)
{
    if (array_key_exists("TsTOTALONLINE", $torank))
    {
        if ($torank["TsTOTALONLINE"] >= $timetoget15)
        {
            if (!in_array($Rank1, explode(',', $torank["TsSERVGIDs"])))
            {
                $ts3_VirtualServer->serverGroupClientAdd($Rank1, ($torank["TsDBID"]));
                $ts3_VirtualServer->clientGetByDbid($torank["TsDBID"])->message("[b]\nYour all time online is: " .
                    $torank["TsTotalTime"] . "\n You get promoted to: $name1 [/b]");
            }
        }
    }
}
?>
 

hackerpedro

Member
May 7, 2016
34
1
43
Is it supposed to get a blank page when i access http://www.mydomain.com/rank.php ?

and the OnlineStatus.txt output should be?:
UNIQUEID,1463838019
UNIQUEID,1463837999
UNIQUEID,1463916741
UNIQUEID,1463912771
UNIQUEID,1463912721
UNIQUEID,1463861024
UNIQUEID,1463838019

and the TotalTime.txt output should be blank?
 
Last edited:

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
Is it supposed to get a blank page when i access http://www.mydomain.com/rank.php ?

and the OnlineStatus.txt output should be?:
UNIQUEID,1463838019
UNIQUEID,1463837999
UNIQUEID,1463916741
UNIQUEID,1463912771
UNIQUEID,1463912721
UNIQUEID,1463861024
UNIQUEID,1463838019

and the TotalTime.txt output should be blank?
Probably you didn'r understand this work. This is not a page for a website! It is just a php file you need to run in cronjob. Nothing else.

Please type the server group ids and the times you want them to be given and i will fix it for you :)
 

hackerpedro

Member
May 7, 2016
34
1
43
Probably you didn'r understand this work. This is not a page for a website! It is just a php file you need to run in cronjob. Nothing else.

Please type the server group ids and the times you want them to be given and i will fix it for you :)

I know it's not a website! I only want after 7 days of connection the guest gets promoted to member (SERVER GROUP ID 7)!

Thanks!
 

hackerpedro

Member
May 7, 2016
34
1
43
Sorry for making you wait, i just got home!
Download link: https://mega.nz/#!MANSkTQT!F3UGTb-9oGquw4oEXFMwgCpBX9z7qvCu3tvP-Oe-Aac
This is the whole file with the PHP Libraries! You just need to edit the rank.php file your server info and your servergroup id info!
My friend you don't have to apologize, you've already done so much there's nothing we cant complaint about! Thank you for the time you took to help... If something I can help with comes up fell free to ask!
 

Alligatoras

Administrator
Mar 31, 2016
2,570
12
2,857
381
Yes, but that will be super awesome for us because its easy to install and setup :)
I have already done some tries, but it didn't work at least on the tests i did. I keep trying but i don't know. If it works i will post it for sure! :)
 
Status
Not open for further replies.
Top