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

ee helpz :}

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
When I search a player, I would like the other chars of the account to be shown in green or red, if they're online or not :s

Here's my try:

PHP:
<?PHP

	// Reject any unwanted access.
	if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
	
	$player = $GLOBALS['player'];
	$config = $GLOBALS['config'];
	$SQL = POT::getInstance()->getDBHandle();
	
	$characters = $SQL->query( 'SELECT `c`.`name`, `c`.`vocation`, `c`.`online`, `c`.`level` FROM `players` AS `c` LEFT JOIN `players` AS `p` ON `p`.`account_id` = `c`.`account_id` AND c.deleted = 0 AND c.hide_char = 0 AND p.hide_char = 0 WHERE `p`.`id` = '.$player->getId( ).' AND `c`.`id` != '.$player->getId( ).';' )->fetchAll();
	if(!empty($characters))
	echo '<div class="bar">Outros characters da conta</div>';
	foreach( $characters as $character )
		$name = ($characters['online'] == 0) ? "<a href=\"".WEBSITE."/index.php/character/view/".$character['name']."\"><font color='red'>".$character['name']."</font></a>" : "<a href='".WEBSITE."/index.php/character/view/".$character['name']."'><font color='green'>".$character['name']."</font></a>";
	{
		?>
		
		<table style="width: 50%;">
			<tr>
				<td style="width: 30%;"><?PHP echo "<tr><td width='5%'><center>$i</center></td><td width='40%'><center>$name</center></td><td width='10%'><center></td></tr>";?>
				<td style="width: 10%;"><?PHP echo $config['server_vocations'][$character['vocation']]; ?></td>
				<td style="width: 10%;"><center><b>Level</b><br><?PHP echo $character['level']; ?></center></td>
			</tr>
		</table>
		<?PHP
	}
?>

A PHP Error was encountered

Severity: Notice

Message: Undefined index: online

Filename: characters/injection.php

Line Number: 14

:peace::peace::peace::peace:
 
Go to system/application/views/view_character.php

Goto line 20, replace it with
PHP:
<tr><td width='30%'>Name</td><td><?php echo $status = ($player->isOnline()) ? "<font color='green'>".$player->getName()."" : "<font color='red'>".$player->getName()."</font>"; ?></td></tr>
 
Thanks for your answer, but it isn't exactly this I was looking for

When I search a character I have like:

Name: dankoo
level: x

Characters

Dankoo (view)
Dankooz (view)
etc (view)

wich is the characters I have in my account, u know?

I would like these names to be green/red :]

thanks!
 
ah, wait a second. i'll give it a try

edit:
PHP:
<?PHP

	// Reject any unwanted access.
	if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
	
	$player = $GLOBALS['player'];
	$config = $GLOBALS['config'];
	$SQL = POT::getInstance()->getDBHandle();
	
	$characters = $SQL->query( 'SELECT `c`.`name`, `c`.`vocation`, `c`.`world_id`, `c`.`online` FROM `players` AS `c` LEFT JOIN `players` AS `p` ON `p`.`account_id` = `c`.`account_id` WHERE `p`.`id` = '.$player->getId( ).' AND `c`.`id` != '.$player->getId( ).';' )->fetchAll( );
	
	if(!empty($characters))
	echo '<div class="bar">Characters</div>';
	foreach( $characters as $character )
	{
		?>
		<table style="width: 100%;">
			<tr>
				<td style="width: 40%;"><?PHP echo $status = ($character['online'] == 1) ? "<font color='green'>".$character['name']."</font>" : "<font color='red'>".$character['name']."</font>"; ?></td>
				<td style="width: 25%;"><?PHP echo $config['server_vocations'][$character['vocation']]; ?></td>
				<td style="width: 25%;"><?PHP echo $config['worlds'][$character['world_id']]; ?></td>
				<td style="width: 10%;"><a href="<?PHP echo WEBSITE; ?>/index.php/character/view/<?PHP echo $character['name']; ?>"><strong>View</strong></a></td>
			</tr>
		</table>
		<?PHP
	}
?>

try this
 
Last edited:
Yes it did work :]

Thanks a lot!!!!!!!!

REP+++++

closing topic
 
opening topic, since it's good to keep it open, so more ppl can use the code
 
Back
Top