Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Problem position AttachDynamicObjectToVehicle

$
0
0
I made the following code:

Code:

           
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.

Code:

                               
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);


+rep To whom I solve it.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>