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

gesior, show % of how many online

Linken93

Member
Joined
Apr 6, 2010
Messages
313
Reaction score
7
Location
SWEDEN
Hi!

I need help with a function that shows percent of how many it is online on the server.

Example: Your server can hold a maximum of 1000 players and when 10 players is online then it should show something like, "Currently 10 players online, it is 1% of full server".

Rep+
 
Code:
$players_prcent=round($config['status']['serverStatus_players']/$config['status']['serverStatus_playersMax']*100,0);
echo "Server Load: {$players_prcent}%";
put in layout.php
 
It seem to not working properly or am I doing something wrong? :ninja:

I want the code inside

Code:
<td onmouseover="tooltip.show('Currently are <b><?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_players'].''; else echo '0'; ?></b>players online.<br/>
It is  [COLOR="#FF0000"]<b>%</b>[/COLOR] of full server.', 225)" onmouseout="tooltip.hide()">
<table style="font-size: 11px; color: white; border: 1px solid #000;">
<tr><td width="0" alt="" style="background:url(layouts/genesis/images/status.gif) no-repeat;" height="12"></td></tr></table></td></tr></td></tr></table>
 
Code:
<?php
$players_prcent=round($config['status']['serverStatus_players']/$config['status']['serverStatus_playersMax']*100,0);
?>
<td onmouseover="tooltip.show('Currently are <b><?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_players'].''; else echo '0'; ?></b>players online.<br/>
It is  <b><?php echo $players_prcent; ?>%</b> of full server.', 225)" onmouseout="tooltip.hide()">
<table style="font-size: 11px; color: white; border: 1px solid #000;">
<tr><td width="0" alt="" style="background:url(layouts/genesis/images/status.gif) no-repeat;" height="12"></td></tr></table></td></tr></td></tr></table>
Should work , not tested.
 
It didn't work with mouseover. It looks like this now when having the mouse over the status image. It would be awesome to make it display % aswell. :)

ObeKV.png
 
Code:
<table>
<td onmouseover="tooltip.show('Currently are <b><?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_players'].''; else echo '0'; ?></b>players online.<br/>It is  <b><?php echo $players_prcent ?>%</b> of full server.', 225)" onmouseout="tooltip.hide()">
<table style="font-size: 11px; color: white; border: 1px solid #000;">
<tr><td width="0" alt="" style="background:url(layouts/genesis/images/status.gif) no-repeat;" height="12"></td></tr></table></td></tr></td></tr></table>
 
Back
Top Bottom