MySQL SavePlayerData - 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: MySQL SavePlayerData (
/showthread.php?tid=652502)
MySQL SavePlayerData -
MarioKamani - 13.04.2018
Код:
#define MYSQL_HOST "localhost"
#define MYSQL_USER "root"
#define MYSQL_PASS ""
#define MYSQL_DB "nerp"
stock SavePlayerData(playerid)
{
new query[512];
GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
mysql_format(MYSQL, query, sizeof(query), "UPDATE players SET `posX`='%f',`posY`='%f',`posZ`='%f' WHERE `ID`='%d'",PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ], PlayerInfo[playerid][pID]);
mysql_tquery(MYSQL, query, "", ""); // ============== HERE, AT HANDLE=================
return 1;
}
It says undefined symbol, what should i do there?
Re: MySQL SavePlayerData -
Sithis - 13.04.2018
You need to connect to your database first.
MYSQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
If you don't, the MYSQL connection object will be undefined.
Re: MySQL SavePlayerData -
Mugala - 13.04.2018
if u're using MySQL lower than R39-5, u must use
new MySQL;
if not, than you must use
new MySQL:MySQL;
Re: MySQL SavePlayerData -
MarioKamani - 13.04.2018
Quote:
Originally Posted by Mugala
if u're using MySQL lower than R39-5, u must use new MySQL;
if not, than you must use new MySQL:MySQL;
|
rep++