Help with creating a MYSQL Database - 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 creating a MYSQL Database (
/showthread.php?tid=495633)
Help with creating a MYSQL Database -
Mobeen - 18.02.2014
Hey everyone, I've been trying to add a MYSQL system to my server and I've been using the tutorial [HIC]TheKiller made. However, when I got up to this step, the gamemode shows some errors and doesn't compile.
Код:
public OnGameModeInit()
{
mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
mysql_query("CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(24), password VARCHAR(41), score INT(20), money INT(20), IP VARCHAR(16) )");
//Fields:
//Field Name - Use - Type
//user- Player Name - String
//password- Players password - String
//score - Players score - int
//money - Players Cash - int
//IP - Players IP - int
return 1;
}
After I added this to OnGameModeInit(), it gave me an error saying: error 035: argument type mismatch (argument 1)
https://sampforum.blast.hk/showthread.php?tid=159785
Re: Help with creating a MYSQL Database -
itsCody - 18.02.2014
Go into phpmyadmin or navicat
hit new under databases, create your desired tables
way easiser tbh
then connect!!
pawn Код:
new connection;
public OnGameModeInit()
{
connection = mysql_connect(MySQL_Host, MySQL_Username, MySQL_Database, MySQL_Password);
return 1;'
}
I find it easier to just create the tables than put them under OnGameModeInIt.