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 (Now on github!) - liinor - 19.09.2014

GIVE ME WORKING LINK FOR ALREADY COMPILED MYSQL R7 FOR UBUNTU LINUX!


Re: [REL] MySQL Plugin (Now on github!) - Vince - 19.09.2014

UPGRADE YOUR SCRIPT TO R39 ALREADY!

I guess your previous shouting thread was deleted, because I can't seem to find it anywhere. You may want to take that as a hint.


Re: [REL] MySQL Plugin (Now on github!) - DobbysGamertag - 19.09.2014

If you search as much as you rage you'd have the answers to your issues already.

mysql_store_result(); > no longer needed in R39-2
mysql_num_rows() > cache_num_rows();
mysql_free_result(); > no longer needed in R39-2 (iirc Madinator linked to the function, it did jack shit)
mysql_ping(); > No longer usable/Existing. Use mysql_errno();

Why can't you use old and easy? - R39-2 is easy as heck once you get the hang of it. Seeing as you lack the basic search skills, i guess you can't code efficiently. My suspicion is confirmed after reading:

Quote:

FUCK YOU AND YOUR NEWER PLUGINS ALREADY

You've never clearly used the newer mysql plugins so you likely know nothing in the case of if its actually better. Take it from people that use it on a daily basis. It is!


Re: [REL] MySQL Plugin (Now on github!) - iReacheR - 20.09.2014

Okay, so I have tried every freaking thing that could be possibly done.

I have .NET Framework 4 installed, all the VC++ redistributable packages installed with their x64 packages too.
I have tried re-installing all of this, I have tried restarting my PC ALOT of times and I have put everything in place, the plugin in the plugin folder, the libmysql.dll in the server files folder and everything that I think needs to be done is done! YET the freaking plugin wont LOAD -_-

Quote:

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

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

[23:49:02]
[23:49:02] Server Plugins
[23:49:02] --------------
[23:49:02] Loading plugin: streamer
[23:49:02] Loaded.
[23:49:02] Loading plugin: sscanf
[23:49:02]

[23:49:02] ===============================

[23:49:02] sscanf plugin loaded.

[23:49:02] Version: 2.8.1

[23:49:02] © 2012 Alex "******" Cole

[23:49:02] ===============================

[23:49:02] Loaded.
[23:49:02] Loading plugin: mysql
[23:49:02] Failed.
[23:49:02] Loading plugin: MapAndreas
[23:49:02] Loaded.
[23:49:02] Loading plugin: FCNPC
[23:49:02]
[23:49:02] -------------------------------------------------
[23:49:02] FCNPC - Fully Controllable NPC v0.1 B12
[23:49:02]
[23:49:02] - Author: OrMisicL
[23:49:02] - Build: Jun 2 2014 at 19:05:32
[23:49:02] -------------------------------------------------
[23:49:02]
[23:49:02] Loading ...
[23:49:02] SAMP Server version 0.3z R2-2 (Windows) detected. Initializing ...
[23:49:02] Loaded.
[23:49:02] Loading plugin: iTD
[23:49:02]
* iTD Plugin loaded. (Support for textdraw editor mouse/keyboard)

[23:49:02] Loaded.
[23:49:02] Loading plugin: Whirlpool
[23:49:02]
[23:49:02] ==================
[23:49:02]
[23:49:02] Whirlpool loaded
[23:49:02]
[23:49:02] ==================
[23:49:02]
[23:49:02] Loaded.
[23:49:02] Loading plugin: nativechecker
[23:49:02] Loaded.
[23:49:02] Loading plugin: crashdetect
[23:49:02] CrashDetect v4.13 is OK.
[23:49:02] Loaded.
[23:49:02] Loaded 8 plugins.

[23:49:02]
[23:49:02] Filterscripts
[23:49:02] ---------------
[23:49:02] Loading filterscript 'iTD.amx'...
[23:49:02]
iPLEOMAX's TextDraw Editor loaded successfully!
Version: 1.16 Stable (13/10/2012)

[23:49:02] Loading filterscript 'TD.amx'...
[23:49:02]
--------------------------------------
[23:49:02] Text Draw Editor 1.0RC2 by Zamaroht for SA-MP 0.3 Loaded.
[23:49:02] --------------------------------------

