mysql errors
#1

hi everybody i have some errors when i do this code :
PHP код:
public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    
mysql_log(LOG_ALL); // Crйe les logs des Debugs, avertissements et erreurs.
    
mysql mysql_connect(MYSQL_HOSTMYSQL_COMPTEMYSQL_BDDMYSQL_MDP); // Connecte le serveur a la base de donnйes
    
if(mysql_errno() != 0// verifie si la connection a йtй rйussite
    
{
        
printf("[MySQL] Connection ratйe!");
    }
    else
    {
        
printf("[MySQL] Connection rйussie!");
    }
    return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
    
TogglePlayerSpectating(playeridtrue);
    new 
requete[128], nom[24];
    
GetPlayerName(playeridnomsizeof(nom));
    
mysql_format(mysqlrequetesizeof(requete), "SELECT `Mot De Passe`, `ID` FROM `comptes` WHERE `Nom` = '%e' LIMIT 1"nom);
    
mysql_tquery(mysqlrequete"VerificationCompte""i"playerid);

PHP код:
forward VerificationCompte(playerid);
public 
VerificationCompte(playerid)
{
    new 
ligneschamps;
    
cache_get_data(ligneschampsmysql); // Assigne le nombre de lignes et champs trouver aprиs notre requete dans "OnPlayerConnect"
    
if(lignes// Si la ligne qui correspond a notre requete existe
    
{
    
cache_get_field_content(0"MDP"iJoueur[playerid][MDP], mysql66); // Transfиre le contenu de MDP de notre BDD et l'assigne а iJoueur[playerid][MDP]
    
iJoueur[playerid][ID] = cache_get_field_content_int(0"ID"); // Transfиre le contenu de ID de notre BDD et l'assigne а iJoueur[playerid][ID]
    
ShowPlayerDialog(playeridDialogConnectionDIALOG_STYLE_PASSWORD"Connection...""Tapez votre mot de passe pour vous connecter""Connecter""Quitter"); // On lui montre le dialogue de connection.
    
}
    else 
// Si elle n'existe pas
    
{
    
ShowPlayerDialog(playeridDialogInscriptionDIALOG_STYLE_INPUT"Inscription...""Tapez un mot de passe pour inscrire ce compte.""S'inscrire""Quitter"); // On lui montre le dialogue d'inscription
    
}

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DialogInscription:
        {
        if(!
response) return Kick(playerid); // Si le joueur clique sur "Quitter" on va la Kicker du serveur
        
if(strlen(inputtext) < 5// Si le MDP insйrй fais moins de 5 charactиres
        
{
            
SendClientMessage(playerid, -1"Votre mot de passe doit contenir au moins 5 charactиres"); // On lui envoye un message disant que le MDP doit contenir au moins 5 charactиres.
            
ShowPlayerDialog(playeridDialogInscriptionDIALOG_STYLE_INPUT"Inscription...""Tapez un mot de passe pour inscrire ce compte.""S'inscrire""Quitter"); // On lui remontre le dialogue.
        
}
        else 
// Si le MDP insйrй contient au moins 5 charactиres
        
{
            new 
requete[512], hashpass[64+1], Nom[24];
            
GetPlayerName(playeridNomsizeof(Nom));
            
SHA256_PassHash(inputtext"ADAWAD11AWD41ASDA2L222KDH"hashpasssizeof(hashpass));
            
mysql_format(mysqlquerysizeof(query), "INSERT INTO `comptes` (`Nom`, `Mot De Passe`) VALUES ('%e', '%e')"Nomhashpass);
            
mysql_tquery(mysqlquery"CreationCompte""i"playerid);
        }
        case 
DialogConnection:
        {
            if(!
response) return Kick(playerid); // Si le joueur appuie sur "Quitter" on le Kick du serveur.
            
new hashpass[64+1];
            
SHA256_PassHash(inputtext"ADAWAD11AWD41ASDA2L222KDH"HashMDPsizeof(HashMDP));
            if(!
strcmp(HashMDPiJoueur[playerid][MDP], true)) // Si le MDP insйrй est йgal au MDP de la BDD
        
{
            new 
requete[100];
            
mysql_format(mysqlrequetesizeof(requete), "SELECT * FROM `comptes` WHERE `Nom` = '%e' LIMIT 1"Nom); // On prend la ligne ou le nom est йgal au nom du joueur
            
mysql_tquery(mysqlrequete"ChargerCompte""i"playerid); // On envoye la requete.
        
}
        else 
// Si le MDP insйrй n'est pas йgal au MDP de la BDD
        
{
        
SendClientMessage(playerid, -1"Mot de passe incorrect, essayer encore!"); // On envoie le message disant que le MDP est incorrect!
        
ShowPlayerDialog(playeridDialogConnectionDIALOG_STYLE_PASSWORD"Connection...""Tapez votre mot de passe pour vous connecter""Connecter""Quitter"); // On lui remontre le dialogue
        
}
    }
    return 
1;

i don't know why it's making me errors
Код:
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(33) : error 017: undefined symbol "mysql_log"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(64) : error 035: argument type mismatch (argument 3)
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(65) : error 017: undefined symbol "mysql_tquery"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(75) : warning 202: number of arguments does not match definition
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(76) : error 017: undefined symbol "cache_get_field_content_int"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(99) : warning 219: local variable "Nom" shadows a variable at a preceding level
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(100) : error 035: argument type mismatch (argument 2)
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(100) : error 035: argument type mismatch (argument 2)
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(101) : error 017: undefined symbol "SHA256_PassHash"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(101) : warning 202: number of arguments does not match definition
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(102) : error 017: undefined symbol "query"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(102) : error 017: undefined symbol "query"
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(102) : error 029: invalid expression, assumed zero
C:\Users\mickael\Desktop\Script Pour Friends\gamemodes\MainGamemode.pwn(102) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
thank for the help
Reply
#2

You have a global array called Nom, so you can't make a new local one.
Just change its name.

undefined symbol "query"
You aren't creating an array called query there.
Reply
#3

Which Version of MySQL are you using in your .inc and plugin?
Reply
#4

Stinged it's not working at all
GTLS i use the latest build
Reply
#5

You may have loaded the latest version of the mysql plugin but the include you're trying to compile the script with is an older version. Re-download it and update the include (plugin file and libmysql.dll for windows as well, just to be sure you won't run into problem on loading the correct version).
Reply
#6

i don't know how to do with libmysql.dll ?
Reply
#7

I mentioned the reason why you get the errors for the mysql stuff while compiling:

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You may have loaded the latest version of the mysql plugin but the include you're trying to compile the script with is an older version. Re-download it and update the include (plugin file and libmysql.dll for windows as well, just to be sure you won't run into problem on loading the correct version).
libmysql.dll is needed for the plugin to load on Windows and thus it should be located in the main folder samp-server.exe is located. Just that, nothing else.

I also just now noticed (I somehow missed that before) that it gives SHA256_PassHash as undefined which the function was added in 0.3.7 R1 so you will have to update the samp include and executable files as well for it to work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)