21.01.2015, 00:58
Hey guys, Iґve got another small problem with MySQL
I tried to set the Players Position by Floats thatґll get set into the SQL-DB.
But it still just shows it as an Integer
And It doesnt save the Floats, it just stays at the same Integer
Codes:
Register:
Saving:
I tried to set the Players Position by Floats thatґll get set into the SQL-DB.
But it still just shows it as an Integer
And It doesnt save the Floats, it just stays at the same Integer
Codes:
Register:
PHP код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `PosX`, `PosY`, `PosZ`, `FacingAngel`) VALUES ('%e', '%s', 701.8041,-519.4351,16.3318,261.1537)", Name[playerid], pInfo[playerid][Password]);
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new query[128], 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 `accounts` SET `Score`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f WHERE `ID`=%d",\
pInfo[playerid][Score], pInfo[playerid][VIP], pInfo[playerid][Money], pos[0], pos[1], pos[2], pInfo[playerid][AccID]);
//We update the table(`players`) by getting player's admin level, vip level, money, and positions and save them in the database
mysql_tquery(mysql, query, "", "");
//let's execute the query.
return 1;
}