31.08.2013, 20:07
Hello today I tried to create a system of car, but I have a little problem when I buy a car I do teleported me and spawn a new car instead I buy the car here all goes well but when I buy another car the car is mine but the vending car is no longer there
Afther two times the vending car disepears
Afther two times the vending car disepears
Код:
new Query[256],Float:vPos[4], cCar; GetVehiclePos(ivID, vPos[0], vPos[1], vPos[2]); GetVehicleZAngle(ivID, vPos[3]); ++ Total_Veh_Created; strmid(vInfoCar[OwnedVeh(ivID)][vOwner], pNameCar(playerid), 0, 128, 128); strmid(vInfoCar[OwnedVeh(ivID)][vPlate], pNameCar(playerid), 0, 32, 32); vInfoCar[OwnedVeh(ivID)][vLocked] = 1; SetVehicleNumberPlate(ivID, pNameCar(playerid)); SetVehicleToRespawn(ivID); SetVehiclePos(ivID, 544.2484,-1259.2098,16.3837); SetVehicleZAngle(ivID, 303.7534); PutPlayerInVehicle(playerid, ivID, 0); for(new i = 0; i < MAX_VEH_MODS; ++i) vMods[Total_Veh_Created][i] = 0; format(Query, sizeof(Query), "INSERT INTO `cars` (`vID`, `vModel`, `vColor1`, `vColor2`, `vPrice`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlate`, `vPaintJ`) VALUES (%d, %d, 1, 1, %d, 'Sell', %f, %f, %f, %f, 'Sell', -1)", Total_Veh_Created, vInfoCar[OwnedVeh(ivID)][vModel], vInfoCar[OwnedVeh(ivID)][vPrice], vPos[0], vPos[1], vPos[2], vPos[3]); mysql_query(Query); cCar = CreateVehicle(vInfoCar[OwnedVeh(ivID)][vModel], vPos[0], vPos[1], vPos[2], vPos[3], 1, 1, 500000); strmid(vInfoCar[Total_Veh_Created][vOwner], "Sell", 0, 128, 128); strmid(vInfoCar[Total_Veh_Created][vPlate], "Sell", 0, 32, 32); GivePlayerMoney(playerid, - vInfoCar[OwnedVeh(ivID)][vPrice]); SetVehicleNumberPlate(cCar, "Sell"); SendClientMessage(playerid, -1, ""#CYELLOW"Have fun with your private vehicle!"); SendClientMessage(playerid, -1, ""#CBLUE"Your vehicle is "#CDGREEN"locked."); TogglePlayerControllable(playerid, true); OwnedVeh(cCar) = Total_Veh_Created; SavePrivVeh(Total_Veh_Created); SavePrivVeh(OwnedVeh(ivID));