• 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 ACC]How much vocation online!

good day friend, sorry envadir your space, but as you posted on the site gesior, resolvi ask your help. USA you saw the same site that I use, everything works fine on my server, but the site does not show the skills of sword, Shielding and others, saw that the site to create a character, not the tables gereda skills 0 , 1,2,3,4,5,6 and so also not save server skills. if you can share your site with me or at least the files needed for correction of my thank you very much.
 
@up
Paste it to 30 lines.
PHP:
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Server Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>Currently no one is playing on '.$config['server']['serverName'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
@topic
I do not know for what you want Repp. MateuszX wrote the script in its entirety. You only have added to display RP, MS, ED, EK.
 
I don't get this.

PHP:
$sor->close();
$sor1->close();
$sor2->close();
$sor3->close();

What does it do? Closes connections or frees the memory?

Anyway in both of those cases it happens after page finish loading, I don't see point of using it.

If it does other function tell me.

It should be just $connection->close();.

Either way, this AAC is already connected, why starting another connection?

This...
PHP:
$connect = new mysqli ("localhost","yourNickNameInDateBase","pass","date base");

$sor = $connect->query("SELECT COUNT(*) FROM `players` WHERE `vocation` = 1 AND `online` = 1");
$sork = $sor->fetch_array();

$sor1 = $connect->query("SELECT COUNT(*) FROM `players` WHERE `vocation` = 2 AND `online` = 1");
$sork1 = $sor1->fetch_array();

$sor2 = $connect->query("SELECT COUNT(*) FROM `players` WHERE `vocation` = 3 AND `online` = 1");
$sork2 = $sor2->fetch_array();

$sor3 = $connect->query("SELECT COUNT(*) FROM `players` WHERE `vocation` = 4 AND `online` = 1");
$sork3 = $sor3->fetch_array();

$sor->close();
$sor1->close();
$sor2->close();
$sor3->close();
can be replaced with...
PHP:
for($i = 1; $i == 4; $i++)
{
	$a = $i == 1 ? '' : ($i - 1);
	
	$sork'.$a.' = $SQL->query("SELECT COUNT(*) FROM `players` WHERE `vocation` = $i AND `online` = 1");
	$sork'.$a.' = $sork'.$a.'->fetch();
}
 
If you want really optimize it, then you can increment value in player loop

after:
Code:
$orderby = 'name';

add
Code:
$vocCounter = array(0, 0, 0, 0, 0);

in
Code:
$players_online_data = $SQL->query(

add ', `vocation`' after 'level'

inside this loop:
Code:
foreach($players_online_data as $player)

add
Code:
$vocCounter[$player['vocation']]++;

Now place where you want to be vocation was showed:
Code:
	$vocNames = array("None", "Sorcerer", "Druid", "Paladin", "Knight");
	for($i = 1; $i < 5; $i++)
	$main_content .= '<TR BGCOLOR="'.getStyle($i).'">
		<TD>'.$vocNames[$i].'</TD>
		<TD>'.$vocCounter[$i].'</TD>
	</TR>';
	$main_content .= '</TABLE><BR>';

I won't comment script in topic, because its too advanced for me =d
 
Back
Top