[Pedido] Passar de PHP para Pawn.
#1

Como seria o seguinte script em pawn?

PHP код:
<?php
        $conn 
mysql_connect('localhost''root''');
        
mysql_select_db('samp');
        
$query mysql_query("SELECT * FROM `usuarios` ORDER BY Matou DESC LIMIT 10");
        echo 
"<table border = 1 style='font-size : 16px;width:100%;'>";
        echo 
"<tr bgcolor='B0E0E6'>
            <th scope='col'>Nome&nbsp</th>
            <th scope='col'>Matou&nbsp  </th> <th scope='col'>Morreu&nbsp  </th> 
            <th scope='col'>Eagle&nbsp  </th> <th scope='col'>Shotgun&nbsp  </th> 
            <th scope='col'>M4&nbsp  </th> <th scope='col'>Sniper&nbsp  </th> 
            <th scope='col'>Remedios&nbsp  </th> <th scope='col'>Comida&nbsp  </th>
            <th scope='col'>Vida&nbsp  </th> 
            <th scope='col'>Fome&nbsp  </th> <th scope='col'>Sono&nbsp  </th>
            </tr>"
;
        while(
$result mysql_fetch_array($query)) {
        echo 
"<tr bgcolor='CFCFCF'>
            <b><td bgcolor='FFFFFF'>
{$result['Nome']}&nbsp</td>
            <td>
{$result['Matou']}&nbsp</td>
            <td bgcolor='FFFFFF'>
{$result['Morreu']}&nbsp</td> 
            <td>
{$result['Eagle']}&nbsp</td> 
            <td bgcolor='FFFFFF'>
{$result['Shot']}&nbsp</td> 
            <td>
{$result['M4']}&nbsp</td>
            <td bgcolor='FFFFFF'>
{$result['Sniper']}&nbsp</td> 
            <td>
{$result['Remedios']}&nbsp</td> 
            <td bgcolor='FFFFFF'>
{$result['Comida']}&nbsp</td> 
            <td>
{$result['Vida']}&nbsp</td>
            <td bgcolor='FFFFFF'>
{$result['Fome']}&nbsp</td>
            <td>
{$result['Sono']}&nbsp</td></b> 
            </tr>"
;
        }
        echo 
"</table>";
    
?>
Reply
#2

Seria esquisito, levando o fato que nгo iria exibir nada no browser estando rodando no servidor... falta um pouco de sentido nisso nй?
Reply
#3

Como falaram, nгo tem muito sentido... Vocк quer esses dados em um Dialog?
Reply
#4

Nгo era para exibir todos estes dados, era um rank que eu quero fazer tanto pro site como pro jogo.

Porem no jogo so vai aparecer matou e morreu.. Enfim, queria colocar nome, matou, morreu eu uma dialog em ordem decrescente.
Reply
#5

pawn Код:
#include "a_samp"
#include "mysql"

new connectionhandle,
    numrows,
    numfields
;

main()
{
    connectionhandle = mysql_connect("", "", "", "");
    mysql_function_query(connectionhandle, "SELECT * FROM `usuarios` ORDER BY Matou DESC LIMIT 10", true, "sql_receive", "");
}

forward sql_receive(); public sql_receive()
{
    print("Nome  Matou  Morreu  Eagle  Shotgun  M4  Sniper  Remedios  Comida  Vida  Fome  Sono");
   
    static queryresult[12][50];
    cache_get_data(numrows, numfields, connectionhandle);
    for(new ii; ii != numrows; ii++)
    {
        cache_get_field_content(ii, "Nome", queryresult[0], connectionhandle);
        cache_get_field_content(ii, "Matou", queryresult[1], connectionhandle);
        cache_get_field_content(ii, "Morreu", queryresult[2], connectionhandle);
        cache_get_field_content(ii, "Eagle", queryresult[3], connectionhandle);
        cache_get_field_content(ii, "Shot", queryresult[4], connectionhandle);
        cache_get_field_content(ii, "M4", queryresult[5], connectionhandle);
        cache_get_field_content(ii, "Sniper", queryresult[6], connectionhandle);
        cache_get_field_content(ii, "Remedios", queryresult[7], connectionhandle);
        cache_get_field_content(ii, "Comida", queryresult[8], connectionhandle);
        cache_get_field_content(ii, "Vida", queryresult[9], connectionhandle);
        cache_get_field_content(ii, "Fome", queryresult[10], connectionhandle);
        cache_get_field_content(ii, "Sono", queryresult[11], connectionhandle);
        printf("%s - %02i - %02i - %02i - %02i - %02i - %02i - %02i - %02i - %f - %f - %f",
        queryresult[0], queryresult[1], queryresult[2], queryresult[3], queryresult[4], queryresult[5],
        queryresult[6], queryresult[7], queryresult[8], queryresult[9], queryresult[10], queryresult[11]);
    }
    return 0x01;
}
й nessas horas que notamos como pawn й "limitado", boa sorte
Reply
#6

Quote:
Originally Posted by [Y]Falcon
Посмотреть сообщение
pawn Код:
#include "a_samp"
#include "mysql"

new connectionhandle,
    numrows,
    numfields
;

main()
{
    connectionhandle = mysql_connect("", "", "", "");
    mysql_function_query(connectionhandle, "SELECT * FROM `usuarios` ORDER BY Matou DESC LIMIT 10", true, "sql_receive", "");
}

forward sql_receive(); public sql_receive()
{
    print("Nome  Matou  Morreu  Eagle  Shotgun  M4  Sniper  Remedios  Comida  Vida  Fome  Sono");
   
    static queryresult[12][50];
    cache_get_data(numrows, numfields, connectionhandle);
    for(new ii; ii != numrows; ii++)
    {
        cache_get_field_content(ii, "Nome", queryresult[0], connectionhandle);
        cache_get_field_content(ii, "Matou", queryresult[1], connectionhandle);
        cache_get_field_content(ii, "Morreu", queryresult[2], connectionhandle);
        cache_get_field_content(ii, "Eagle", queryresult[3], connectionhandle);
        cache_get_field_content(ii, "Shot", queryresult[4], connectionhandle);
        cache_get_field_content(ii, "M4", queryresult[5], connectionhandle);
        cache_get_field_content(ii, "Sniper", queryresult[6], connectionhandle);
        cache_get_field_content(ii, "Remedios", queryresult[7], connectionhandle);
        cache_get_field_content(ii, "Comida", queryresult[8], connectionhandle);
        cache_get_field_content(ii, "Vida", queryresult[9], connectionhandle);
        cache_get_field_content(ii, "Fome", queryresult[10], connectionhandle);
        cache_get_field_content(ii, "Sono", queryresult[11], connectionhandle);
        printf("%s - %02i - %02i - %02i - %02i - %02i - %02i - %02i - %02i - %f - %f - %f",
        queryresult[0], queryresult[1], queryresult[2], queryresult[3], queryresult[4], queryresult[5],
        queryresult[6], queryresult[7], queryresult[8], queryresult[9], queryresult[10], queryresult[11]);
    }
    return 0x01;
}
й nessas horas que notamos como pawn й "limitado", boa sorte
Tentei fazer isso porem nгo deu muito certo..
Fiz um top 5 somente dos players que estгo online.
Como vocк disse, o pawn й muito limitado

Abraзos e obrigado pela ajuda.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)