View Full Version : mysql help

26/11/2011, 02:19 PM
ok i am using Dynamic Vehicle Ownership by [L3th4l],i have been working on this one command,but cant quite get it to work properly,since i have never used mysql before so bear with me:)
Well here is the problem i am trying to move a vehicle from where it was park by the owner to a postion from a diffrent database,ok this works ok apart from the vehicle angle,it always parks it what ever postion the person selling it is looking ;)
so here is the code
CMD:sellveh(playerid, params[]){
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle to use this command!");
new ivID = GetPlayerVehicleID(playerid),Float:Pos[4],Query[300];
format(Query, sizeof(Query), "SELECT vPosX,vPosY,vPosZ,vPosA FROM vehicle WHERE `vID` = %i LIMIT 1", ivID);
sscanf(Query, "p<|>ffff",Pos[0], Pos[1], Pos[2], Pos[3]);
if(OwnedVeh(ivID) != 0){
if(strmatch(vInfo[OwnedVeh(ivID)][vOwner], pName(playerid))){
vInfo[OwnedVeh(ivID)][vPrice] = vInfo[OwnedVeh(ivID)][vPrice];
strmid(vInfo[OwnedVeh(ivID)][vOwner], "Unbought", 0, 20, 20);
strmid(vInfo[OwnedVeh(ivID)][vPlate], "{WG}", 0, 32, 32);
GivePlayerMoney(playerid, vInfo[OwnedVeh(ivID)][vPrice] - 100);//10000
SendClientMessage(playerid, COLOR_GREY, "You've sold this vehicle and the money has been given back!");
SetVehiclePos(ivID,Pos[0], Pos[1], Pos[2]);
SetVehicleNumberPlate(ivID, "{WG}");
GetVehiclePos(ivID, Pos[0], Pos[1], Pos[2]);
GetVehicleZAngle(ivID, Pos[3]);
vInfo[OwnedVeh(ivID)][vPosX] = Pos[0];
vInfo[OwnedVeh(ivID)][vPosY] = Pos[1];
vInfo[OwnedVeh(ivID)][vPosZ] = Pos[2];
vInfo[OwnedVeh(ivID)][vPosA] = Pos[3];
printf("vID:\t\t%i", ivID);printf("Spawn X:\t%f", Pos[0]);printf("Spawn y:\t%f", Pos[1]);printf("Spawn z:\t%f", Pos[2]);printf("Spawn a:\t%f", Pos[3]);
return 1;}
else return SendClientMessage(playerid, COLOR_RED, "This vehicle does not belong to you!");}
else return SendClientMessage(playerid, COLOR_RED, "This vehicle is not ownable!");}
ok and here is the mysql debug
[19:56:24] CMySQLHandler::Query(SELECT vPosX,vPosY,vPosZ,vPosA FROM vehicle WHERE `vID` = 127 LIMIT 1) - Successfully executed.

[19:56:24] >> mysql_store_result( Connection handle: 1 )

[19:56:24] CMySQLHandler::StoreResult() - Result was stored.

[19:56:24] >> mysql_fetch_row_format( Connection handle: 1 )

[19:56:24] CMySQLHandler::FetchRow() - Return: 1944.37|1335.77|8.9094|178.764
178.764 is the correct angle,but it respawns it at this angle 90.808.
So can anyone help me out with what i have done wrong ?
Cheers in advance for any help

27/11/2011, 07:25 PM
Can anyone help with this please :)

29/11/2011, 09:31 PM
does anyone know the answer to this problem :(