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

Quote:
Originally Posted by Leenert
Посмотреть сообщение
Hey everyone,
since updating to r34 i got the following error on server start:
Код:
[16:36:35] [ERROR] CMySQLConnection::Connect - (error #2002) Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Maybe someone knows how to fix that...I use the static version of the plugin, because the dynamic did not work
Maybe the mysql.sock file is somewhere else on your machine. Try to locate it and create a soft-link to that file in the 'tmp' directory (ln -s /some/where/mysql.sock /tmp/mysql.sock).
Reply

Hosting a server on a remote server, and MySQL is failing to start.
It works perfectly on my home computer and I've uploaded all necessarry files.

Is there something that needs to be installed on the server to get it running?
The server is Windows.

Код:
echo Executing Server Config...
lanmode 0
rcon_password sefgsdfgdfghsder5tesr5y5ersy5er6yt
maxplayers 25
port 7777
hostname SA-MP 0.3 Server
gamemode0 Max
filterscripts
plugins mysql streamer sscanf whirlpool nativechecker 
announce 1
query 1
Код:
[23:49:48] Server Plugins
[23:49:48] --------------
[23:49:48]  Loading plugin: mysql
[23:49:48]   Failed.
[23:49:48]  Loading plugin: streamer
[23:49:48] 

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

[23:49:48]   Loaded.
Reply

Quote:
Originally Posted by [DK]Dark_Knight
Посмотреть сообщение
Hosting a server on a remote server, and MySQL is failing to start.
It works perfectly on my home computer and I've uploaded all necessarry files.

Is there something that needs to be installed on the server to get it running?
The server is Windows.

Код:
[...]
Код:
[23:49:48] Server Plugins
[23:49:48] --------------
[23:49:48]  Loading plugin: mysql
[23:49:48]   Failed.
[23:49:48]  Loading plugin: streamer
[23:49:48] 

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

[23:49:48]   Loaded.
Yes, there is: http://www.solidfiles.com/d/dcb62ce7e5/
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Installed that on server, still not working.
It works perfectly on my own computer, but when I uploaded the stuff (As per pics) It errors.


========================================


Also to all those people that are getting this error
Код:
[ERROR] CMySQLHandle::ConnectT - (error #2003) Can't connect to MySQL server on 'SERVERIP' (10061)
make sure you have your "mysql_connect()" syntax correct for example
pawn Код:
MySQL = mysql_connect(HOSTNAME, USERNAME, DATABASE, PASSWORD,  PORT, BOOL:AUTORECONNECT);
pawn Код:
MySQL = mysql_connect("localhost", "DvL", "Samp", "toohardforyou",  3306, true);
3306 is the default MySQL port
Reply

delete.
Reply

delete.
Reply

Uh you have to use the latest include file...
Reply

Hey all, I figured it out!!!
If you are having the same problem as me do the following:

1- Download THIS (its the dependent librarys for SA-MP and MySQL plugin)
2- Extract them to your servers ROOT directory (The one containing samp-server.exe)
3- Run server, all should be working

This is the steps you take if you get the following error:
Код:
[23:49:48]  Loading plugin: mysql
[23:49:48]   Failed.
...
[23:49:49] Script[gamemodes/gamemode.amx]: Run time error 19: "File or function is not found"
Reply

Solved
Hi, i have this problem:
Код:
[15:24:54] [ERROR] CMySQLQuery::Execute[SendQuery()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
pawn Код:
new ali[350];
            format(ali, 350, "CREATE TABLE IF NOT EXISTS `%s` \
            (`tPX` float(20) NOT NULL,\
             `tPY` float(20) NOT NULL,\
             `tText` varchar(500) NOT NULL,\
            `tLSX` float(20) NOT NULL,\
             `tLSY` float(20) NOT NULL,\
             `tTSX` float(20) NOT NULL,\
            `tTSY` float(20) NOT NULL,\
             `tAlign` int(20) NOT NULL,\
             `tColor` int(25) NOT NULL,\
             `tUB` int(10) NOT NULL,\
             `tBC` int(25) NOT NULL,\
             `tShadow` int(20) NOT NULL,\
             `tOL` int(25) NOT NULL,\
             `tBGC` int(25) NOT NULL,\
            `tFont` int(10) NOT NULL,"
,inputtext);
             strcat(ali, "`tProportional` int(20) NOT NULL,\
             `tSelectable` int(10) NOT NULL,\
             `tPM` int(20) NOT NULL,\
             `tPRX` float(20) NOT NULL,\
             `tPRY` float(20) NOT NULL,\
             `tPRZ` float(20) NOT NULL,\
             `tPRZoom` float(20) NOT NULL,\
             `tPVC1` int(10) NOT NULL,\
             `tPVC2` int(10) NOT NULL,\
             `Tyype` int(5) NOT NULL)\
              ENGINE=MyISAM;"
,350);
              mysql_tquery(handle, ali, "SendQuery", "");
Код:
OS: Windows 7 64bit
MySQL Server version: 5.6.12
Plugin version: R34
near ' '?
Reply

delete.
Reply

Aliassassin123456 - This should work, but I suggest you stop coding in PAWN to create table, it's just waste of time, I suggest you create the table in phpMyAdmin

pawn Код:
define TABLE_NAME "Your_Table_Here"

public OnGameModeInit()
{
    new ali[ 255 char ], handle;
    format(ali, sizeof(ali), "CREATE TABLE IF NOT EXISTS `%s` \
    (`tPX` float(20) NOT NULL,\
    `tPY` float(20) NOT NULL,\
    `tText` varchar(500) NOT NULL,\
    `tLSX` float(20) NOT NULL,\
    `tLSY` float(20) NOT NULL,\
    `tTSX` float(20) NOT NULL,\
    `tTSY` float(20) NOT NULL,\
    `tAlign` int(20) NOT NULL,\
    `tColor` int(25) NOT NULL,\
    `tUB` int(10) NOT NULL,\
    `tBC` int(25) NOT NULL,\
    `tShadow` int(20) NOT NULL,\
    `tOL` int(25) NOT NULL,\
    `tBGC` int(25) NOT NULL,\
    `tFont` int(10) NOT NULL,"
);
    format(ali, sizeof(ali), "`tProportional` int(20) NOT NULL,\
    `tSelectable` int(10) NOT NULL,\
    `tPM` int(20) NOT NULL,\
    `tPRX` float(20) NOT NULL,\
    `tPRY` float(20) NOT NULL,\
    `tPRZ` float(20) NOT NULL,\
    `tPRZoom` float(20) NOT NULL,\
    `tPVC1` int(10) NOT NULL,\
    `tPVC2` int(10) NOT NULL,\
    `Tyype` int(5) NOT NULL)\
    ENGINE=MyISAM;"
, TABLE_NAME);
    mysql_tquery(handle, ali, "SendQuery", "");
}
Reply

@pds2k12
0.Thanks for reply
1.I knew phpMyAdmin and i am always working with that.
2.There is a reason to i didn't use phpMyAdmin for that and it's: that table isn't a global table like users, it's project to save textdraws and player can create table in game
3.There isn't any different in the format for packed strings:
pawn Код:
new ali[ 255 char ], handle;
    /*=======>*/format(ali, sizeof(ali), "CREATE TABLE IF NOT EXISTS `%s` \
    (`tPX` float(20) NOT NULL,\
    `tPY` float(20) NOT NULL,\
    `tText` varchar(500) NOT NULL,\
    `tLSX` float(20) NOT NULL,\
    `tLSY` float(20) NOT NULL,\
    `tTSX` float(20) NOT NULL,\
    `tTSY` float(20) NOT NULL,\
    `tAlign` int(20) NOT NULL,\
    `tColor` int(25) NOT NULL,\
    `tUB` int(10) NOT NULL,\
    `tBC` int(25) NOT NULL,\
    `tShadow` int(20) NOT NULL,\
    `tOL` int(25) NOT NULL,\
    `tBGC` int(25) NOT NULL,\
    `tFont` int(10) NOT NULL,"
);
    /*=======>*/format(ali, sizeof(ali), "`tProportional` int(20) NOT NULL,\
    `tSelectable` int(10) NOT NULL,\
    `tPM` int(20) NOT NULL,\
    `tPRX` float(20) NOT NULL,\
    `tPRY` float(20) NOT NULL,\
    `tPRZ` float(20) NOT NULL,\
    `tPRZoom` float(20) NOT NULL,\
    `tPVC1` int(10) NOT NULL,\
    `tPVC2` int(10) NOT NULL,\
    `Tyype` int(5) NOT NULL)\
    ENGINE=MyISAM;"
, TABLE_NAME);
4.Think before reply
Problem solved, i use ALTER TABLE `table_name` ADD `column_name` column_type(column_size) NOT NULL;
Anyway, Thanks
Reply

Hey. im using the mysql plugin R33 (https://sampforum.blast.hk/showthread.php?tid=56564 ),
It works on my other pc, but on this one it doesn't work.
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3x, ©2005-2013 SA-MP Team

[19:59:24] 
[19:59:24] Server Plugins
[19:59:24] --------------
[19:59:24]  Loading plugin: mysql
[19:59:24]   Failed.
[19:59:24]  Loading plugin: streamer
[19:59:24] 

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

[19:59:24]   Loaded.
[19:59:24]  Loading plugin: sscanf
[19:59:24] 

[19:59:24]  ===============================

[19:59:24]       sscanf plugin loaded.     

[19:59:24]          Version:  2.8.1        

[19:59:24]    © 2012 Alex "Y_Less" Cole  

[19:59:24]  ===============================

[19:59:24]   Loaded.
[19:59:24]  Loading plugin: nativechecker
[19:59:24]   Loaded.
[19:59:24]  Loading plugin: Whirlpool
[19:59:24]  
[19:59:24]  ==================
[19:59:24]  
[19:59:24]   Whirlpool loaded
[19:59:24]  
[19:59:24]  ==================
[19:59:24]  
[19:59:24]   Loaded.
[19:59:24]  Loaded 4 plugins.

[19:59:24] 
[19:59:24] Filterscripts
[19:59:24] ---------------
[19:59:24]   Loaded 0 filterscripts.

[19:59:24]    Error: Function not registered: 'cache_get_row_count'
[19:59:24]    Error: Function not registered: 'mysql_close'
[19:59:24]    Error: Function not registered: 'mysql_connect'
[19:59:24]    Error: Function not registered: 'mysql_tquery'
[19:59:24]    Error: Function not registered: 'cache_get_data'
[19:59:24]    Error: Function not registered: 'cache_get_row_int'
[19:59:24]    Error: Function not registered: 'cache_get_row'
[19:59:24]    Error: Function not registered: 'cache_get_row_float'
[19:59:24]    Error: Function not registered: 'cache_insert_id'
[19:59:24]    Error: Function not registered: 'WP_Hash'
[19:59:24]    Error: Function not registered: 'mysql_escape_string'
[19:59:24] Script[gamemodes/MyRP.amx]: Run time error 19: "File or function is not found"
[19:59:24] Number of vehicle models: 0
I have the mysql.dll in /plugins, libmysql.dll in the sa-mp server directory and added the plugin to the cfg.
I don't know what i am doing wrong.
Ive also re-installed .net framework, but that didn't help too

any one knows what the problem is?
Reply

Quote:
Originally Posted by PakPak
Посмотреть сообщение
Hey. im using the mysql plugin R33 (https://sampforum.blast.hk/showthread.php?tid=56564 ),
It works on my other pc, but on this one it doesn't work.
Код:
[...]
[19:59:24]  Loading plugin: mysql
[19:59:24]   Failed.
[...]
I have the mysql.dll in /plugins, libmysql.dll in the sa-mp server directory and added the plugin to the cfg.
I don't know what i am doing wrong.
Ive also re-installed .net framework, but that didn't help too

any one knows what the problem is?
This problem has been reported and answered many times now, please use the search function next time.
Try installing this onto the PC where the plugin fails to load.
Reply

Is it? It seems like it's going to set to its first cell. I haven't tried that in-game to see whether it works or not, only while compiling. I'm going to test it and edit my post.

It seems so. Too sad, it'd be really nice.
Reply

pawn Код:
//Make an enum for all player data
enum PlayerData
{
    ORM:ORM_ID,
    ID,
    Username[24],
    Password[129],
    Admin
};

new playerData[MAX_PLAYERS][PlayerData];

public OnPlayerConnect(playerid)
{

    GetPlayerName(playerid, Player_Name[playerid][Username], MAX_PLAYER_NAME);

    new ORM:ormid = playerData[playerid][ORM_ID] = orm_create("players");

    orm_addvar_int(ormid, playerData[playerid][ID], "id");
    orm_addvar_string(ormid, playerData[playerid][Username], MAX_PLAYER_NAME, "name");
    orm_addvar_string(ormid, playerData[playerid][Password], 128, "pass");
    // ... password etc.
    orm_addvar_int(ormid, playerData[playerid][Admin], "admin");
   
    //Set Key to Username so we can search the database for that user and load all info as above
    orm_setkey(ormid, "Username");
   
    //Selects all data from database where Username = players name and then calls OnPlayerDataLoad
    orm_select(ormid, "OnPlayerDataLoad", "d", playerid);

    // more..
    return 1;
}

forward OnPlayerDataLoad(playerid);
public OnPlayerDataLoad(playerid)
{
    switch(orm_errno(pData[playerid][ORM_ID]))
    {
        case ERROR_OK:
        {
            //LOGIN PLAYER STUFF
        }
        case ERROR_NO_DATA:
        {
            //User was not found in database, make them register
        }
    }

    //Change the key to ID for future updating of mysql
    orm_setkey(pData[playerid][ORM_ID], "ID");
    return 1;
}
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Player_Name[playerid][0] is correct, did you tried it like that? You can use orm_addvar_* with every variable you like.
Also passing char-typed variables per reference is unsupported in PAWN (or maybe it is? someone should ask ****** about that one).
I compiled it like that but I thought it was incorrect; however, it worked fine.
I asked ****** and he said that it's not possible to pass it by reference. That ruined it for me, so I guess I'll be using cache again. Atleast, I learned about ORM!

@[DK]Dark_Knight: The thing is that I don't want to use an enumeration.
Reply

delete.
Reply

DeeJas: You have to install Visual C++ 2012 runtime: http://www.microsoft.com/en-us/downl....aspx?id=30679 (select vcredist_x86.exe, even if your system is x64).
Reply

delete.
Reply


Forum Jump:


Users browsing this thread: 19 Guest(s)