PDA

View Full Version : GetVehicleModelInfo() trunk of the vehicle


Noliax8
27/01/2014, 11:35 AM
Hi,

I want to find the position of the trunk of the vehicle, i use GetVehicleModelInfo, i tested VEHICLE_MODEL_INFO_WHEELSREAR, but it's not very good...

http://www.upimg.fr/ih/07rt.png


#define posArr{%0} %0[0],%0[1],%0[2]
GetVehiclePos(ii, posArr{ vPos });
GetVehicleModelInfo(vInfo[ii][veh__model], VEHICLE_MODEL_INFO_WHEELSREAR, posArr{ vInfoPos } );
CreatePickup(1239, 0, (vPos[0] + vInfoPos[0]), (vPos[1] + vInfoPos[1]), (vPos[2] + vInfoPos[2]), -1);


How to get a better position ?
Thanks

Kyle
27/01/2014, 11:44 AM
stock GetCenterOfTrunk(vehicleid, &Float:x, &Float:y, &Float:z)
{
new model = GetVehicleModel(vehicleid);

if (!model)
return 0;

new Float:fPosition[5];

GetVehicleZAngle(vehicleid, fPosition[3]);
GetVehiclePos(vehicleid, fPosition[0], fPosition[1], fPosition[2]);
GetVehicleModelInfo(model, VEHICLE_MODEL_INFO_REAR_BUMPER_Z, x, y, z);

fPosition[4] = z;

x += fPosition[0];
y += fPosition[1];

x -= (2.35 * (floatsin(-fPosition[3], degrees)));
y -= (2.35 * (floatcos(fPosition[3], degrees)));
return 1;
}



+1 to Emmet_ who did this for me sometime ago.

Jay_
27/01/2014, 01:31 PM
This is not related to SA-MP 0.3z. Please post in the correct section.

Noliax8
28/01/2014, 10:54 AM
Sorry Jay_

KyleSmith: That don't work, i don't see the pickup..


new Float:x, Float:y, Float:z;
for(new ii = 1; ii <= TOTAL_VEHICULES; ii++)
{
GetCenterOfTrunk(ii, x, y, z);
CreatePickup(1239, 0, x, y, z, -1);
}


PS: What it's the "degrees", where this variable is declared ?

Thanks

Noliax8
29/01/2014, 08:38 AM
No idéa ?

Danyal
29/01/2014, 08:57 AM
Hope you can get some idea from This Post: ==>Click Me Post<== (http://forum.sa-mp.com/showpost.php?p=1957918&postcount=7)

Kyle
29/01/2014, 12:37 PM
Try increasing the Z height of it. It is probably hiding in the boot.

Also use the appropriate section.