23.01.2014, 19:00
When I do like this:
I doesn't save the last IP.
If I put ' like this: `DerniereIP`='%s'
I have problems later in mysql log with the synthax.
Mysql log:
So it sets Admin level to 53 I don't know why. And it sets VIP to 53 too.
It sets the money to 46, and I don't know why again.
I don't know if I've been clear but if you need more explanations just tell me
I doesn't save the last IP.
Код:
public OnPlayerDisconnect(playerid, reason) { new query[1024],string[128]; GetPlayerIp(playerid, pInfo[playerid][DerniereIP], 16); printf("%s", pInfo[playerid][DerniereIP]); mysql_format(mysql, query, sizeof(query),"SELECT * FROM `joueurs` WHERE `Username` = '%e' LIMIT 1", Name[playerid]); new Float:pos[3]; //query[128] is for formatting our query and Float:pos[3] is for getting and saving player's position GetPlayerPos(playerid, pos[0], pos[1], pos[2]); //let's get player's position when they leave your server mysql_format(mysql, query, sizeof(query), "UPDATE `joueurs` SET `DerniereIP`=%s, `Admin`=%d, `VIP`=%d, `Argent`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `Interieur`=%i, `World`=%i, `Skin`=%d, `Niveau`=%d WHERE `ID`=%d",\ pInfo[playerid][DerniereIP], pInfo[playerid][Admin], pInfo[playerid][VIP], pInfo[playerid][Argent], pos[0], pos[1], pos[2], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), pInfo[playerid][Skin], pInfo[playerid][Niveau], pInfo[playerid][ID]); mysql_tquery(mysql, query, "", ""); printf("%s", pInfo[playerid][DerniereIP]); new Float:vie[1], Float:armure[1]; GetPlayerHealth(playerid, vie[0]); GetPlayerArmour(playerid, armure[0]); mysql_format(mysql, query, sizeof(query), "UPDATE `joueurs` SET `Vie`=%f, `Armure`=%f WHERE `ID`=%d", vie[0], armure[0], pInfo[playerid][ID]); mysql_tquery(mysql, query, "", ""); switch(reason) { case 0: format(string, sizeof(string), "[ID:%d] %s vient de quitter le serveur. (Connexion perdue/Crash)", playerid, Name[playerid]); case 1: format(string, sizeof(string), "[ID:%d] %s vient de se deconnecter du serveur. (Quit)", playerid, Name[playerid]); case 2: format(string, sizeof(string), "[ID:%d] %s vient de se faire kick ou bannir serveur. (Kick/Bannis)", playerid, Name[playerid]); } SendClientMessageToAll(Gris, string); return 1; }
If I put ' like this: `DerniereIP`='%s'
I have problems later in mysql log with the synthax.
Mysql log:
Код:
:10] [DEBUG] mysql_format - connection: 1, len: 1024, format: "SELECT * FROM `joueurs` WHERE `Username` = '%e' LIMIT 1" [21:06:10] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `joueurs` SET `DerniereIP`=%s, `Admin`=%d, `VIP`=%d, `Argent`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `Interieur`=%i, `World..." [21:06:10] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `joueurs` SET `DerniereIP`=255.255.255.255, `Admin`=53, `", callback: "(null)", format: "(null)" [21:06:10] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `joueurs` SET `Vie`=%f, `Armure`=%f WHERE `ID`=%d" [21:06:10] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `joueurs` SET `Vie`=100.000000, `Armure`=0.000000 WHERE `", callback: "(null)", format: "(null)" [21:06:10] [DEBUG] CMySQLQuery::Execute[] - starting query execution [21:06:10] [ERROR] CMySQLQuery::Execute[] - (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 '.255.255, `Admin`=53, `VIP`=53, `Argent`=46, `posX`=1539.261475, `posY`=-1736.04' at line 1
It sets the money to 46, and I don't know why again.
I don't know if I've been clear but if you need more explanations just tell me