[23:49:02] Loaded 2 filterscripts.

[23:49:02] Error: Function not registered: 'mysql_log'
[23:49:02] Error: Function not registered: 'mysql_connect'
[23:49:02] Error: Function not registered: 'mysql_errno'
[23:49:02] Error: Function not registered: 'mysql_format'
[23:49:02] Error: Function not registered: 'mysql_tquery'
[23:49:02] Error: Function not registered: 'mysql_close'
[23:49:02] Error: Function not registered: 'mysql_query'
[23:49:02] Error: Function not registered: 'cache_get_row_count'
[23:49:02] Error: Function not registered: 'cache_get_field_content'
[23:49:02] Error: Function not registered: 'cache_delete'
[23:49:02] Error: Function not registered: 'cache_get_data'
[23:49:02] Error: Function not registered: 'cache_get_field_content_int'
[23:49:02] Error: Function not registered: 'cache_insert_id'
[23:49:02] Error: Function not registered: 'cache_get_field_content_float'
[23:49:02] [debug] Run time error 19: "File or function is not found"
[23:49:02] [debug] mysql_log
[23:49:02] [debug] mysql_connect
[23:49:02] [debug] mysql_errno
[23:49:02] [debug] mysql_format
[23:49:02] [debug] mysql_tquery
[23:49:02] [debug] mysql_close
[23:49:02] [debug] mysql_query
[23:49:02] [debug] cache_get_row_count
[23:49:02] [debug] cache_get_field_content
[23:49:02] [debug] cache_delete
[23:49:02] [debug] cache_get_data
[23:49:02] [debug] cache_get_field_content_int
[23:49:02] [debug] cache_insert_id
[23:49:02] [debug] cache_get_field_content_float
[23:49:02] [debug] Run time error 19: "File or function is not found"
[23:49:02] [debug] mysql_log
[23:49:02] [debug] mysql_connect
[23:49:02] [debug] mysql_errno
[23:49:02] [debug] mysql_format
[23:49:02] [debug] mysql_tquery
[23:49:02] [debug] mysql_close
[23:49:02] [debug] mysql_query
[23:49:02] [debug] cache_get_row_count
[23:49:02] [debug] cache_get_field_content
[23:49:02] [debug] cache_delete
[23:49:02] [debug] cache_get_data
[23:49:02] [debug] cache_get_field_content_int
[23:49:02] [debug] cache_insert_id
[23:49:02] [debug] cache_get_field_content_float
[23:49:02] Script[gamemodes/thescriptname.amx]: Run time error 19: "File or function is not found"
[23:49:02] Number of vehicle models: 0

PLEASE HELP ME! I AM VERY MUCH FREAKING ANNOYED AFTER TRYING ALL DAY LONG! I am running windows 7 64-bit.


Re: [REL] MySQL Plugin (Now on github!) - WopsS - 20.09.2014

Quote:
Originally Posted by iReacheR
Посмотреть сообщение
Okay, so I have tried every freaking thing that could be possibly done.

I have .NET Framework 4 installed, all the VC++ redistributable packages installed with their x64 packages too.
I have tried re-installing all of this, I have tried restarting my PC ALOT of times and I have put everything in place, the plugin in the plugin folder, the libmysql.dll in the server files folder and everything that I think needs to be done is done! YET the freaking plugin wont LOAD -_-



PLEASE HELP ME! I AM VERY MUCH FREAKING ANNOYED AFTER TRYING ALL DAY LONG! I am running windows 7 64-bit.
Do you have the new plugin and .inc in your server files?

If yes, try to compile your gamemode.


Re: [REL] MySQL Plugin (Now on github!) - iReacheR - 20.09.2014

dude are you kidding me ? I just wrote that the plugin is in its place plus do you consider I'd be dumb enough not to compile the gamemode like even once ?
isnt there some way to find what file exactly do I need for the plugin to work other than compiling the plugin on my machine which is impossible at the moment since I do not have Visual Studio and all. Can somebody please list everything that is needed for this mysql plugin to run ? I mean every kind of .dll or whatever file ?


Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 20.09.2014

