Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 29.01.2006, 19:18   #1
Xoleum
Архивный участник
 
Join Date: Jan 2006
Posts: 125
Default Top Players?

Anyone has a script out there so you can show the top players as for pvp, adena, level, experience and similar for L2OFF? I'm sorry, did a search and found nothing. If it's not permitted, just remove my thread.

Thanks & Regards.
Xoleum is offline  
Old 29.01.2006, 21:38   #2
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

a single query..

for example...

TOP 10 EXP
-------------
SELECT TOP 10 char_name,exp
FROM user_data
WHERE builder = 0 AND account_id > 0
ORDER by 2 DESC
------------
"builder = 0" hideGMs from list...
"account_id > 0" is to hide deleted/banned players from list...

you can change this query for others things...

for pvp ?
------------
SELECT TOP 10 char_name,duel
FROM user_data
WHERE builder = 0 AND account_id > 0
ORDER by 2 DESC
------------

... and if you want to know the TOP 100 more rich...
something like this...
------------
SELECT TOP 10 char_name as Player,SUM(amount) as Adena
FROM user_data,user_item
WHERE user_data.char_id = user_item.char_id
AND item_type = 57 AND builder = 0 AND warehouse BETWEEN 0 AND 1
GROUP by char_name
ORDER by 2 DESC
------------

Online players ?
-------------------
SELECT TOP 1 world_user
FROM lin2db.dbo.user_count
WHERE (record_time =
(SELECT MAX(record_time)
FROM lin2db.dbo.user_count))



Alliances info
---------------
SELECT pledge.name as Clan,char_name as Lider,alliance.name as Alianza
FROM pledge,user_data,alliance
WHERE user_data.char_id = pledge.ruler_id
AND pledge.alliance_id = alliance.id
AND builder = 0
ORDER by alliance_id

----------------

maybe people who knows a lot of SQL think this querys are very bad, but.. i only learn SQL to use in L2OFF... reading manuals and see examples... i wait help you... i can't share geodatas or others things.. but i can help you with this. :P

user this in ASP or PHP, is very simple, if you need an example to use this in PHP only ask me.
FidoW is offline  
Old 29.01.2006, 21:49   #3
melwidh
Архивный участник
 
Join Date: Oct 2005
Posts: 99
Default

/spanish! Fidow comparte algun PhP aunque sea orientativo, porque no tengo ni idea :S !spanish\
melwidh is offline  
Old 29.01.2006, 21:52   #4
wton
Архивный участник
 
Join Date: May 2005
Posts: 463
Default

"spanish" si es posible seria genial que hicieras eso fidow... en realidad con tanto hex ni siquiera e mirado el php... "spanish"
wton is offline  
Old 30.01.2006, 01:18   #5
Xoleum
Архивный участник
 
Join Date: Jan 2006
Posts: 125
Default

Podrias darme un ejemplo de PHP?
Could you give me an example in PHP?

Gracias
Thank you
Xoleum is offline  
Old 01.02.2006, 02:12   #6
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

ok, aqui tienen, tampoco soy experto en PHP pero aprendo sobre la marcha cuando necesito algo, la verdad es bastante sencillo y la sintaxis es igualita a C++

Con esto mostramos por ejemplo el TOP 10 por nivel...
lo ordeno por exp dado que en el caso de ser de mismo nivel... no los ordenaria correctamente, esto se solventa con ORDER by exp

Un saludo y espero les sirva. El codigo lo he hecho pensando en que les sirva para cualquier consulta que hagan.

PD: Conteste en español ya que parece que todos los interesados lo son xD

[php:1:72d6ff2e71]
<?
$ip="127.0.0.1"; //Aqui la IP de tu server
$user="sa"; //Aqui el user de MS SQL
$pass="default"; //Aqui el password de MS SQL
$db="lin2world"; // Nombre de la base de datos que estamos consultando

$nombrelista="TOP 10 PLAYERS"; // Nombre que daremos a los datos que aparecen
$colortabla1="#AAAAAA"; // Color de la primera fila
$colortabla2="#CCCCCC"; // Color del resto de filas
$anchotabla="150"; // Ancho de la tabla

// La consulta que quieren hacer a la base de datos
$query="SELECT TOP 10 char_name as Player,lev as LVL FROM user_data ";
$query="$query WHERE account_id > 0 AND builder = 0 ";
$query="$query ORDER by exp DESC ";

// A partir de aqui no necesitan tocar nada...
// -------------------------------------------

$conn=mssql_connect($ip,$user,$pass);
mssql_select_db($db, $conn);
$resultado = mssql_query($query);

echo "$nombrelista";
echo "<table width='$anchotabla'>";
echo "<tr bgcolor='$colortabla1'>";

$i=0;
while (mssql_num_fields($resultado)>$i) {
$campo=mssql_field_name($resultado, $i);
echo "<td>$campo</td>";
$i++;
}
echo "</tr>";

$i=0;
while (mssql_num_rows($resultado)>$i) {
$j=0;
echo "<tr bgcolor='$colortabla2'>";
while (mssql_num_fields($resultado)>$j ) {
$data=mssql_result($resultado, $i, $j);
echo "<td>$data</td>";
$j++;
}
echo "</tr>";
$i++;
}

echo "</table>";

$conn=mssql_close();
?>
[/php:1:72d6ff2e71]
FidoW is offline  
Old 01.02.2006, 14:16   #7
melwidh
Архивный участник
 
Join Date: Oct 2005
Posts: 99
Default

Muchas gracias FidoW, ahora mirare de hacer con clanes, allis, dinero, etc etc...
Cash pa ti^^
melwidh is offline  
Old 02.02.2006, 04:32   #8
wton
Архивный участник
 
Join Date: May 2005
Posts: 463
Default

gracias fidows, te pasaste, no tienes algunas otras cosas, como el clan, o algun mapa que muestre la ubicacion, te lo pido porque todo lo otro esta explicado en ingles, y sincermanete el google traduce muy, pero muy mal derrepente :P.. a y cash for you thanks
wton is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:01.