Tried to upgrade from dini to MySQL - Tons and tons of errors
#1

Hello I trying to update my server from Dini to MySQL (so you can register from the website as well) but when I try to compile the script it gives an absolute ton of errors. I have absolutely no idea why it does so. I checked every line of code that I modified but I just can't find the problem

Here's a bit of code:

OnPlayerConnected login part
pawn Code:
new pname[MAX_PLAYER_NAME], Query[200];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(IsPlayerNPC(playerid)) return 1;
    format(Query,sizeof(Query),"SELECT `Username` FROM `Players` WHERE `Username` = '%s' LIMIT 1;",pName); // Line 1940
    mysql_query(Query); // Line 1941
    mysql_store_result(); // Line 1942
    new logstring[256],d2,m2,y2,h2,mi2,s2,logstring5[256];
    gettime(h2,mi2,s2);
    getdate(y2,m2,d2);
    new plrIP[16];
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));
    format(logstring5,sizeof(logstring5),"%d/%d/%d %d:%d:%d %s connected [%s]",d2,m2,y2,h2,mi2,s2,pname,plrIP);
    Log(logstring5);
    if(mysql_num_rows() != 0) // Line 1500
    {
        LoadStats(playerid);
        new d,m,y,h,mi,s;
        getdate(y,m,d);
        gettime(h,mi,s);
        if(pInfo[playerid][Banned] == 1)
        {
            if((d>pInfo[playerid][BanExp] && m>=pInfo[playerid][BanM] && y>=pInfo[playerid][BanY]) || (d>pInfo[playerid][BanExp] && m==pInfo[playerid][BanM]) || (m>pInfo[playerid][BanM] || y>pInfo[playerid][BanY]) || (d==pInfo[playerid][BanExp] && m==pInfo[playerid][BanM] && y==pInfo[playerid][BanY] && h>=pInfo[playerid][BanHour] && mi>=pInfo[playerid][BanMin]))
            {
                pInfo[playerid][Banned] = 0;
                pInfo[playerid][BanExp] = 0;
                pInfo[playerid][BanM] = 0;
                pInfo[playerid][BanY] = 0;
                pInfo[playerid][BanHour] = 0;
                pInfo[playerid][BanMin] = 0;
            }
        }
        if(pInfo[playerid][Banned] == 1)
        {
            new gametext[64];
            format(gametext,sizeof(gametext),"~w~Your account is~r~ banned");
            GameTextForPlayer(playerid,gametext,8000,1);
            format(logstring,sizeof(logstring),"%d/%d/%d %d:%d:%d %s tryed to login, but he's banned",d,m,y,h,mi,s,pname);
            Log(logstring);
            new string5[256];
            format(string5,sizeof(string5),"The ban will expire on %d/%d/%d la ora %d:%d",pInfo[playerid][BanExp],pInfo[playerid][BanM],pInfo[playerid][BanY],pInfo[playerid][BanHour],pInfo[playerid][BanMin]);
            SCM(playerid,COLOR_LIGHTBLUE,string5);
            SetTimerEx("TimeKick",500,false,"i",playerid);
        }
        else
        {
            ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD, "Login", "{FFFF00}Welcome to RPGR!\nEnter your password below to login:{FFFFFF}", "Login", "Quit");
            JustConnected[playerid]=1;
        }
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_INPUT, "Register", "{FFFF00}Welcome to RPGR!\nEnter a password in order to register:{FFFFFF}", "Register", "Quit");
        JustConnected[playerid]=0;
    }