I have a code that checks if an account is banned or not.

pawn Код:
forward CheckAccountBan(sqlpid); // Permet de check un compte ban (Pour un unban, une connexion etc).
public CheckAccountBan(sqlpid)
{
    new query[64];
       
    mysql_format(mysql, query, sizeof(query), "SELECT Locked FROM srp_players_stats WHERE id = %d LIMIT 1", sqlpid);
   
    mysql_tquery(mysql, query, "RetournerID", "");
    return 1;
}



forward RetournerID();
public RetournerID()
{
    if(!cache_num_rows())
    {
        return 0;
    }
    return cache_get_row_int(0, 0); // Retourne si le compte est locked ou non.
}
If i write:

pawn Код:
printf("%d", cache_get_row_int(0, 0));
It returns me 0: Good value.

However if I do:

pawn Код:
printf("%d", CheckAccountBan(playerid));
It returns me 1.

pawn Код:
[21:46:00] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "root", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[21:46:00] [DEBUG] CMySQLHandle::Create - creating new connection..
[21:46:00] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[21:46:00] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[21:46:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:46:00] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:46:00] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:46:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:46:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:46:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:46:01] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:46:01] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:46:01] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:46:01] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:46:01] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:46:01] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:47:06] [DEBUG] mysql_format - connection: 1, len: 256, format: "SELECT id FROM srp_players_stats WHERE Name = LOWER('%e') LIMIT 1"
[21:47:06] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM srp_players_stats WHERE Name = LOWER('Test_Max')", callback: "ReturnID", format: "(null)"
[21:47:06] [DEBUG] mysql_format - connection: 1, len: 64, format: "SELECT Locked FROM srp_players_stats WHERE id = %d LIMIT 1"
[21:47:06] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Locked FROM srp_players_stats WHERE id = 1 LIMIT 1", callback: "RetournerID", format: "(null)"
[21:47:06] [DEBUG] mysql_format - connection: 1, len: 64, format: "SELECT Locked FROM srp_players_stats WHERE id = %d LIMIT 1"
[21:47:06] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Locked FROM srp_players_stats WHERE id = 1 LIMIT 1", callback: "RetournerID", format: "(null)"
[21:47:06] [DEBUG] CMySQLQuery::Execute[ReturnID] - starting query execution
[21:47:06] [DEBUG] CMySQLQuery::Execute[ReturnID] - query was successfully executed within 1.501 milliseconds
[21:47:06] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:47:06] [DEBUG] CMySQLQuery::Execute[RetournerID] - starting query execution
[21:47:06] [DEBUG] CMySQLQuery::Execute[RetournerID] - query was successfully executed within 1.315 milliseconds
[21:47:06] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:47:06] [DEBUG] CMySQLQuery::Execute[RetournerID] - starting query execution
[21:47:06] [DEBUG] Calling callback "ReturnID"..
[21:47:06] [DEBUG] cache_get_row_count - connection: 1
[21:47:06] [DEBUG] cache_get_row_int - row: 0, field_idx: 0, connection: 1
[21:47:06] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "1"
[21:47:06] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:47:06] [DEBUG] Calling callback "RetournerID"..
[21:47:06] [DEBUG] CMySQLQuery::Execute[RetournerID] - query was successfully executed within 14.790 milliseconds
[21:47:06] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:47:06] [DEBUG] cache_get_row_int - row: 0, field_idx: 0, connection: 1
[21:47:06] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "0"
[21:47:06] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:47:06] [DEBUG] Calling callback "RetournerID"..
[21:47:06] [DEBUG] cache_get_row_count - connection: 1
[21:47:06] [DEBUG] cache_get_row_int - row: 0, field_idx: 0, connection: 1
[21:47:06] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "0"
[21:47:06] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called



Re: [REL] MySQL Plugin (Now on github!) - PT - 20.09.2014

Quote:
Originally Posted by Baltimore
Посмотреть сообщение
If i write:

pawn Код:
printf("%d", cache_get_row_int(0, 0));
It returns me 0: Good value.

However if I do:

