09.09.2017, 01:04
I made the following code:
It creates the object correctly and lets me edit it but the problem is when saving the object to the new position that does not correctly save the coordinates.
This is the save code in function OnPlayerEditDynamicObject.
+rep To whom I solve it.
pawn Код:
VehiculosInfo[vehicleid][cObjetoToy][0] = modelid;
VehiculosInfo[vehicleid][cObjetoToy][0] = CreateDynamicObject(VehiculosInfo[vehicleid][cToy][0], x,y,z,0.0,0.0,0.0, 0, 0);
ObjetoGuardar[playerid] = 11;
IDObjetoGuardar[playerid] = 0;
EditDynamicObject(playerid, VehiculosInfo[vehicleid][cObjetoToy][0]);
It creates the object correctly and lets me edit it but the problem is when saving the object to the new position that does not correctly save the coordinates.
This is the save code in function OnPlayerEditDynamicObject.
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
VehiculosInfo[vehicleid][cPosToy][0] = x;
VehiculosInfo[vehicleid][cPosToy][1] = y;
VehiculosInfo[vehicleid][cPosToy][2] = z;
VehiculosInfo[vehicleid][cPosToy][3] = rx;
VehiculosInfo[vehicleid][cPosToy][4] = ry;
VehiculosInfo[vehicleid][cPosToy][5] = rz;
SetDynamicObjectPos(objectid, x, y, z);
SetDynamicObjectRot(objectid, rx, ry, rz);
DestroyDynamicObject(VehiculosInfo[vehicleid][cObjetoToy][IDObjetoGuardar[playerid]]);
VehiculosInfo[vehicleid][cObjetoToy][IDObjetoGuardar[playerid]] = CreateDynamicObject(VehiculosInfo[vehicleid][cToy][IDObjetoGuardar[playerid]], VehiculosInfo[vehicleid][cPosToy][0], VehiculosInfo[vehicleid][cPosToy][1], VehiculosInfo[vehicleid][cPosToy][2], VehiculosInfo[vehicleid][cPosToy][3], VehiculosInfo[vehicleid][cPosToy][4], VehiculosInfo[vehicleid][cPosToy][5], 0, 0);
AttachDynamicObjectToVehicle(VehiculosInfo[vehicleid][cObjetoToy][IDObjetoGuardar[playerid]], vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);