• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modern Acc] Very Advanced Support list. include lua, php, mysql, css.

Erikas Kontenis

Board Moderator
Staff member
Board Moderator
Joined
Jul 3, 2009
Messages
1,864
Reaction score
567
Location
Lithuania
Hello i would like to release my new idea for modern acc this should be Advanced Support List very advanced.

First of all some credits to CyberM becouse i used his support list.

Lets start from mysql inject add this query.

Code:
ALTER TABLE `players` ADD `onlinetimeall` BIGINT( 255 ) NOT NULL DEFAULT '0';

now lets add lua globalevents tested on tfs 0.3.5 and 0.3.6

Code:
<globalevent name="history" interval="60" event="script" value="history.lua"/>

Code:
function onThink(interval, lastExecution)
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
    end
    db.executeQuery("UPDATE `players` SET `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
    return TRUE
end

now lets add php. Support List.

Code:
<?PHP
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Improved Support List                                          *
* Adapted for Modern AAC by Cybermaster                           *
* Original from AchTung                                            *
* Credits to Gesior(Standard Version)                               *
* Credits to Zonet(Improved the PHP script with css part)            *
* Credits to Apsivaflines(added last online and online time functions)*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();

//IMPORTANT!! SET SERVER DIR HERE \/
$config['site']['server_path'] = "C:/Vardius_OTS-8.6/";

function hours_and_minutes($value, $color = 1)
{
	$hours = floor($value / 3600);
	$value = $value - $hours * 3600;
	$minutes = floor($value / 60);
	if($color != 1)
		return '<font color="black">'.$hours.'h '.$minutes.'m</font>';
	else
		if($hours >= 12)
			return '<font color="red">'.$hours.'h '.$minutes.'m</font>';
		elseif($hours >= 6)
			return '<font color="black">'.$hours.'h '.$minutes.'m</font>';
		else
			return '<font color="green">'.$hours.'h '.$minutes.'m</font>';
}

if($groups = simplexml_load_file($config['site']['server_path'].'/data/XML/groups.xml') or die('<strong>Could not load groups!</strong>')) 
    foreach($groups->group as $g)   
        $groupList[(int)$g['id']] = $g['name']; 
        $list = $SQL->query("SELECT `name`, `online`, `group_id`, `world_id`, `onlinetimeall`, `lastlogin` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` DESC");
        $showed_players = 0;
        echo'<div class="bar"><center>Support in game</center></div><br/><br/><br/>';
        $headline = '<table class="houses_list_box" border="0" cellspacing="0" cellpadding="4" width="100%">
        <tr class="bar"><td class="house_title" width="20%"><strong>Group</strong>    </td>
        <td class="house_title" width="20%"><strong>Name</strong></td>
        <td class="house_title" width="20%"><strong>Status</strong></td>
        <td class="house_title" width="20%"><strong>World</strong></td>
		<td class="house_title" width="20%"><strong>Online Time</strong></td>
		<td class="house_title" width="20%"><strong>Last Login?</strong></td>'; 
		
		
  

  
	
	
        
        $group_id = 0;
        foreach($list as $gm)
        {
            if($group_id != (int)$gm['group_id']) 
                { 
                    if($group_id != 0) 
                        echo'</table><br />'; 
                        echo $headline; 
                        $group_id = (int)$gm['group_id']; 
                } 
            echo'<tr class="over"><td>'.$groupList[(int)$gm['group_id']].'</td><td><a class="link" href="'.WEBSITE.'/index.php/character/view/'.$gm['name'].'">'.$gm['name'].'</a></td><td><font color="'.($gm['online'] == 0 ? 'red">Offline' : 'green">Online').'</font></td><td>'.$config['worlds'][$gm['world_id']].'</td><td>'.hours_and_minutes($gm['onlinetimeall']).'</td><td>'.date("j M Y, H:i", $gm['lastlogin']).'</td></tr>'; 
        } 
    echo'</table>'; 
?>    
<style type="text/css"> 
        tr.over:hover { 
        background-color: #FAFAD2; 
        }
        .link {text-decoration: none;font-weight:bold;color:black;}
        .more {    display: none;}
</style>

Enjoy this if you wanna example of this script link here.

Kind Regards,
Apsivaflines.
 
A PHP Error was encountered

Severity: Warning

Message: simplexml_load_file(): I/O warning : failed to load external entity "/home/ubuntuot2/AOD/data/XML/groups.xml"

Filename: pages/support.php

Line Number: 34
 
A PHP Error was encountered

Severity: Warning

Message: simplexml_load_file(): I/O warning : failed to load external entity "/home/ubuntuot2/AOD/data/XML/groups.xml"

Filename: pages/support.php

Line Number: 34

i got this same error :S
 
I have it on my 0.4 DEV its counts secounds on Hours and milisecunds on Minutes. How to fix it?
 
Back
Top