public MySQL_DadosPlayer(playerid)
{
new Str[128];
format(Str,128,"SELECT * FROM contas WHERE nick='%s'",NomePlayer);
mysql_function_query(Conexao, Str, true, "r@MySQL_DadosPlayer", "d", playerid);
return 1;
}
public r@MySQL_DadosPlayer(playerid)
{
new rows,fields;
cache_get_data(rows,fields,Conexao);
if(rows)
{
new temp[30];
cache_get_field_content(0,"dinheiro",temp,Conexao);
PlayerInfo[playerid][pDinheiro] = 2000;//strval(temp);
GivePlayerMoney(playerid, strval(temp));
cache_get_field_content(0,"sexo",temp,Conexao);
PlayerInfo[playerid][pSexo] = strval(temp);
cache_get_field_content(0,"skin",temp,Conexao);
PlayerInfo[playerid][pSkin] = strval(temp);
cache_get_field_content(0,"celular",temp,Conexao);
PlayerInfo[playerid][pCelular] = strval(temp);
cache_get_field_content(0,"level",temp,Conexao);
PlayerInfo[playerid][pLevel] = strval(temp);
cache_get_field_content(0,"horas_jogadas",temp,Conexao);
PlayerInfo[playerid][pHorasJogadas] = strval(temp);
cache_get_field_content(0,"admin",temp,Conexao);
PlayerInfo[playerid][pAdmin] = strval(temp);
cache_get_field_content(0,"spawn",temp,Conexao);
PlayerInfo[playerid][pSpawn] = strval(temp);
cache_get_field_content(0,"dinheiro",temp,Conexao);
PlayerInfo[playerid][pDinheiro] = strval(temp);
GivePlayerMoney(playerid, strval(temp));
}
return 1;
}
new temp[30];
Schocc, ele nгo atribui o valor pego no BD аs variбveis, entende?
|
[00:32:51] >> mysql_connect(localhost, root, xtreme, ******) on port 3306
[00:32:51] CMySQLHandler::CMySQLHandler() - constructor called.
[00:32:51] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "xtreme" | Username: "root"
[00:32:51] CMySQLHandler::Connect() - Connection was successful.
[00:32:51] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[00:32:51] >> mysql_ping( Connection handle: 1 )
[00:32:51] CMySQLHandler::Ping() - Connection is still alive.
[00:33:32] >> mysql_query_callback( Connection handle: 1 )
[00:33:32] Passing query SELECT nick FROM contas WHERE nick='Mutuka_XTreme' LIMIT 1 | d
[00:33:32] ProcessQueryThread(r@MySQL_ChecarConta) - Query was successful. (SELECT nick FROM contas WHERE nick='Mutuka_XTreme' LIMIT
1)
[00:33:32] ProcessQueryThread(r@MySQL_ChecarConta) - Data caching enabled.
[00:33:32] CMySQLHandler::StoreResult() - Result was stored.
[00:33:32] CMySQLHandler::FreeResult() - Result was successfully free'd.
[00:33:32] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:33:32] r@MySQL_ChecarConta(d) - Threaded function called.
[00:33:32] >> cache_get_data( Connection handle: 1 )
[00:33:32] ProcessTick() - The cache has been cleared.
[00:33:37] >> mysql_query_callback( Connection handle: 1 )
[00:33:37] Passing query SELECT * FROM contas WHERE nick='Mutuka_XTreme' AND senha=SHA1('senha') | d
[00:33:37] ProcessQueryThread(r@MySQL_ChecarSenha) - Query was successful. (SELECT * FROM contas WHERE nick='Mutuka_XTreme' AND
senha=SHA1('senha'))
[00:33:37] ProcessQueryThread(r@MySQL_ChecarSenha) - Data caching enabled.
[00:33:37] CMySQLHandler::StoreResult() - Result was stored.
[00:33:37] CMySQLHandler::FreeResult() - Result was successfully free'd.
[00:33:37] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:33:37] r@MySQL_ChecarSenha(d) - Threaded function called.
[00:33:37] >> cache_get_data( Connection handle: 1 )
[00:33:37] >> mysql_query_callback( Connection handle: 1 )
[00:33:37] ProcessTick() - The cache has been cleared.
[00:33:37] Passing query SELECT * FROM contas WHERE nick='Mutuka_XTreme' | d
[00:33:37] ProcessQueryThread(r@MySQL_DadosPlayer) - Query was successful. (SELECT * FROM contas WHERE nick='Mutuka_XTreme')
[00:33:37] ProcessQueryThread(r@MySQL_DadosPlayer) - Data caching enabled.
[00:33:37] CMySQLHandler::StoreResult() - Result was stored.
[00:33:37] CMySQLHandler::FreeResult() - Result was successfully free'd.
[00:33:37] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:33:37] r@MySQL_DadosPlayer(d) - Threaded function called.
[00:33:37] >> cache_get_data( Connection handle: 1 )
[00:33:37] ProcessTick() - The cache has been cleared.
new temp[30];
PlayerInfo[playerid][pSpawn] = strval(temp);
cache_get_field_content(0,"dinheiro",temp,Conexao);
PlayerInfo[playerid][pDinheiro] = strval(temp);
GivePlayerMoney(playerid, strval(temp));
}
else return SendClientMessage(playerid,-1,#Houve um erro ao carregar a DB);
return 1;
}
public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle)
{
printf(#ErrorID:%i,errorid);
switch(errorid)
{
case CR_COMMAND_OUT_OF_SYNC:
{
printf("Commands out of sync for thread ID: %d",resultid);
}
case ER_SYNTAX_ERROR:
{
printf("Something is wrong in your syntax, query: %s",query);
}
}
return 1;
}