17.11.2012, 14:32
Hi! I'm trying to place a checkpoint at the location of a specific vehicle's fuel cap. The problem is that I'm not very got at advanced mathematics so I would need someones assistance now to help me out 
I've found this function somewhere here on the SA-MP forums. (Credits to whoever made it). But it seems like it's not working for me when I put it into action.
The checkpoint gets placed on the GetVehiclePos coords. Am I just stupid and did a small mistake or?
Thank you for your help!

I've found this function somewhere here on the SA-MP forums. (Credits to whoever made it). But it seems like it's not working for me when I put it into action.
pawn Код:
stock GetVehicleInfo(vehicleid, infotype, &Float:x, &Float:y, &Float:z, &Float:angle)
{
if(!IsVehicleValid(vehicleid)) return 0;
new Float:mX, Float:mY, Float:mZ;
GetVehicleModelInfo(GetVehicleModel(vehicleid), infotype, mX, mY, mZ);
z += mZ;
x += (mY * floatsin(-angle, degrees));
y += (mY * floatcos(-angle, degrees));
angle += 270.0;
x += (mX * floatsin(-angle, degrees));
y += (mX * floatcos(-angle, degrees));
angle -= 270.0;
return 1;
}
pawn Код:
new cID = GetClosestVehicle(playerid);
new Float: pos[4];
GetVehiclePos(cID, pos[0], pos[1], pos[2]);
GetVehicleZAngle(cID, pos[3]);
if(IsPointInDynamicArea(pVariables[i][pArea], pos[0], pos[1], pos[2]))
{
GetVehicleInfo(GetVehicleModel(cID), VEHICLE_MODEL_INFO_PETROLCAP, pos[0], pos[1], pos[2], pos[3]);
SetPlayerCheckpoint(playerid, pos[0], pos[1], pos[2], 0.5);
}
Thank you for your help!