[Ajuda] Mysql nao sala conta
#1

Bom galera eu fiz estй codigo mais nao ta salvando alguem sabe oq e ?

pawn Код:
#include <a_samp>
#include <a_mysql>


#pragma tabsize 4

#define SCM SendClientMessage
#define ASVEX AddStaticVehicleEx
#define SRC SendRconCommand

new connectt;


main()
{
    print("---------Carregando----------");
}


public OnGameModeInit()
{
    SetGameModeText("Basic");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    ASVEX(520,2028.6824,1340.5647,10.8203,268.5515,0,0,0);
    connectt = mysql_connect("localhost", "root", "brasil world start", "");
    if(!mysql_ping(connectt)) print("carregado mysql..."), SRC("exit");
   
    return 1;
}

forward Qualfoi(playerid);
public Qualfoi(playerid)
{
   new Str[128], nome[21];
   GetPlayerName(playerid, nome, 21);
   format(Str, 128, "SELECT * FROM `contas` WHERE `Nome`='%s'", nome);
   mysql_function_query(connectt, Str, true, "OnPlayerConnect", "i", playerid);


   return 1;
}

public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
   printf("%i %s %s %s %i", errorid, error, callback, query, connectionHandle);
   return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/grana", cmdtext, true, 10) == 0)
  {
    GivePlayerMoney(playerid, 50000000);
    SCM(playerid, -1, "Vocк ganhou grana .");
    return 1;
  }
  if (strcmp("/Box", cmdtext, true, 10) == 0)
  {
  SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
  SCM(playerid, -1, "Vocк mudou seu estilo de luta !");
  return 1;
  }
  return 0;
}

public OnPlayerConnect(playerid)
{
   new Row, Field;


   cache_get_data(Row, Field, connectt);

   if(Row) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "LOGIN", "Digite sua senha", "Logar", "Sair");
   else ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Registre-se", "Digite sua senha", "Registrar", "Sair");
   return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if(dialogid) {
      new Str[222], nome[21];
      GetPlayerName(playerid, nome, 20);
      format(Str, 222, "INSERT INTO `contas`(`Nome`, `Senha`, `Level`, `Admin`, `Respeito`, `Org`, `Membro`) VALUES ('%s', '%i', '%i', '%i', '%i', '%i', '%i')", nome, hash(inputtext), 10, 8, 150, 2, 1);
      mysql_function_query(connectt, Str, false, #, #);
      SCM(playerid, -1, "Registrado com sucesso!");
   }
   else {
      new Str[222], nome[21];
      GetPlayerName(playerid, nome, 20);
      format(Str, 222, "SELECT * FROM `contas` WHERE `Nome`='%s' AND `Senha`'%i'", nome, hash(inputtext));
      mysql_function_query(connectt, Str, true, "zabu", "i", playerid);
   }
   return 1;
}

forward zabu(playerid);
public zabu(playerid)
{
   new Row, Field;
   cache_get_data(Row, Field, connectt);
   
   if(Row) SCM(playerid, -1, "Logado com sucesso!");
   else ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "LOGIN", "Senha Incorreta", "Logar", "Sair");

   return 1;
}



Esse Sala era Salva *
Reply
#2

Salvando vocк quis dizer criando a conta?
Reply
#3

yeah
Reply
#4

Coloque:
pawn Код:
connectt = mysql_connect("localhost", "root", "brasil world start", "");
if(!mysql_ping(connectt)) print("carregado mysql..."), SRC("exit");
mysql_debug(1);
E olhe o mysql_log e veja o erro e poste aqui.
Reply
#5

ja tinha feito isso antes ai olhei o log ...


Quote:

[23:14:20] 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''103040'' at line 1 zabu SELECT * FROM `contas` WHERE `Nome`='Gaba_aa' AND `Senha`'103040' 1
[23:14:41] [part] Gaba_aa has left the server (0:0)

E Mais ou menos nessa linha aqui .....

Quote:

mysql_function_query(connectt, Str, true, "zabu", "i", playerid);

Reply
#6

Tente

pawn Код:
format(Str, 128, "SELECT * FROM `contas` WHERE `Nome`='%s' AND `Senha` = %i", nome, hash(inputtext));
Reply
#7

Nгo eu editei e estб normal o error estб ali amigo !
Reply
#8

pawn Код:
mysql_function_query(connectt, Str, true, "zabumbameuboi", "i", playerid);
Reply
#9

Mano Eu editei troquei algumas coisas entгo vou editar aqui -.-

#editado !!!
Reply
#10

Mals o Doble mais alguem pode me ajudar ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)