pawn Код:
printf("%d", CheckAccountBan(playerid));
It returns me 1.
Of course u want check the player account ID if is banned, not his playerid in game...


Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 20.09.2014

So how can I do?


Re: [REL] MySQL Plugin (Now on github!) - PT - 20.09.2014

Quote:
Originally Posted by Baltimore
Посмотреть сообщение
So how can I do?
Do an variable to get the player id on table and use that id to ban him or check if is banned.


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 20.09.2014

Код:
CheckAccountBan(sqlpid) // Permet de check un compte ban (Pour un unban, une connexion etc).
{
    new query[128];
        
    mysql_format(mysql, query, sizeof(query), "SELECT Locked FROM srp_players_stats WHERE id = %d LIMIT 1", sqlpid);
    new Cache:result = mysql_query(mysql, query);
    new return_val = cache_num_rows() ? cache_get_row_int(0, 0) : 0;
    cache_delete(result, mysql);
	
    return return_val;
}



Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 20.09.2014

Thx, it's work maddinat0r <3


Re: [REL] MySQL Plugin (Now on github!) - GiamPy. - 20.09.2014

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Код:
CheckAccountBan(sqlpid) // Permet de check un compte ban (Pour un unban, une connexion etc).
{
    new query[128];
        
    mysql_format(mysql, query, sizeof(query), "SELECT Locked FROM srp_players_stats WHERE id = %d LIMIT 1", sqlpid);
    new Cache:result = mysql_query(mysql, query);
    new return_val = cache_num_rows() ? cache_get_row_int(0, 0) : 0;
    cache_delete(result, mysql);
	
    return return_val;
}
That would be non-threaded though, right?


Re : [REL] MySQL Plugin (Now on github!) - S4t3K - 20.09.2014

@GiamPy : Correct, but if you find a working way to do it using threaded queries, I'll be happy to know about it.


Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 21.09.2014

Fail


Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 21.09.2014

Hello!

I currently starts on MySQL R39 with the help of several people (including S4T3K).

I am currently in MySQL R5 and I want to spend my script in MySQL R39 but I'm stuck in one place, thank you kindly help me:

http://pastebin.com/cpK8VG5m


Re: [REL] MySQL Plugin (Now on github!) - Baltimore - 21.09.2014

MySQL R5 there function mysql_fetch_row

MySQL R39 what replaces the function above?


Re: [REL] MySQL Plugin (Now on github!) - iReacheR - 21.09.2014

Okay, so I have tried every freaking thing that could be possibly done.

I have .NET Framework 4 installed, all the VC++ redistributable packages installed with their x64 packages too.
I have tried re-installing all of this, I have tried restarting my PC ALOT of times and I have put everything in place, the plugin in the plugin folder, the libmysql.dll in the server files folder and everything that I think needs to be done is done! YET the freaking plugin wont LOAD -_-

Quote:

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

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

[23:49:02]
[23:49:02] Server Plugins
[23:49:02] --------------
[23:49:02] Loading plugin: streamer
[23:49:02] Loaded.
[23:49:02] Loading plugin: sscanf
[23:49:02]

[23:49:02] ===============================

[23:49:02] sscanf plugin loaded.

[23:49:02] Version: 2.8.1

[23:49:02] © 2012 Alex "******" Cole

[23:49:02] ===============================

[23:49:02] Loaded.
[23:49:02] Loading plugin: mysql
[23:49:02] Failed.
[23:49:02] Loading plugin: MapAndreas
[23:49:02] Loaded.
[23:49:02] Loading plugin: FCNPC
[23:49:02]
[23:49:02] -------------------------------------------------
[23:49:02] FCNPC - Fully Controllable NPC v0.1 B12
[23:49:02]
[23:49:02] - Author: OrMisicL
[23:49:02] - Build: Jun 2 2014 at 19:05:32
[23:49:02] -------------------------------------------------
[23:49:02]
[23:49:02] Loading ...
[23:49:02] SAMP Server version 0.3z R2-2 (Windows) detected. Initializing ...
[23:49:02] Loaded.
[23:49:02] Loading plugin: iTD
[23:49:02]
* iTD Plugin loaded. (Support for textdraw editor mouse/keyboard)

