Online Player Page?

Status
Not open for further replies.
Kinda figured that what an elseif woulda done. Rock on =D Thanks for the assistance XD Even though My way was pretty sloppy lol Now that I think about it, it's much like making NPCs from Ragnarok online. Should aproch it like that.

Oh one last thing, as I for sure would never figure this one out: Is there a way to "softly" refresh the table on a timer? I've seen it done before in another game using a php script but I don't have it's file anymore (I think)

By "softly", do you mean refreshing just the table? not the entire page?
 
Yeah. Also is there a way to find the "master" and "Hero" status of a player? We've yet to have any on the server (since it's still new) so I dono the collum to look at.
 
There is no column for it. As far as the source is concerned, all master/hero combinations of a job is actually a separate job. If you look at your DefineJob.h more closely, you'll see what I mean.

About the refresh, there are only 2 ways I know to do it. Put the online count and table in an iframe with a meta refresh.
Or, and this is more efficient, use javascript ajax to request the new information. I don't have much experience with it though.
 
There is no column for it. As far as the source is concerned, all master/hero combinations of a job is actually a separate job. If you look at your DefineJob.h more closely, you'll see what I mean.

About the refresh, there are only 2 ways I know to do it. Put the online count and table in an iframe with a meta refresh.
Or, and this is more efficient, use javascript ajax to request the new information. I don't have much experience with it though.
Kk. I did notice, but it slipped my mind. Wait.. I don't see class 3 info in here o.o

And I'll look up a refresh ajax script =3 found a few things from googlez, wouldn't hurt to go again.

Edit: Never mind.. I'll stick to my non-refreshing page.. I just looked at some of the scripts and my head asploded x.x''
 
Last edited:
I retract my previous statement. Instead, I'll call you stupid for not putting in your MSSQL information into the script. (Instance name, login, and password)

i'll do it already before i post

i just change it because of screens

and yee i'm already a stupid sir.
 
Last edited:
i'll do it already before i post

i just change it because of screens

and yee i'm already a stupid sir.

Well, if that script doesn't work, that means your server files aren't using the MultiServer column in CHARACTER_TBL.

Kk. I did notice, but it slipped my mind. Wait.. I don't see class 3 info in here o.o

And I'll look up a refresh ajax script =3 found a few things from googlez, wouldn't hurt to go again.

Edit: Never mind.. I'll stick to my non-refreshing page.. I just looked at some of the scripts and my head asploded x.x''

The names for 3rd jobs in DefineJob still have HERO on the end, just the job name in the middle is different.
 
You could use a function, but the only purpose of that would be to keep the while loop looking cleaner, cause you can put the function coding in a different location.

Function or not though, you only have to add m_nJob to the query (along with m_szName and m_nLevel), extract that value (which is a number) into a variable, and run a series of If statements to determine what their job is.

Here's an example:
PHP:
$job = $data['m_nJob'];
if( $job == 0 )
    echo "Vagrant";
else if( $job == 1 )
    echo "Mercenary";
The numbers can be found in your DefineJob.h file in your server files.
I used 2 new things there. The second kind of if statement (no braces). That means only the echo after it will be executed.
Another new thing, is the "else if" statement. If the first If statement is false, then it checks any "else if" statements in order until it finds one that is true, or runs out of "else if" statements. If an "else if" statement is true, then it skips any that it hasn't gotten to yet.


maybe like this

