SA-MP Forums Archive
[Plugin] [REL] MySQL Plugin (Now on github!) - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MySQL Plugin (Now on github!) (/showthread.php?tid=56564)



Re: [REL] MySQL Plugin R2 - Jay_ - 22.12.2009

Quote:
Originally Posted by Jay_
Will there be a mysql_fetch_field_row fix anytime soon?
It was actually a coding fault which led me to beleive this function was not working correctly, sorry.


Re: [REL] MySQL Plugin R2 - MenaceX^ - 22.12.2009

Quote:
Originally Posted by michael2572
Why does mysql_fetch_row_format() crash the server if the row string is longer than 200?
I use 1024 and it never happened to me.


Re: [REL] MySQL Plugin R2 - Julian2574 - 23.12.2009

I cba to look thrue 33 pages so im asking , If i'm transfering my PEN LS Edit to MYSQL How to make a save system? You know so it saves in DB not in .INI or i need to leave it as it is?


Re: [REL] MySQL Plugin R2 - Sergei - 23.12.2009

Quote:
Originally Posted by »Julian™«
I cba to look thrue 33 pages so im asking , If i'm transfering my PEN LS Edit to MYSQL How to make a save system? You know so it saves in DB not in .INI or i need to leave it as it is?
You need to convert all the file writing to SQL queries and process them.


Re: [REL] MySQL Plugin R2 - Toney - 23.12.2009

Well check 33 pages again. Because there so much info for saving system/


Re: [REL] MySQL Plugin R2 - MenaceX^ - 23.12.2009

Quote:
Originally Posted by »Julian™«
I cba to look thrue 33 pages so im asking , If i'm transfering my PEN LS Edit to MYSQL How to make a save system? You know so it saves in DB not in .INI or i need to leave it as it is?
I suggest you reading some guides. Though only changing the users system is not hard at all.


Re: [REL] MySQL Plugin R2 - Julian2574 - 23.12.2009

As i figured it out i had to query "OnplayerUpdate" Soo .. Rest i'll get in touch with as while you script you'll learn more Thanks


Re: [REL] MySQL Plugin R2 - jamesb93 - 24.12.2009

This someties dosent load a players owned vehicle, Anyone know why?

pawn Код:
public LoadVehicles()
{
    CheckSQL();
    new resultline[256],vehid,sqlid,model,Float:x,Float:y,Float:z,Float:angle,col1,col2,type,price,ownerid;
    mysql_query("SELECT * FROM `vehicles`");
    mysql_store_result();
    while(mysql_fetch_row_format(resultline,"|") == 1)
    {
      sscanf(resultline,"p|ddffffddddd",sqlid,model,x,y,z,angle,col1,col2,type,price,ownerid);
        vehid = CreateVehicle(model,x,y,z,angle,col1,col2,-1);
      vInfo[vehid][vSQLId] = sqlid;
      vInfo[vehid][vModelId] = model;
      vInfo[vehid][vPos_X] = x;
      vInfo[vehid][vPos_Y] = y;
      vInfo[vehid][vPos_Z] = z;
      vInfo[vehid][vPos_A] = angle;
      vInfo[vehid][vColor1] = col1;
      vInfo[vehid][vColor2] = col2;
      vInfo[vehid][vBuyAble] = type;
      vInfo[vehid][vPrice] = price;
      vInfo[vehid][vOwnerId] = ownerid;
    }
    mysql_free_result();
    return 1;
}



Re: [REL] MySQL Plugin R2 - Hipster - 24.12.2009

[17:14:24] Loading plugin: mysql.so
[17:14:24] Failed (libmysqlclient.so.15: wrong ELF class: ELFCLASS64)
[17:14:24] Loaded 0 plugins.

[17:14:24]
[17:14:24] Filter Scripts
[17:14:24] ---------------
[17:14:24] Loaded 0 filter scripts.

[17:14:24] Script[gamemodes/tbl_dc.amx]: Run time error 19: "File or function is not found"

CentOs 64 bit , Please help


Re: [REL] MySQL Plugin R2 - Dreftas - 26.12.2009

Quote:
Originally Posted by Hipster
[17:14:24] Loading plugin: mysql.so
[17:14:24] Failed (libmysqlclient.so.15: wrong ELF class: ELFCLASS64)
[17:14:24] Loaded 0 plugins.

[17:14:24]
[17:14:24] Filter Scripts
[17:14:24] ---------------
[17:14:24] Loaded 0 filter scripts.

[17:14:24] Script[gamemodes/tbl_dc.amx]: Run time error 19: "File or function is not found"

CentOs 64 bit , Please help
I can suggest one thing > try mine files(CentOS too)
http://t2play.info/mysql.so
http://t2play.info/libmysqlclient.so


Re: [REL] MySQL Plugin R2 - Jay_ - 27.12.2009

Does anyone by any chance have an older version of this (namely, the one that worked on 0.2x servers)


Re: [REL] MySQL Plugin R2 - MenaceX^ - 27.12.2009

Yes. AFAIK sscanf has bugs with floats, it happened to me too.


Re: [REL] MySQL Plugin R2 - Sergei - 27.12.2009

Just replace case f with this and it will work.
pawn Код:
case 'f':
            {
              new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                changestr[changepos++] = string[strpos++];
              }
              changestr[changepos] = '\0';
              setarg(paramPos,0,_:floatstr(changestr));
            }



Re: [REL] MySQL Plugin R2 - Dreftas - 28.12.2009

Does anyone know when R3 will be released? Because i think that in R3 plugin author fix bug with RAM usage.. or fix mysql_free_result()..


Re: [REL] MySQL Plugin R2 - Sergei - 28.12.2009

R3 is being tested. And yes those functions will be fixed as well as some new functions added.


Re: [REL] MySQL Plugin R2 - Dreftas - 28.12.2009

I wish that it would be released as soon as possible It's annoying to restart server every day :\


Re: [REL] MySQL Plugin R2 - greatman - 29.12.2009

I got a problem with retreiving string in my mysql DB. I can retreive a string without problem (Log confirm it: 08:26:37] mysql_fetch_row_format(Delimiter: ); Return: "Test") but the problem is the transfer in a variable. Is never show a string. It show a face.....

Here's the part of my script:
pawn Код:
new BizzName[500];
format(query,sizeof(query),"SELECT name FROM bizz WHERE id='%i'",i);
mysql_query(query);
mysql_store_result();
BizzName[i] = mysql_fetch_row(line);
printf("Business %s loaded. Owner: %4s",BizzName[i]);
Thanks for your help
Greatman


Re: [REL] MySQL Plugin R2 - MenaceX^ - 29.12.2009

It should be
pawn Код:
new BizzName[your max businesses][length of string];



Re: [REL] MySQL Plugin R2 - greatman - 29.12.2009

Quote:
Originally Posted by MenaceX^
It should be
pawn Код:
new BizzName[your max businesses][length of string];
Thanks but now i get the error: error 033: array must be indexed (variable "BizzName")

I need to do that?:

pawn Код:
BizzName[i][length of string] = mysql_fetch_row(line);



Re: [REL] MySQL Plugin R2 - Misiek - 29.12.2009

Код:
native mysql_fetch_row_format(string[],const delimiter[] = "|");
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1," ")
You need to give it a (pointer/reference to) variable, which you want to store the data.

Код:
mysql_fetch_row(BizzName[i]);
Remember to have enough memory allocated for the returned string.