SA-MP Forums Archive
MySQL save account problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL save account problem (/showthread.php?tid=491714)



MySQL save account problem - BuggedPlayer - 31.01.2014

Hi, the accounts didn't save in the database why?? This is my OnDialogReponse:

pawn Code:
if(dialogid == DIALOG_REGISTER)
    {
        if(!response)
        {
            SendClientMessage(playerid, COLOR_DARKRED, "Ai primit kick pentru ca nu ai introdus nicio parola.");
            Kick(playerid);
        }
        if(response)
        {
            if(strlen(inputtext) <= 4)
            {
                new pName[24];
                new string[164];
                GetPlayerName(playerid, pName, 24);
                SendClientMessage(playerid, COLOR_DARKRED, "Parola ta trebuie sa fie mai mare de 4 caractere.");
                format(string, sizeof(string), "Welcome to the server, %s!\nPlease enter your paassword to register!", pName);
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", string, "Register", "Cancel");
            }
            else
            {
                new EscapedText[60];
                new Query[80];
                new pName[24];
                GetPlayerName(playerid, pName, 24);
                mysql_real_escape_string(inputtext, EscapedText);
                format(Query, sizeof(Query), "INSERT INTO `conturi` (Password, Username, Level, AdminLevel, Job, HelperLevel, Money) VALUES ('%s', '%s', 1, 0, 0, 0, 10000)", EscapedText, pName);
                mysql_query(Query);
                GivePlayerMoney(playerid, 10000);
                SetPlayerScore(playerid, 1);
                SetPlayerColor(playerid, COLOR_WHITE);
                SpawnPlayer(playerid);
                SendClientMessage(playerid, COLOR_YELLOW, "Bine ai venit pe Flame RPG.");
                SendClientMessage(playerid, COLOR_YELLOW, "Daca ai nevoie de ajutor foloseste /n si un helper te va ajuta.");
                SendClientMessage(playerid, COLOR_YELLOW, "Foloseste /help pentru a vedea o lista cu comenzile server-ului.");
                SendClientMessage(playerid, COLOR_YELLOW, "Daca ai o problema tehnica foloseste /report si un admin te va ajuta.");
            }
        }
    }



Re: MySQL save account problem - Konstantinos - 31.01.2014

Do you mean that it doesn't insert into the database? The query is not large enough to store the whole text and it fails.

Change to:
pawn Code:
new Query[270];



Re: MySQL save account problem - BuggedPlayer - 01.02.2014

Thanks very much!