Convert easymysql to MYSQL
#4

here is my example on gamemodeinit

Код:
public OnGameModeInit()
{
	mysql_log(ERROR | WARNING | INFO | DEBUG);

	option_Id = mysql_init_options();
	mysql_set_option(option_Id, AUTO_RECONNECT, true);
	
	g_Handle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, option_Id);
	
	if(g_Handle == MYSQL_INVALID_HANDLE || mysql_errno(g_Handle) != 0)
	{
	    print(MYSQL_FAILURE);
	    SendRconCommand("exit");
	}
	else
	{
	    print(MYSQL_SUCCESS);
	}
	
	new Query[1024];
	mysql_format(g_Handle, Query, sizeof(Query), "CREATE TABLE IF NOT EXISTS `Accounts` (\
		`ID` int(11) NOT NULL AUTO_INCREMENT, \
		`Name` varchar(24) NOT NULL, \
		`Password` varchar(129) NOT NULL, \
		`Ip` varchar(18) NOT NULL, \
		`Level` int(11) NOT NULL, \
		`Money` int(11) NOT NULL, \
		`Kills` int(11) NOT NULL, \
		`Deaths` int(11) NOT NULL, \
		`Scuicides` int(11) NOT NULL, \
		`Skin` int(11) NOT NULL, \
		`Interior` int(11) NOT NULL, \
		`X` float NOT NULL, \
		`Y` float NOT NULL, \
		`Z` float NOT NULL, \
		PRIMARY KEY (`ID`))");
	mysql_tquery(g_Handle, Query);
	
	SetGameModeText(GAMEMODE_TEXT);
	return 1;
}
edit: i use R41-4

https://github.com/pBlueG/SA-MP-MySQL/releases
Reply


Messages In This Thread
Convert easymysql to MYSQL - by NotThatWeird - 04.02.2018, 13:20
Re: Convert easymysql to MYSQL - by PepsiCola23 - 04.02.2018, 13:34
Re: Convert easymysql to MYSQL - by NotThatWeird - 04.02.2018, 13:55
Re: Convert easymysql to MYSQL - by Mobtiesgangsa - 04.02.2018, 14:27

Forum Jump:


Users browsing this thread: 3 Guest(s)