[Ajuda] De PHP para Pawn
#1

Fala galera, beleza?
Bom, estou aprendendo MySQL no Pawn, e quero aprender uma coisa. Entendo bastante de PHP, e quero fazer em Pawn, isso:

PHP код:
$consulta mysql_query("SELECT * FROM tabela WHERE id=1");
$PLAYER mysql_fetch_array($consulta);
$sexo $PLAYER['sexo_player'];
$skin $PLAYER['skin']; 
Desde jб agradeзo! Abraзos!
Reply
#2

pawn Код:
mysql_function_query(/* variavelconexao */,"SELECT * FROM tabela WHERE id=1",true,"PegarResultado","i",playerid);

forward PegarResultado(playerid);
public PegarResultado(playerid)
{
    new rows,fields;
    cache_get_data(rows,fields);
    if(rows)
    {
        new temp[30];
        cache_get_field_content(0,"sexo_player",temp),/* variavelsexo */ = strval(temp);
        cache_get_field_content(0,"skin",temp),/* variavelskin */ = strval(temp);
    }
    return 1;
}

Acho que й isto fiz rapidгo aqui.
Reply
#3

Amigo, olha os erros que deu:
pawn Код:
error 017: undefined symbol "cache_get_data"
error 017: undefined symbol "cache_get_field_content"
Reply
#4

Quote:
Originally Posted by Mutuka_XTreme
Посмотреть сообщение
Amigo, olha os erros que deu:
pawn Код:
error 017: undefined symbol "cache_get_data"
error 017: undefined symbol "cache_get_field_content"
Galera, por favor, me ajudem. Preciso muito disso, e nгo entendi muito bem ;/
Reply
#5

Ta usando mysql R8?
Reply
#6

Cara, acho que sim :X
Reply
#7

Verifica ae,a include e o plugin certim,porque acho que nгo!
Reply
#8

Amigo, й o R6-2.

tem uma forma melhor? a forma que eu tф usando nгo dб certo.

minha OnPlayerRequestClass:

pawn Код:
public OnPlayerRequestClass(playerid)
{
    new query[300], pname[24]/*, SkinBD[2]*/;
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT * FROM contas WHERE nick = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        PegaBD(playerid);    
    }
    mysql_free_result();

   
   
    return 1;
}
a funзгo PegaBD(playerid):
pawn Код:
public PegaBD(playerid)
{
    new temp[30];
   

    mysql_fetch_field_row(temp, "idade");  format(PlayerInfo[playerid][pIdade], 3, temp);
    mysql_fetch_field_row(temp, "sexo");  format(PlayerInfo[playerid][pSexo], 3, temp);
    mysql_fetch_field_row(temp, "pais");  format(PlayerInfo[playerid][pPais], 3, temp);
    mysql_fetch_field_row(temp, "idioma");  format(PlayerInfo[playerid][pIdioma], 3, temp);
    mysql_fetch_field_row(temp, "skin");  format(PlayerInfo[playerid][pSkin], 3, temp);
    mysql_fetch_field_row(temp, "skin_sec");  format(PlayerInfo[playerid][pSkinSec], 3, temp);
    mysql_fetch_field_row(temp, "dinheiro");  format(PlayerInfo[playerid][pDinheiro], 3, temp); GivePlayerMoney(playerid, PlayerInfo[playerid][pDinheiro]);
    mysql_fetch_field_row(temp, "celular");  format(PlayerInfo[playerid][pCelular], 3, temp);
    mysql_fetch_field_row(temp, "level");  format(PlayerInfo[playerid][pLevel], 3, temp);
    mysql_fetch_field_row(temp, "horas_jogadas");  format(PlayerInfo[playerid][pHorasJogadas], 11, temp);
    mysql_fetch_field_row(temp, "admin"); format(PlayerInfo[playerid][pAdmin], 1, temp);
    mysql_fetch_field_row(temp, "spawn"); format(PlayerInfo[playerid][pSpawn], 3, temp);

    return 1;
}
Reply
#9

https://sampforum.blast.hk/showthread.php?tid=299675 - Veja este tуpico ira ajudar a fazer seu sistema.
Reply
#10

Cara, eu jб vн, e nгo me ajudou muito ;/

Atualizei a minha include e meu plugin pra R8, e tб dando esse erro agora:

pawn Код:
error 017: undefined symbol "mysql_query"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)