[Plugin] [REL] MySQL Plugin (Now on github!)

iReacher take a look at this thread and last post:
https://sampforum.blast.hk/showthread.php?tid=354068&page=2
Reply

@Baltimore : cache_get_row(row_index (starts at 0), field_index (starts at 0), destination[], size (default = sizeof destination));

There is also a macro for integers (cache_get_row_int(row_index, field_index) ) and one for floating point numbers (cache_get_row_float(row_index, field_index)). Both of the macros returns directly what they got in the field.
Reply

where can we use this properly for?
what is the main reason of downloading this?
Reply

I need the R7 32 bit version, but the wonderful download links are dead.
Reply

help me with old plugin to yours

This All Error By Old Plugin, Im changed new plugin for adding register login function

PHP код:
F:\COD\gamemodes\v5.8(mysql).pwn(1350) : warning 206redundant testconstant expression is non-zero
F
:\COD\gamemodes\v5.8(mysql).pwn(1350) : warning 215expression has no effect
F
:\COD\gamemodes\v5.8(mysql).pwn(1351) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(1352) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(1355) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(13930) : warning 213tag mismatch
F
:\COD\gamemodes\v5.8(mysql).pwn(13933) : warning 213tag mismatch
F
:\COD\gamemodes\v5.8(mysql).pwn(14062) : error 075input line too long (after substitutions)
F:\COD\gamemodes\v5.8(mysql).pwn(14282) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(14284) : error 017undefined symbol "mysql_store_result"
F:\COD\gamemodes\v5.8(mysql).pwn(14285) : error 017undefined symbol "mysql_num_rows"
F:\COD\gamemodes\v5.8(mysql).pwn(14292) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(21238) : warning 213tag mismatch
F
:\COD\gamemodes\v5.8(mysql).pwn(21259) : warning 213tag mismatch
F
:\COD\gamemodes\v5.8(mysql).pwn(21260) : warning 213tag mismatch
F
:\COD\gamemodes\v5.8(mysql).pwn(32781) : error 035argument type mismatch (argument 1)
F:\COD\gamemodes\v5.8(mysql).pwn(32782) : error 017undefined symbol "mysql_store_result"
F:\COD\gamemodes\v5.8(mysql).pwn(32784) : error 017undefined symbol "mysql_num_rows"
F:\COD\gamemodes\v5.8(mysql).pwn(32787) : error 017undefined symbol "mysql_fetch_row_format"
F:\COD\gamemodes\v5.8(mysql).pwn(32789) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32790) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32791) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32792) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32793) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32794) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32795) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32796) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32797) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32798) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32799) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32800) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32801) : error 017undefined symbol "mysql_fetch_field_row"
F:\COD\gamemodes\v5.8(mysql).pwn(32802) : error 017undefined symbol "mysql_fetch_field_row"

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


26 Errors

1350 - 1355 Line
pawn Код:
mysql_connect(CLANHOST,CLANUSER,CLANDB,CLANPASS);
    mysql_debug(1);
    mysql_query("CREATE TABLE IF NOT EXISTS clans(clanname VARCHAR(30), clantag VARCHAR(5), clanpass VARCHAR(10), clandes VARCHAR(100), clanmotd VARCHAR(50), weap1 INT(3), weap2 INT(3), weap3 INT(3))");
    mysql_query("CREATE TABLE IF NOT EXISTS members(clanname VARCHAR(30), playername VARCHAR(30), playerclanrank INT(5), isinclan INT(2))");
    strcat(tQuery, "CREATE TABLE IF NOT EXISTS Inventory(AccID INT(10) NOT NULL AUTO_INCREMENT,Username VARCHAR(24),Slot0 INT(10),Slot1 INT(10),Slot2 INT(10),Slot3 INT(10),Slot4 INT(10),Slot5 INT(10),Slot6 INT(10),Slot7 INT(10),Slot8 INT(10),Slot9 INT(10)");
    strcat(tQuery, ",Slot10 INT(10),Slot11 INT(10),Slot12 INT(10),Slot13 INT(10),Slot14 INT(10),Slot15 INT(10),Slot16 INT(10),Slot17 INT(10),Slot18 INT(10),Slot19 INT(10), PRIMARY KEY (AccID,Username))");
    mysql_query(tQuery);
