18.02.2013, 10:14
Hello, I need to get the position of AttachObject (in the car). How to use this:
(Please example)
Help please, sorry for my bad English.
(Please example)
pawn Код:
stock GetAttachedObjectPos(vehicleid, Float:offset_x, Float:offset_y, Float:offset_z, &Float:x, &Float:y, &Float:z)
{
new Float:deg;
new Float:s;
new Float:objectangle;
new Float:pos[3];
GetVehicleZAngle(vehicleid, deg);
GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
s = floatsqroot(offset_x * offset_x + offset_y * offset_y);
objectangle = atan(offset_y / offset_x);
deg += 90.0;
deg -= objectangle;
x = pos[0] + s * floatcos(deg, degrees);
y = pos[1] + s * floatsin(deg, degrees);
z = pos[2] + offset_z;
}