[23:49:02] Loaded.
[23:49:02] Loading plugin: Whirlpool
[23:49:02]
[23:49:02] ==================
[23:49:02]
[23:49:02] Whirlpool loaded
[23:49:02]
[23:49:02] ==================
[23:49:02]
[23:49:02] Loaded.
[23:49:02] Loading plugin: nativechecker
[23:49:02] Loaded.
[23:49:02] Loading plugin: crashdetect
[23:49:02] CrashDetect v4.13 is OK.
[23:49:02] Loaded.
[23:49:02] Loaded 8 plugins.

[23:49:02]
[23:49:02] Filterscripts
[23:49:02] ---------------
[23:49:02] Loading filterscript 'iTD.amx'...
[23:49:02]
iPLEOMAX's TextDraw Editor loaded successfully!
Version: 1.16 Stable (13/10/2012)

[23:49:02] Loading filterscript 'TD.amx'...
[23:49:02]
--------------------------------------
[23:49:02] Text Draw Editor 1.0RC2 by Zamaroht for SA-MP 0.3 Loaded.
[23:49:02] --------------------------------------

[23:49:02] Loaded 2 filterscripts.

[23:49:02] Error: Function not registered: 'mysql_log'
[23:49:02] Error: Function not registered: 'mysql_connect'
[23:49:02] Error: Function not registered: 'mysql_errno'
[23:49:02] Error: Function not registered: 'mysql_format'
[23:49:02] Error: Function not registered: 'mysql_tquery'
[23:49:02] Error: Function not registered: 'mysql_close'
[23:49:02] Error: Function not registered: 'mysql_query'
[23:49:02] Error: Function not registered: 'cache_get_row_count'
[23:49:02] Error: Function not registered: 'cache_get_field_content'
[23:49:02] Error: Function not registered: 'cache_delete'
[23:49:02] Error: Function not registered: 'cache_get_data'
[23:49:02] Error: Function not registered: 'cache_get_field_content_int'
[23:49:02] Error: Function not registered: 'cache_insert_id'
[23:49:02] Error: Function not registered: 'cache_get_field_content_float'
[23:49:02] [debug] Run time error 19: "File or function is not found"
[23:49:02] [debug] mysql_log
[23:49:02] [debug] mysql_connect
[23:49:02] [debug] mysql_errno
[23:49:02] [debug] mysql_format
[23:49:02] [debug] mysql_tquery
[23:49:02] [debug] mysql_close
[23:49:02] [debug] mysql_query
[23:49:02] [debug] cache_get_row_count
[23:49:02] [debug] cache_get_field_content
[23:49:02] [debug] cache_delete
[23:49:02] [debug] cache_get_data
[23:49:02] [debug] cache_get_field_content_int
[23:49:02] [debug] cache_insert_id
[23:49:02] [debug] cache_get_field_content_float
[23:49:02] [debug] Run time error 19: "File or function is not found"
[23:49:02] [debug] mysql_log
[23:49:02] [debug] mysql_connect
[23:49:02] [debug] mysql_errno
[23:49:02] [debug] mysql_format
[23:49:02] [debug] mysql_tquery
[23:49:02] [debug] mysql_close
[23:49:02] [debug] mysql_query
[23:49:02] [debug] cache_get_row_count
[23:49:02] [debug] cache_get_field_content
[23:49:02] [debug] cache_delete
[23:49:02] [debug] cache_get_data
[23:49:02] [debug] cache_get_field_content_int
[23:49:02] [debug] cache_insert_id
[23:49:02] [debug] cache_get_field_content_float
[23:49:02] Script[gamemodes/thescriptname.amx]: Run time error 19: "File or function is not found"
[23:49:02] Number of vehicle models: 0

PLEASE HELP ME! I AM VERY MUCH FREAKING ANNOYED AFTER TRYING ALL DAY LONG! I am running windows 7 64-bit.


Re: [REL] MySQL Plugin (Now on github!) - DeluxeZoneRP - 21.09.2014

tranks!, the best plugin forever!


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 21.09.2014

@iReacher: Are you sure you installed all the C++ redistributables listed in the F.A.Q.?