• 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!

[Znote AAC] Staff support list

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
Preview:
t_vuIA9.png


support.php
If you use a TFS 0.2 distribution, use:
PHP:
<?php 
#    TFS 0.2 Support List for ZnoteAAC
#    By cbrm @ otland.net
#    Credits to: AchTung, Zonet

require_once 'engine/init.php'; include 'layout/overall/header.php';
$groups = array(2 => 'Gamemaster', 3 => 'God');
echo'<h1>Support in game</h1>';
$list = mysql_query('SELECT `name`, `online`, `group_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` DESC');
while ($row = mysql_fetch_assoc($list)) {$data[] = $row;}
if (empty($data)) {echo 'This server is ruled by the players.'; return include 'layout/overall/footer.php';}
$headline = '<table>
            <tr class="yellow"><td width="30%"><strong>Group</strong></td>
            <td width="40%"><strong>Name</strong></td>
            <td width="30%"><strong>Status</strong></td>';         
$group_id = 0;
foreach($data as $staff)
{
    if($group_id != (int)$staff['group_id']) 
    { 
        if($group_id != 0) echo '</table>'; echo $headline; $group_id = (int)$staff['group_id']; 
    } 
    echo '<tr><td>'.$groups[(int)$staff['group_id']].'</td>';
    echo '<td><a href="characterprofile.php?name='.$staff['name'].'">'.$staff['name'].'</a></td>';
    echo '<td><span style="color:'.($staff['online'] == 0 ?  'red;">Offline':'green;">Online').'</span></td></tr>';
} 
echo'</table>'; include 'layout/overall/footer.php'; ?>

If you use a TFS 0.3 distribution, use:
PHP:
<?php 
#    TFS 0.3 Support List for ZnoteAAC
#    By cbrm @ otland.net
#    Credits to: AchTung, Zonet

require_once 'engine/init.php'; include 'layout/overall/header.php';
$groups = array(2 => 'Tutor', 3 => 'Senior Tutor', 4 => 'Gamemaster', 5 => 'Community Manager', 6 => 'God');
$worlds = array(0 => 'Server1', 1 => 'Server2');
echo'<h1>Support in game</h1>';
$list = mysql_query('SELECT `name`, `online`, `group_id`, `world_id`  FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` DESC');
while ($row = mysql_fetch_assoc($list)) {$data[] = $row;}
if (empty($data)) {echo 'This server is ruled by the players.'; return include 'layout/overall/footer.php';}
$headline = '<table>
            <tr class="yellow"><td width="30%"><strong>Group</strong></td>
            <td width="30%"><strong>Name</strong></td>
            <td width="20%"><strong>Status</strong></td>
            <td width="20%"><strong>World</strong></td>';         
$group_id = 0;
foreach($data as $staff)
{
    if($group_id != (int)$staff['group_id']) 
    { 
        if($group_id != 0) echo '</table>'; echo $headline; $group_id = (int)$staff['group_id']; 
    } 
    echo '<tr><td>'.$groups[(int)$staff['group_id']].'</td>';
    echo '<td><a href="characterprofile.php?name='.$staff['name'].'">'.$staff['name'].'</a></td>';
    echo '<td><span style="color:'.($staff['online'] == 0 ?  'red;">Offline':'green;">Online').'</span></td>';
    echo '<td>'.$worlds[(int)$staff['world_id']].'</td></tr>'; 
} 
echo'</table>'; include 'layout/overall/footer.php'; ?>

Configure your groups' names based on group id at:
PHP:
$groups = array(2 => 'Gamemaster', 3 => 'God');
PHP:
$groups = array(2 => 'Tutor', 3 => 'Senior Tutor', 4 =>  'Gamemaster', 5 => 'Community Manager', 6 => 'God');

For TFS 0.3 configure worlds' names at:
PHP:
$worlds = array(0 => 'Server1', 1 => 'Server2');

 
Last edited:
Good to see some more features for Znote AAC! Now people have options to choose from.
 
This script works for both TFS 0.2 and 0.3, using only values from config.php