1390 Line Function
pawn Код:
public OnAccountCheck(playerid)
{
    new rows, fields; //a variable that will be used to retrieve rows and fields in the database.
    cache_get_data(rows, fields, mysql);//let's get the rows and fields from the database.
    if(rows) //if there is row
    {//then
        cache_get_field_content(0, "PASS", PlayerInfo[playerid][Password], mysql, 129);
        //we will load player's password into pInfo[playerid][Password] to be used in logging in
        PlayerInfo[playerid][ID] = cache_get_field_content_int(0, "ID"); //now let's load player's ID into pInfo[playerid][ID] so we can use it later
        printf("%s", PlayerInfo[playerid][Password]); //OPTIONAL: Just for debugging. If it didn't show your password, then there must be something wrong while getting player's password
        ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit"); //And since we found a result from the database, which means, there is an account; we will show a login dialog
    }
    else //if we didn't find any rows from the database, that means, no accounts were found
    {
        ShowPlayerDialog(playerid, dregister, DIALOG_STYLE_INPUT, "Login", "Please Login Again For Security Purpose", "Login", "Quit");
        //So we show them a dialog register
    }
    return 1;
}
14062 Line

pawn Код:
new query[128]; //query[128] is for formatting our query and Float:pos[3] is for getting and saving player's position
    mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Level`=%d, `VIP`=%d, `Money`=%d, `Kills`=%d, `Deaths`=%d, `Banned`=%d, `Gift`=%d, `VIP`=%d, `ClanSkin`=%d, `Navy`=%d, `hkick`=%d, `Operator`=%d WHERE `ID`=%d",PlayerInfo[playerid][Level], PlayerInfo[playerid][dRank], GetPlayerMoney(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Banned], PlayerInfo[playerid][Gift], PlayerInfo[playerid][dRank], PlayerInfo[playerid][ClanSkin], PlayerInfo[playerid][Navy], PlayerInfo[playerid][hkick], PlayerInfo[playerid][Helper], PlayerInfo[playerid][ID]);
    //We update the table(`players`) by getting player's admin level, vip level, money, and positions and save them in the database
    mysql_tquery(mysql, query, "", "");
    //let's execute the query.
14282 Line Function

pawn Код:
if(GetPVarInt(playerid,"INVLoaded") == 0)
    {
        new lQuery[128],query[350];
        format(lQuery,sizeof(lQuery),"SELECT * FROM Inventory WHERE Username='%s' LIMIT 1",GetName(playerid));
        mysql_query(lQuery);
        mysql_store_result();
        if(mysql_num_rows() != 0)
        {
            LoadInventory(playerid);
        }
        else
        {
            format(query,sizeof query,"INSERT INTO Inventory (Username,Slot0,Slot1,Slot2,Slot3,Slot4,Slot5,Slot6,Slot7,Slot8,Slot9,Slot10,Slot11,Slot12,Slot13,Slot14,Slot15,Slot16,Slot17,Slot18,Slot19) VALUES ('%s',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)",GetName(playerid));
            mysql_query(query);
            SendClientMessage(playerid,-1,"Inventory Created!!");
            SetPVarInt(playerid,"INVLoaded",1);
        }
    }
12787 Line to 12802
pawn Код:
stock LoadInventory(playerid)
{
    new lQuery[500];
    format(lQuery,sizeof(lQuery),"SELECT * FROM Inventory WHERE Username='%s'",GetName(playerid));
    mysql_query(lQuery);
    mysql_store_result();

    if(mysql_num_rows() != 0)
    {
        new savingstring[259];
        while(mysql_fetch_row_format(lQuery,"|"))
        {
            mysql_fetch_field_row(savingstring, "Slot0"); InvInfo[playerid][iSlot][0] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot1"); InvInfo[playerid][iSlot][1] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot2"); InvInfo[playerid][iSlot][2] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot3"); InvInfo[playerid][iSlot][3] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot4"); InvInfo[playerid][iSlot][4] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot5"); InvInfo[playerid][iSlot][5] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot6"); InvInfo[playerid][iSlot][6] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot7"); InvInfo[playerid][iSlot][7] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot8"); InvInfo[playerid][iSlot][8] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot9"); InvInfo[playerid][iSlot][9] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot10"); InvInfo[playerid][iSlot][10] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot11"); InvInfo[playerid][iSlot][11] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot12"); InvInfo[playerid][iSlot][12] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot13"); InvInfo[playerid][iSlot][13] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot14"); InvInfo[playerid][iSlot][14] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot15"); InvInfo[playerid][iSlot][15] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot16"); InvInfo[playerid][iSlot][16] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot17"); InvInfo[playerid][iSlot][17] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot18"); InvInfo[playerid][iSlot][18] = strval(savingstring);
            mysql_fetch_field_row(savingstring, "Slot19"); InvInfo[playerid][iSlot][19] = strval(savingstring);

        }

        mysql_free_result();
        SetPVarInt(playerid,"INVLoaded",1); //you can use this for checking Inventory is loaded or not.
        SendClientMessage(playerid,-1,"Inventory Successfully Loaded!");
    }
    return 1;

}
stock SaveInventory(playerid)
{
    new Query[350];
    strcat(Query,"UPDATE Inventory SET Slot0=%i,Slot1=%i,Slot2=%i,Slot3=%i,Slot4=%i,Slot5=%i,Slot6=%i,Slot7=%i,Slot8=%i,Slot9=%i,Slot10=%i,Slot11=%i,Slot12=%i,Slot13=%i,Slot14=%i,Slot15=%i");
    strcat(Query,",Slot16=%i,Slot17=%i,Slot18=%i,Slot19=%i WHERE Username='%s'");
    format(Query,sizeof(Query),Query,
                                    InvInfo[playerid][iSlot][0],
                                    InvInfo[playerid][iSlot][1],
                                    InvInfo[playerid][iSlot][2],
                                    InvInfo[playerid][iSlot][3],
                                    InvInfo[playerid][iSlot][4],
                                    InvInfo[playerid][iSlot][5],
                                    InvInfo[playerid][iSlot][6],
                                    InvInfo[playerid][iSlot][7],
                                    InvInfo[playerid][iSlot][8],
                                    InvInfo[playerid][iSlot][9],
                                    InvInfo[playerid][iSlot][10],
                                    InvInfo[playerid][iSlot][11],
                                    InvInfo[playerid][iSlot][12],
                                    InvInfo[playerid][iSlot][13],
                                    InvInfo[playerid][iSlot][14],
                                    InvInfo[playerid][iSlot][15],
                                    InvInfo[playerid][iSlot][16],
                                    InvInfo[playerid][iSlot][17],
                                    InvInfo[playerid][iSlot][18],
                                    InvInfo[playerid][iSlot][19],
                                    GetName(playerid));
    mysql_query(Query);
    return 1;
}
Please Anyone help me
Reply

I have:

pawn Код:
forward OnPlayerUpdateSQL(playerid);
public OnPlayerUpdateSQL(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pReg] == 0)
        {
            return 1;
        }
       
        if(joueurconnecte[playerid] == 1)
        {
            new query[1024];
           
            mysql_format(mysql, query, 1024, "UPDATE srp_players_stats SET Armure='%f', PlayerLevel=%d, AdminLevel=%d, Registered=%d, Sex=%d, Blanc=%d, Origin=%d, Money=%d, Bank=%d, SuspendedTime=%d, Job=%d, Jailed=%d, JailTime=%d, Member=%d, Rank=%d, Chara=%d, pHealth='%f', Inte=%d, Model=%d, PhoneNr=%d WHERE id=%d",
           
            PlayerInfo[playerid][pArmure],
            PlayerInfo[playerid][pLevel],
            PlayerInfo[playerid][pAdmin],
            PlayerInfo[playerid][pReg],
            PlayerInfo[playerid][pSex],
           
           
            PlayerInfo[playerid][pBlanc],
           
            PlayerInfo[playerid][pOrigin],
            PlayerInfo[playerid][pCash],
            PlayerInfo[playerid][pAccount],
            PlayerInfo[playerid][pSuspendedTime],
            PlayerInfo[playerid][pJob],
            PlayerInfo[playerid][pJailed],
            PlayerInfo[playerid][pJailTime],
            PlayerInfo[playerid][pMember],
            PlayerInfo[playerid][pRank],
            PlayerInfo[playerid][pChar],
            PlayerInfo[playerid][pHealth],
            PlayerInfo[playerid][pInt],
            PlayerInfo[playerid][pModel],
            PlayerInfo[playerid][pPnumber],
            PlayerInfo[playerid][pSQLID]);
           
            mysql_tquery(mysql, query);
           
            // ...
        }
    }
    return 1;
}
I made several of printf PlayerInfo[playerid][pArmure].
Let's say the value is 10 in the database, I can try to change it into play, it will not change, and it will always be 10 in the database.

So the code must be bugged ...
Reply

@Hostoxide: Contact the author of that specific script, you particularly have no idea what you're trying to do.

@Baltimore:

Have you tried enabling MySQL debug/log? It should show you any mistake. Have you tried removing ' ' (apostrophe) for float specifier? (that couldn't be the cause of it but might solve who knows lol)
Reply

What make, mysql.so mysql-static.so mysql5_5.so different?
Reply

Quote:
Originally Posted by Raefal
Посмотреть сообщение
What make, mysql.so mysql-static.so mysql5_5.so different?
mysql.so = it is not compiled with the libraries required for Linux
mysql_static.so = it is compiled with the libraries required for Linux (both 32bit and 64bit included)
mysql_5.5.so = it is for MySQL version 5.5 or later versions
mysql.so (CentOS 6) = compiled for CentOS 6
Reply

403 Forbidden - CANT DOWNLOAD! HELP!
Reply

Please update the R7 download links, or add them to your github, because I cant use the R33 > versions, I need R7.
Reply

Quote:
Originally Posted by Roel
Посмотреть сообщение
Please update the R7 download links, or add them to your github, because I cant use the R33 > versions, I need R7.
Why not? They're pretty similiar.
Reply

If anybody needs the MySQL R7 version, download the attachment:
Reply

If those of you who want to open a server are really motivated to open it, you would do at least the small work to update the Gamemode to the newest MySQL plugin version (adapting some natives parameters is VERY EASILY doable using macros) !
Reply

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
If those of you who want to open a server are really motivated to open it, you would do at least the small work to update the Gamemode to the newest MySQL plugin version (adapting some natives parameters is VERY EASILY doable using macros) !
They won't understand this. Those who don't care about performance, more functions and stuff, they will most likely stick to something which is going in the same beaten path.

I was lazy as hell to convert from R21 to R33, but one day I decided to switch it finally because I was getting tired of checking new functions and seeing that maddinat0r has updated alot of stuff since R21 which forced me doing that (I also confirmed about the performance and asked some question about the new functions on IRC if maddinat0r remembers it)
Reply

No download links for old plugins and includes.
Reply

Hi, I have a problem when starting the server.
I refered to the FAQ, but it did not solve my problem.

I've installed Redistribuables (x86), and Framework 4.5.1
I'm on Window 7 Family Prenium Edition, 64 bits.

This problem is really annoying, how to fix it once and for all?

I've picture of my installation :

http://image.noelshack.com/fichiers/...rror-mysql.png

Please, help me.
Reply

Quote:
Originally Posted by iLegendary
Посмотреть сообщение
Hi, I have a problem when starting the server.
I refered to the FAQ, but it did not solve my problem.

I've installed Redistribuables (x86), and Framework 4.5.1
I'm on Window 7 Family Prenium Edition, 64 bits.

This problem is really annoying, how to fix it once and for all?

I've picture of my installation :

http://image.noelshack.com/fichiers/...rror-mysql.png

Please, help me.
Care to explain more?

Which MySQL plugin version you are using? What type of error is it? How you are loading? Is it happening on Linux also (if you're having one)? If the crashes are related to bugs in your code, show your code? Tried enabling MySQL debug?
Reply

Quote:
Originally Posted by Runn3R
Посмотреть сообщение
No download links for old plugins and includes.
Means it's time to upgrade. That'd be like going to Microsoft and saying "no download link for Windows 98". It's time to move on.
Reply

i keep have same problem can you help me ?


----------
Loaded log file: "server_log.txt".
----------

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

[10:40:11]
[10:40:11] Server Plugins
[10:40:11] --------------
[10:40:11] Loading plugin: sscanf.so
[10:40:11]

[10:40:11] ===============================

[10:40:11] sscanf plugin loaded.

[10:40:11] Version: 2.8.1

[10:40:11] © 2012 Alex "******" Cole

[10:40:11] ===============================

[10:40:11] Loaded.
[10:40:11] Loading plugin: mysql.so
[10:40:11] Failed (libmysqlclient_r.so.15: cannot open shared object file: No such file or directory)
[10:40:11] Loading plugin: streamer.so
[10:40:11]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[10:40:11] Loaded.
[10:40:11] Loading plugin: wp.so
[10:40:11]
[10:40:11] ==================
[10:40:11]
[10:40:11] Whirlpool loaded
[10:40:11]
[10:40:11] ==================
[10:40:11]
[10:40:11] Loaded.
[10:40:11] Loading plugin: geoip.so
[10:40:11] GeoIP_Plugin got loaded.
[10:40:11] Loaded.
[10:40:11] Loaded 4 plugins.

[10:40:12]
[10:40:12] Filterscripts
[10:40:12] ---------------
[10:40:12] Loading filterscript 'buttons.amx'...
[10:40:12] Loaded 1 filterscripts.

[10:40:12] Script[gamemodes/gg.amx]: Run time error 19: "File or function is not found"
[10:40:12] Number of vehicle models: 0

if you wanna help me call me in ******** https://www.********.com/wahyu.m.partii.33
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)