14.08.2013, 18:12
This is my code
It connects and everything, but as soon as I put this line into the script (under OnFilterscriptInit, it doesnt connect to the mysql server
I cant actually see any errors so I do not know why it isnt connecting?
pawn Код:
#include <a_samp>
#include <a_mysql>
#define SQL_HOST "127.0.0.1"
#define SQL_USER "user"
#define SQL_PASS "pass"
#define SQL_DB "database"
#define COLOR_YELLOW 0xFFFF00AA
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
public OnFilterScriptInit()
{
for(new x = 0; x < 3; x++)
{
if(!mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS))
{
printf("MySQL connection attempt %d failed!", x);
SendClientMessageToAll(COLOR_YELLOW, "MYSQL FAILED");
}
else break;
}
mysql_debug(1);
SendClientMessageToAll(COLOR_YELLOW, "MYSQL CONNECTED");
return 1;
}
public OnFilterScriptExit()
{
SendClientMessageToAll(COLOR_YELLOW, "MYSQL SCRIPT UNLOADED - MYSQL DISCONNECTED");
mysql_close();
return 1;
}
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `factions` WHERE `group` = 'Police_Force'");
mysql_query(Query);