Angle causing errors -
iTorran - 02.12.2010
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
Re: Angle causing errors -
xxmitsu - 03.12.2010
is the 'Query' variable large enough for the whole sql query ?
What mysql plugin are you using ? enable debug mode and see what happens.
Re: Angle causing errors -
iTorran - 05.12.2010
Im using StrickenKid's, Debug mode is enabled, And the query i made 128 length
Re: Angle causing errors -
JaTochNietDan - 05.12.2010
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.
Re: Angle causing errors -
iTorran - 05.12.2010
Haha i didnt think of that

Awesome, Works ta