mysql coordinat save problem
#1

I have roleplay server i want save my positions.X and Y pos saves but Z pos is saves 0.

Here is my onplayer disconnect code

Код:
new Float:ax,Float:ay,Float:az;
GetPlayerPos(playerid,ax,ay,az);
PlayerInfo[playerid][PosX] = ax;
PlayerInfo[playerid][PosY] = ay;
PlayerInfo[playerid][PosZ] = az;
Update(playerid, PosXx);
Update(playerid, PosYx);
Update(playerid, PosZx);
here is my update functions posz code

Код:
case PosZx:
{
format(var, sizeof(var), "UPDATE `players` SET `posZ`='%f' WHERE `username`='%s'", PlayerInfo[playerid][PosZ], playerName);
mysql_query(handle ,var);
}
Reply
#2

use %1f instead of %f in format line
Reply
#3

still saves z position 0
Reply
#4

Try making it `posz` = %f instead of `posz` = '%f'

So it would be
pawn Код:
case PosZx:
{
format(var, sizeof(var), "UPDATE `players` SET `posZ`=%f WHERE `username`='%s'", PlayerInfo[playerid][PosZ], playerName);
mysql_query(handle ,var);
}
Also make sure that the case is correct, cause the function may not even be ran.
Reply
#5

still saves 0 x and y coordinates saves successfully but z saves 0
Reply
#6

Which MySQL are you using? Is the mysql_query the same as the x and y?
Reply
#7

Код:
case PosXx:
{
format(var, sizeof(var), "UPDATE `players` SET `posX`=%f WHERE `username`='%s'", PlayerInfo[playerid][PosX], playerName);
mysql_query(handle ,var);
}

case PosYx:
{
format(var, sizeof(var), "UPDATE `players` SET `posY`=%f WHERE `username`='%s'", PlayerInfo[playerid][PosY], playerName);
mysql_query(handle ,var);
}

case PosZx:
{
format(var, sizeof(var), "UPDATE `players` SET `posZ`=%f WHERE `username`='%s'", PlayerInfo[playerid][PosZ], playerName);
mysql_query(handle ,var);
}
Reply
#8

Try doing something like this, put your x, y, and z saving all in the same format, you should be able to.
Reply
#9

Quote:
Originally Posted by KtotheYle
Посмотреть сообщение
Try doing something like this, put your x, y, and z saving all in the same format, you should be able to.
still same

Код:
case savepos:
{
format(var, sizeof(var), "UPDATE `players` SET `posX`='%f',`posY`='%f',`posZ`='%f' WHERE `username`='%s'", PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ],playerName);
mysql_query(handle ,var);
}
Reply
#10

solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)