MySql errors
#1

Hello guys, im started learning MySql and watched ******* video, but i got some errors.
Код:
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(46) : error 035: argument type mismatch (argument 1)
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(47) : error 017: undefined symbol "mysql_store_result"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(49) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(241) : error 035: argument type mismatch (argument 1)
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(242) : error 017: undefined symbol "mysql_store_result"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(244) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\fun.pwn(263) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
And the code is here: (It's in estonia, sorry )
pawn Код:
// MySql Fun Gamemode

#include <a_samp>
#include <sscanf>
#include <a_mysql>

#define SCM SendClientMessage

#define DIALOG_LOGI 0
#define DIALOG_REGA 1

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    mysql_connect("localhost", "root", "Fun", "");
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    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 OnPlayerConnect(playerid)
{
    new query[126], lause[100], nimi[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nimi, sizeof(nimi));
   
    format(query, sizeof(query), "SELECT * FROM kasutajad WHERE nimi = '%s'", nimi);
    mysql_query(query);
    mysql_store_result();
   
    if(mysql_num_rows() == 1)
    {
        SCM(playerid, -1, "[ANDMEBAAS]: Selline kasutaja on meie andmebaasis kirjas! Palun logi sisse!");
        format(lause, sizeof(lause), "Tere tulemast tagasi, %s!\n\nTeie kasutaja on meie andmebaasis kirjas, palun logige sisse!", nimi);
        ShowPlayerDialog(playerid, DIALOG_LOGI, DIALOG_STYLE_PASSWORD, "Fun Server",lause,"Logi sisse","Lahku");
    }
    else
    {
        SCM(playerid, -1, "[ANDMEBAAS]: Selline kasutaja ei ole meie andmebaasis kirjas! Palun registreeri!");
        format(lause, sizeof(lause), "Tere tulemast fun serverisse, %s!\n\nTeie kasutaja ei ole meie andmebaasis kirjas, palun registreerige!", nimi);
        ShowPlayerDialog(playerid, DIALOG_REGA, DIALOG_STYLE_PASSWORD, "Fun Server",lause,"Registreeri","Lahku");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 0:
        {
            if(response)
            {
                new query[126], nimi[MAX_PLAYER_NAME];
                GetPlayerName(playerid, nimi, sizeof(nimi));
               
                format(query, sizeof(query), "SELECT * FROM kasutajad WHERE nimi = '%s' AND parool = '%s'", nimi, inputtext);
                mysql_query(query);
                mysql_store_result();
               
                if(mysql_num_rows() == 1)
                {
                    SCM(playerid, -1, "[SERVER]: Sa oled edukalt sisse logitud!");
                }
                else
                {
                    SCM(playerid, -1, "[SERVER]: Sa kirjutasid vigase parooli!");
                    ShowPlayerDialog(playerid, DIALOG_LOGI, DIALOG_STYLE_PASSWORD, "Fun Server","Sa kirjutasid vigase parooli!\n\nProovi uuesti!","Logi sisse","Lahku");
                }
            }
        }
        case 1:
        {
            if(response)
            {
                new query[126], nimi[MAX_PLAYER_NAME];
                GetPlayerName(playerid, nimi, sizeof(nimi));

                format(query, sizeof(query), "INSERT INTO kasutajad VALUES ('%s', '%s')", nimi, inputtext);
                mysql_query(query);

                SCM(playerid, -1, "[SERVER]: Sinu kasutaja on edukalt registreeritud!");
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#2

Which version of MySql are you using and which version of MySql is the video poster using? They might be different which is why your functions aren't working.
Reply
#3

Quote:
Originally Posted by Blast3r
Посмотреть сообщение
Which version of MySql are you using and which version of MySql is the video poster using? They might be different which is why your functions aren't working.
Hmm i don't know what version the video poester uses... But i use R39-2.
Reply
#4

Quote:
Originally Posted by finelaq
Посмотреть сообщение
Hmm i don't know what version the video poester uses... But i use R39-2.
Yeah, I'm guessing the video is pretty old, which is why I tend to avoid video tutorials, I'd suggest you trying this tutorial tho:

https://sampforum.blast.hk/showthread.php?tid=485633


It helped me a lot when I was learning MySql myself.
Reply
#5

Quote:
Originally Posted by Blast3r
Посмотреть сообщение
Yeah, I'm guessing the video is pretty old, which is why I tend to avoid video tutorials, I'd suggest you trying this tutorial tho:

https://sampforum.blast.hk/showthread.php?tid=485633


It helped me a lot when I was learning MySql myself.
Hmm okay, i will try that, thanks.
Reply
#6

umm now i have no errors, but i need libmysql.dll R39-2 version, where i get that?
And when i start server then he says that:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[22:15:49] filterscripts = ""  (string)
[22:15:49] 
[22:15:49] Server Plugins
[22:15:49] --------------
[22:15:49]  Loading plugin: mysql
[22:15:50]   Failed.
[22:15:50]  Loaded 0 plugins.

[22:15:51] 
[22:15:51] Filterscripts
[22:15:51] ---------------
[22:15:51]   Loaded 0 filterscripts.

[22:15:51] Script[gamemodes/gm.amx]: Run time error 19: "File or function is not found"
[22:15:51] Number of vehicle models: 0
Reply
#7

The libmysql should be included in the mysql package itself, check the github.

The Run time error 19 is usually called by a missing plugin, and I think that in this case it's the MySql one.
Reply
#8

Quote:
Originally Posted by Blast3r
Посмотреть сообщение
The libmysql should be included in the mysql package itself, check the github.

The Run time error 19 is usually called by a missing plugin, and I think that in this case it's the MySql one.
Okay, now i have libmysql.dll put i didn't get mysql.dll, i get mysql.pdb, and still say run time error 19.

E: Sorry, my bad i get mysql.dll and now he loads the mysql but it still say run time error 19.
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[22:46:08] filterscripts = ""  (string)
[22:46:08] 
[22:46:08] Server Plugins
[22:46:08] --------------
[22:46:08]  Loading plugin: mysql.dll
[22:46:08]  >> plugin.mysql: R39-2 successfully loaded.
[22:46:08]   Loaded.
[22:46:08]  Loaded 1 plugins.

[22:46:09] 
[22:46:09] Filterscripts
[22:46:09] ---------------
[22:46:09]   Loaded 0 filterscripts.

[22:46:09] Script[gamemodes/gm.amx]: Run time error 19: "File or function is not found"
[22:46:09] Number of vehicle models: 0
Reply
#9

Do you have the Whirlpool plugin, because the tutorial uses Whirlpool too. And use mysql.dll in plugins, if you're using Windows and not linux that is.

EDIT: make sure to put the libmysql in the default folder itself and not into the plugins.
Reply
#10

Quote:
Originally Posted by Blast3r
Посмотреть сообщение
Do you have the Whirlpool plugin, because the tutorial uses Whirlpool too. And use mysql.dll in plugins, if you're using Windows and not linux that is.

EDIT: make sure to put the libmysql in the default folder itself and not into the plugins.
OK, i added Whirlpool and now worked fine, thank you. +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)