if ($job == 0) $jname = 'Vagrant';
else if ($job == 1) $jname = 'Mercenary';
else if ($job == 2) $jname = 'Acrobat';
else if ($job == 3) $jname = 'Assist';
else if ($job == 4) $jname = 'Magician';
else if ($job == 5) $jname = 'Puppeter';
else if ($job == 6) $jname = 'Knight';
else if ($job == 7) $jname = 'Blade';
else if ($job == 8) $jname = 'Jester';
else if ($job == 9) $jname = 'Ranger';
else if ($job == 10) $jname = 'Ringmaster';
else if ($job == 11) $jname = 'billposter';
else if ($job == 12) $jname = 'Psykeeper';
else if ($job == 13) $jname = 'Elementor';
else if ($job == 14) $jname = 'Gatekeeper';
else if ($job == 15) $jname = 'Doppler';
else if ($job == 16) $jname = 'M-Knight';
else if ($job == 17) $jname = 'M-Blade';
else if ($job == 18) $jname = 'M-Jester';
else if ($job == 19) $jname = 'M-Ranger';
else if ($job == 20) $jname = 'M-Ringmaster';
else if ($job == 21) $jname = 'M-Billposter';
else if ($job == 22) $jname = 'M-Psykeeper';
else if ($job == 23) $jname = 'M-Elementor';
else if ($job == 24) $jname = 'H-Knight';
else if ($job == 25) $jname = 'H-Blade';
else if ($job == 26) $jname = 'H-Jester';
else if ($job == 27) $jname = 'H-Ranger';
else if ($job == 28) $jname = 'H-Ringmaster';
else if ($job == 29) $jname = 'H-Billposter';
else if ($job == 30) $jname = 'H-Psykeeper';
else if ($job == 31) $jname = 'H-Elementor';
else if ($job == 32) $jname = 'L-Templar';
else if ($job == 33) $jname = 'L-Slayer';
else if ($job == 34) $jname = 'L-Harlequin';
else if ($job == 35) $jname = 'L-Crackshooter';
else if ($job == 36) $jname = 'L-Seraph';
else if ($job == 37) $jname = 'L-ForceMaster';
else if ($job == 38) $jname = 'L-Mentalist';
else if ($job == 39) $jname = 'L-Arcanist';
else $jname = 'An applicable job name could not be found in our records.';
return $jname;

}
 
The names for 3rd jobs in DefineJob still have HERO on the end, just the job name in the middle is different.

Ah the more I dono, the more I do now. Thank you a bundle =3

@trashee:
Hey you're a time saver =3 thankie. Though I've already pretty much used the Function script that properly works. I'll post it in a moment when it's completed. remebering some script from my Ro hosting days and this is a better solution.
 
Done =3 Did I do good Teacher? XD I took the Class 3 names from the Wiki for the Master classes. Hope I'm correct XD
PHP:
<?php


        $link = @mssql_connect("PC Name\Data Base", "Name", "passy") or die ("Error!");
	$query = mssql_query('SELECT m_szName, m_nLevel, m_nJob FROM [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] WHERE [MultiServer] != 0;');
echo '<div align="center"><table width="50%" border="1" bgcolor="#BBBBBB" style="text-align:center;">';
echo '<th>Player Name</th>';
echo '<th>Player Level</th>';
echo '<th>Player Class</th>';
$online = mssql_num_rows($query);
if ( $online == 1)
echo $online." player is online. <br /><br />";
else if ( $online != 1)
echo $online." players are online. <br /><br />";
// Here's the proper way to do an If statement
if( $online > 0 )
{
    //loop through the rows
    while( $data = mssql_fetch_assoc($query) )
    {
        //loop through elements (ie td's)
        echo '<tr><td>'.$data['m_szName'].'</td>';
        echo '<td>'.$data['m_nLevel'].'</td>';
		$job = $data['m_nJob'];
		$class=pclass($job);
		}
}
echo '</table>'; 