Register dialog:
pawn Code:
case DIALOG_REGISTER4:
        {
            if(!response)
            {
                dini_Remove(path);
                Kick(playerid);
            }
            else
            {
                new playername[MAX_PLAYER_NAME];
                GetPlayerName(playerid,playername,sizeof(playername));
                new PEscapedText[60];
                new buf[145];
                WP_Hash(buf,sizeof(buf),pInfo[playerid][Password]);
                mysql_real_escape_string(buf,PEscapedText);
                new EEscapedText[60],Query[256];
                mysql_real_escape_string(inputtext, EEscapedText); // Line 10194
                format(Query,sizeof(Query),"INSERT INTO `Players` (Username,Password,Email,Banned,Money,Bulletin,Sex,Age,Faction,Rank,Jailed,JailTime,Arrests,Wanted,Deaths,Crimes,Level,RP,BankMoney,RobTool,HouseOwned,CarOwned,Fishes,Job,Clothes,Phonebook,Phone,PhoneCredit,PhoneNumber,Ceas,Momeala,GPS,TimePlayed,Hours,Radio,TimeLeftUntilQuitjob,PayDayMoney,PremiumAccount,TrainTickets,Bombs,Warns,BanExp,BanM,BanY,BanHour,BanMin,PermisAuto,PermisAvion,PermisBarca,PermisArma,PermisPescuit,Ticket,Dice,UDM,BizID,Materials,Drugs,posX,posY,posZ,Interior,VirtualWorld) VALUES ('%s','%s,'%s','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')",playername,PEscapedText,EEscapedText,0,250,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0); // Line 10195
                mysql_query(Query);
                ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD, "Login", "{FFFF00}Bine ai revenit pe Romania RPG!\nIntroduce-ti parola mai jos pentru a te loga:{FFFFFF}", "Login", "Quit");
            }
        }
And the LoadStats stock:
pawn Code:
stock LoadStats(playerid)
{
    new pName[24],Query[100];
    GetPlayerName(playerid,pName,24);
    format(Query, sizeof(Query), "SELECT * FROM `Players` WHERE `Username` = '%s' ", pName);
    mysql_query(Query); // Line 416
    mysql_store_result(); // Line 417
    mysql_fetch_row_format(Query, "|"); // Line 418
    sscanf(Query, "e<p<|>s[24]s[50]s[50]iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifffii>", pInfo[playerid]); // Line 419
    mysql_free_result(); // Line 420
    return 1;
}
And, of course, the errors
Code:
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(416) : error 035: argument type mismatch (argument 1)
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(417) : error 017: undefined symbol "mysql_store_result"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(418) : error 017: undefined symbol "mysql_fetch_row_format"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(419) : error 017: undefined symbol "pInfo"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(420) : error 017: undefined symbol "mysql_free_result"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(1490) : error 017: undefined symbol "pName"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(1491) : error 035: argument type mismatch (argument 1)
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(1492) : error 017: undefined symbol "mysql_store_result"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(1500) : error 017: undefined symbol "mysql_num_rows"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(10194) : error 075: input line too long (after substitutions)
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(10195) : error 037: invalid string (possibly non-terminated string)
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(10195) : error 017: undefined symbol "INSERT"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(10195) : error 017: undefined symbol "INTO"
D:\Scripting\SAMP\Green Country RP\gamemodes\mysql error gm.pwn(10195) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


14 Errors.
PS: I know that query is waaaay too long. I know I have to split it but I forgot how
Some help please? Thanks
Reply
#2

You are using an older version of MySQL (R5 / R6 (non-threaded))
You have to get the most appropriate include & plugin and then try to compile it.
Reply
#3

Quote:
Originally Posted by biker122
View Post
You are using an older version of MySQL (R5 / R6 (non-threaded))
You have to get the most appropriate include & plugin and then try to compile it.
Thanks for the fast response, but I'm using the latest version (R39). I looked for the older version that supports non-threaded scripts, but I just can't find it
Reply
#4

I've attached a copy of R5 plugin and include. I use a non-threaded script so this should do the job just fine.
Reply
#5

Quote:
Originally Posted by dazman14
View Post
I've attached a copy of R5 plugin and include. I use a non-threaded script so this should do the job just fine.
THANK YOU! I looked in all threads about mysql but I couldn't find it! Thanks once again
Reply
#6

Quote:
Originally Posted by Vlad64
View Post
THANK YOU! I looked in all threads about mysql but I couldn't find it! Thanks once again
Your welcome
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)