SA-MP Forums Archive
Help with GVAr Plugin - 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: Help with GVAr Plugin (/showthread.php?tid=516857)



Help with GVAr Plugin - SlonCHL - 02.06.2014

I notice the GVar plugin isn't working for me since I updated to 0.3z R2-2, is it just me or everyone here is encountering the same problem? Do you all know what's the best plugin to replace it? I am in serious need of a cross-script variables.

I saved my MySQL connection handler in a GVar, there's no error when I compile my script but my MySQL plugin says invalid connection handler


Re: Help with GVAr Plugin - iZN - 02.06.2014

Which MySQL plugin and version you're using? Show your script aswell.


Re: Help with GVAr Plugin - iFarbod - 02.06.2014

Quote:

And are we meant to guess your code?

- ******

Please show your code So we try to help you.


Re: Help with GVAr Plugin - SlonCHL - 14.06.2014

I wasn't expecting to receive any help regarding my code actually that's why I didn't provide any code but since you asked I did one last check on the bug before I give you all the code and I realize that the thing works on fs but not my gamemode.

Код:
gamemode0 zzoneoutbreak 1
filterscripts dbconnect account_system commands_system vehicle_system kill_streak_system weapons_shop item_shop admin_system mini_event_system event_system pause_system
As you can see, I did my connection in the dbconnect fs which I load before everything else(Including the gamemode I suppose?) maybe something changed in 0.3z. The mysql connection works in my acc fs but not for my gamemode

I'm using BlueG's MySQL plugin version R34, https://sampforum.blast.hk/showthread.php?tid=56564

Here's my error log
Код:
[00:52:34] [ERROR] "mysql_query" - invalid connection handle (ID = 0)
[00:52:34] [WARNING] cache_get_field_content - no active cache
[00:52:34] [WARNING] cache_get_field_content - no active cache
And here's a bit of my code
dbconnect
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <gvar>
#include <a_mysql>

new Connection;

public OnFilterScriptInit()
{
    new Server[100] = "localhost";
    new Username[50] = "root";
    new Database[10] = "zzone";
    new Password[100] = "";

    Connection = mysql_connect(Server, Username, Database, Password);

    SetGVarInt("DB", Connection);
    return 1;
}

public OnFilterScriptExit()
{
    mysql_close(Connection);
    return 1;
}
gamemode
pawn Код:
main()
{
    DB = GetGVarInt("DB");
    mysql_query(DB, "SELECT * FROM `info`");
}



Re: Help with GVAr Plugin - iZN - 14.06.2014

Firstly, update your MySQL plugin, the latest release is R39 which can be found here: https://github.com/pBlueG/SA-MP-MySQL/releases

Код:
[00:52:34] [ERROR] "mysql_query" - invalid connection handle (ID = 0)
[00:52:34] [WARNING] cache_get_field_content - no active cache
[00:52:34] [WARNING] cache_get_field_content - no active cache
You've to use cache_get_field_content with mysql_tquery (or mysql_pquery). mysql_query is not threaded and it's way slower than threaded queries so mysql_tquery sends threaded queries, use that.

About the connection handle, I don't understand why this isn't working. If you aren't using multiple connections the connection ID would be 1 so why don't you just use 1 instead? If you are using multiple MySQL connections. Use mysql_option.


Re: Help with GVAr Plugin - SlonCHL - 29.06.2014

Ok, I'll tell you the result when I try it but I have been using mysql_query and nothing happened before 0.3z and no I am only using a connection