function pclass($job)
{
	switch($job)
	{
	case 0:
	echo '<td>Vagrant</td></tr>';
	break;
	
	case 1:
	echo '<td>Mercenary</td></tr>';
	break;

	case 2:
	echo '<td>Acrobat</td></tr>';
	break;
	
	case 3:
	echo '<td>Assist</td></tr>';
	break;
	
	case 4:
	echo '<td>Magician</td></tr>';
	break;
		
	case 6:
	echo '<td>Knight</td></tr>';
	break;
	
	case 7;
	echo '<td>Blade</td></tr>';  
	break;
	
	case 8:
	echo '<td>Jester</td></tr>';
	break;
	
	case 9:
	echo '<td>Ranger</td></tr>';
	break;
	
	case 10:
	echo '<td>RingMaster</td></tr>';
	break;
	
	case 11:
	echo '<td>BillPoster</td></tr>';
	break;
	
	case 12:
	echo '<td>PsyKeeper</td></tr>';
	break;
	
	case 13:
	echo '<td>Elementor</td></tr>';
	break;
	
	case 16:
	echo '<td>Templar</td></tr>';
	break;
	
	case 17:
	echo '<td>Slayer</td></tr>';
	break;
	
	case 18:
	echo '<td>Harlequin</td></tr>';
	break;
	
	case 19:
	echo '<td>CrackShooter</td></tr>';
	break;
	
	case 20:
	echo '<td>Seraph</td></tr>';
	break;
	
	case 21:
	echo '<td>Force Master</td></tr>';
	break;
	
	case 22:
	echo '<td>Mentalist</td></tr>';
	break;
	
	case 23:
	echo '<td>Arcanist</td></tr>';
	break;
	
	case 24:
	echo '<td>HERO Templar</td></tr>';
	break;
	
	case 25:
	echo '<td>HERO Slayer</td></tr>';
	break;
	
	case 26:
	echo '<td>HERO Harlequin</td></tr>';
	break;
	
	case 27:
	echo '<td>HERO CrackShooter</td></tr>';
	break;
	
	case 28:
	echo '<td>HERO Seraph</td></tr>';
	break;
	
	case 29:
	echo '<td>HERO Force Master</td></tr>';
	break;
	
	case 30:
	echo '<td>HERO Mentalist</td></tr>';
	break;
	
	case 31:
	echo '<td>HERO Arcanist</td></tr>';
	break;
	
	case 32:
	echo '<td>Lord Templar</td></tr>';
	break;
	
	case 33:
	echo '<td>Lord Slayer</td></tr>';
	break;
	
	case 34:
	echo '<td>Lord Harlequin</td></tr>';
	break;
	
	case 35:
	echo '<td>Lord CrackShooter</td></tr>';
	break;
	
	case 36:
	echo '<td>Lord Seraph</td></tr>';
	break;
	
	case 37:
	echo '<td>Lord Force Master</td></tr>';
	break;
	
	case 38:
	echo '<td>Lord Mentalist</td></tr>';
	break;
	
	case 39:
	echo '<td>Lord Arcanist</td></tr>';
	break;
    }
return $class;
}
?>

Edit: Oops... forgot the "Lord" classes =_=''
 
Last edited:
I forgot som'in? Hmmm... *looks over script*

yeah. I did want it to display how I set it up. (thought you said "Master" was class 3 o.o)
 
No, master isn't class 3. Although I do think you misunderstood something.
The job numbers for 16-23 are Master jobs, and 24-31 are Hero jobs. 3rd jobs are 31-39.

Here's an example of how to set it up your way:
PHP:
    case 6:
    case 16:
    case 24;
    echo '<td>Knight</td></tr>';
    break;
That means Knight, Master Knight, and Hero Knight will all show in the table as Knight.
Templar should be change to 31, Slayer to 32, etc.
 
really? Huh. *pops Fingers* better get cracking on the reversal. Says "JOB_LORDTEMPLER_HERO", so I got confused. So I just use "Master Knight" and when they Jobchange at 130 I 'll just use "Templar", and at Hero I'd go "Hero Templar"? Kind of how I'd guess it.
 
Now you're confused about game progression lol.
After getting 120 @ 99.99%, you change to Master. The internal source of the game, doesn't use an identifier that says "This character is a Master." Instead, it just changes your job number (Knight is 6, master Knight is 16, Hero Knight is 24. They all follow a similar pattern.)
When you're a Master, getting 120 @ 99.99% changes you to 121 Hero. You're Hero until job change at 130, and in the case of a Knight, becomes a Templar. Do you see it now?
 
i just rechecked the wiki and yeah.. had my facts all mixed up lol Ok. So I think I completely get it. This Master/Hero thing's really new to me. I left FlyFF back in like, 2006 when Acrobat was still fresh on people's minds lol Sorry for my unusual confusion.
 
Oh forgot to report back that I got it 100% working with "Master (class)" and "Hero (class)" in the "class" field. Want to look over the code? Also would like to ask permition if I could post it in the release section (with credits to people who get them of course =3)
 
Status
Not open for further replies.
Back