Angle causing errors
#1

Im saving some vehicles to MySQL and well, "ID, Owner, Model, X, Y, Z" works fine,
No query errors or anything, But when it comes to angle it dosent work? Why :S

pawn Код:
new Float:pPOS[4], str[128];
GetPlayerPos(playerid, pPOS[0], pPOS[1], pPOS[2]);
GetPlayerFacingAngle(playerid, pPOS[3]);

#undef DEFAULT_VEHICLE_OWNER
#define DEFAULT_VEHICLE_OWNER VehicleOwner
               
format(Query, sizeof(Query), "INSERT INTO vehicles (id, owner, model, x, y, z) VALUES (NULL, '%s', %d, %f, %f, %f);",DEFAULT_VEHICLE_OWNER, PVTModelID, pPOS[0], pPOS[1], pPOS[2]);
mysql_query(Query);
This code works perfect.
This one dosent

pawn Код:
new Float:pPOS[4], str[128];
GetPlayerPos(playerid, pPOS[0], pPOS[1], pPOS[2]);
GetPlayerFacingAngle(playerid, pPOS[3]);

#undef DEFAULT_VEHICLE_OWNER
#define DEFAULT_VEHICLE_OWNER VehicleOwner
               
format(Query, sizeof(Query), "INSERT INTO vehicles (id, owner, model, x, y, z, a) VALUES (NULL, '%s', %d, %f, %f, %f, %f);",DEFAULT_VEHICLE_OWNER, PVTModelID, pPOS[0], pPOS[1], pPOS[2], pPOS[3]);
mysql_query(Query);
Anyone know? Angle is vital and i dont see why X, Y, Z works but A dosent :S
Reply
#2

is the 'Query' variable large enough for the whole sql query ?

What mysql plugin are you using ? enable debug mode and see what happens.
Reply
#3

Im using StrickenKid's, Debug mode is enabled, And the query i made 128 length
Reply
#4

Quote:
Originally Posted by iTorran
Посмотреть сообщение
Im using StrickenKid's, Debug mode is enabled, And the query i made 128 length
There's your problem, 128 length is definitely not long enough for that string. After entering in a max length name of 24 characters into the owner area, it's already up to about 116. So then you've got 12 characters left for those floats and stuff, which is not enough.

On a bit of a guess, I would say bumping the "Query" string length to around 170 to allow for the long floats.
Reply
#5

Haha i didnt think of that Awesome, Works ta
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)