/engine/function/users.php
add:
PHP:
// Support list
function support_list() {
	$TFS = Config('TFSVersion');
	$query = mysql_query("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
	while ($row = mysql_fetch_assoc($query)) {
		if ($TFS == 'TFS_02') {
			$ACCquery = mysql_query("SELECT `type` FROM `accounts` WHERE `id` ='". $row['account_id'] ."';") or die(mysql_error());
			$ACCrow = mysql_fetch_assoc($ACCquery);
			$row['group_id'] = $ACCrow['type'];
			unset($ACCrow);
		}
		unset($row['account_id']);
		$array[] = $row;
	}
	if (isset($array)) {return $array; } else {return false;}
}

Then add page support.php in root directory:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
?><h1>Support in-game</h1><?php
$cache = new Cache('engine/cache/support');
if ($cache->hasExpired()) {
	// Fetch all staffs in-game.
	$staffs = support_list();
	// Fetch group ids and names from config.php
	$groups = $config['ingame_positions'];
	// Loops through groups, separating each group element into an ID variable and name variable
	foreach ($groups as $group_id => $group_name) {
		// Loops through list of staffs
		foreach ($staffs as $staff) {
			if ($staff['group_id'] == $group_id) $srtGrp[$group_name][] = $staff;
		}
	}
	if (!empty($srtGrp)) {
		$cache->setContent($srtGrp);
		$cache->save();
	}
} else {
	$srtGrp = $cache->load();
}
$writeHeader = true;
if (!empty($srtGrp)) {
	foreach (array_reverse($srtGrp) as $grpName => $grpList) {
		?>
		<table>
			<?php if ($writeHeader) {
			$writeHeader = false; ?>
			<tr class="yellow">
				<td width="30%">Group</td>
				<td width="40%">Name</td>
				<td width="30%">Status</td>
			</tr>
			<?php
			}
			foreach ($grpList as $char) {
				if ($char['name'] != $config['website_char']) {
					echo '<tr>';
					echo "<td width='30%'>". $grpName ."</td>";
					echo '<td width="40%"><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
					echo "<td width='30%'>". online_id_to_name($char['online']) ."</td>";
					echo '</tr>';
				}
			}
			?>
		</table>
		<?php
	}
}
echo'</table>'; include 'layout/overall/footer.php'; ?>

This system is cached, so it only does queries toward the database very rarely.

Configure group names in config.php:
PHP:
$config['ingame_positions'] = array(
		1 => 'Player',
		2 => 'Tutor',
		3 => 'Gamemaster',
		4 => 'Community Manager',
		5 => 'God',
	);

support.jpg
 
Last edited:
This script works for both TFS 0.2 and 0.3, using only values from config.php

/engine/function/users.php
add:
PHP:
// Support list
function support_list() {
    $TFS = Config('TFSVersion');
    $query = mysql_query("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
    while ($row = mysql_fetch_assoc($query)) {
        if ($TFS == 'TFS_02') {
            $ACCquery = mysql_query("SELECT `type` FROM `accounts` WHERE `id` ='". $row['account_id'] ."';") or die(mysql_error());
            $ACCrow = mysql_fetch_assoc($ACCquery);
            $row['group_id'] = $ACCrow['type'];
            unset($ACCrow);
        }
        unset($row['account_id']);
        $array[] = $row;
    }
    if (isset($array)) {return $array; } else {return false;}
}

Then add page support.php in root directory:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
?><h1>Support in-game</h1><?php
$cache = new Cache('engine/cache/support');
if ($cache->hasExpired()) {
    // Fetch all staffs in-game.
    $staffs = support_list();
    // Fetch group ids and names from config.php
    $groups = $config['ingame_positions'];
    // Loops through groups, separating each group element into an ID variable and name variable
    foreach ($groups as $group_id => $group_name) {
        // Loops through list of staffs
        foreach ($staffs as $staff) {
            if ($staff['group_id'] == $group_id) $srtGrp[$group_name][] = $staff;
        }
    }
    if (!empty($srtGrp)) {
        $cache->setContent($srtGrp);
        $cache->save();
    }
} else {
    $srtGrp = $cache->load();
}
$writeHeader = true;
if (!empty($srtGrp)) {
    foreach (array_reverse($srtGrp) as $grpName => $grpList) {
        ?>
        <table>
            <?php if ($writeHeader) {
            $writeHeader = false; ?>
            <tr class="yellow">
                <td width="30%">Group</td>
                <td width="40%">Name</td>
                <td width="30%">Status</td>
            </tr>
            <?php
            }
            foreach ($grpList as $char) {
                if ($char['name'] != $config['website_char']) {
                    echo '<tr>';
                    echo "<td width='30%'>". $grpName ."</td>";
                    echo '<td width="40%"><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
                    echo "<td width='30%'>". online_id_to_name($char['online']) ."</td>";
                    echo '</tr>';
                }
            }
            ?>
        </table>
        <?php
    }
}
echo'</table>'; include 'layout/overall/footer.php'; ?>

This system is cached, so it only does queries toward the database very rarely.

Configure group names in config.php:
PHP:
$config['ingame_positions'] = array(
        1 => 'Player',
        2 => 'Tutor',
        3 => 'Gamemaster',
        4 => 'Community Manager',
        5 => 'God',
    );

support.jpg
Have time to update it to TFS 1.2? :p
 
I cant get this to say anything other than Community Manager. I have a God char, yet it only shows online as Community manager. I have tried making different changes in the current scripts, and tried changing scripts around, but I cannot get this changed. Any ideas of where I can look?
 
I cant get this to say anything other than Community Manager. I have a God char, yet it only shows online as Community manager. I have tried making different changes in the current scripts, and tried changing scripts around, but I cannot get this changed. Any ideas of where I can look?
config.php
 
Wow. I see the error. I guess everyone was set as groupID 5, when it should have been 6. Thank you for pointing me to the file. I looked through it and found my error.
 
Wow. I see the error. I guess everyone was set as groupID 5, when it should have been 6. Thank you for pointing me to the file. I looked through it and found my error.
It depends on server.
 
Im using TFS 1.1. Once I changed the IDs to 6, it is working just as it should.
 
Back
Top