26.10.2014, 13:14
So i don't know what the heck the problem is, this function should get trunk possition from burrito, id 482, but it doesnt, it returns me You're not behind vehicles trunk.
pawn Код:
if(newkeys & 6) // KEY LMB
{
if(SvercaMaterijale[playerid] == 2)
{
new Float:Poz[3];
GetPosBehindVehicle(482, Poz[0], Poz[1], Poz[2]);
if(PI[playerid][Clan] == 7)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, Poz[0], Poz[1], Poz[2]))
{
DisablePlayerCheckpoint(playerid);
SvercaMaterijale[playerid] = 3;
SetPlayerCheckpoint(playerid, 1263.2574,-2029.8651,59.3268, 3.0);
if(IsPlayerAttachedObjectSlotUsed(playerid, 2)) RemovePlayerAttachedObject(playerid, 2);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
else return SCM(playerid, GREY, "You're not behind vehicles trunk.");
}
}
}
pawn Код:
stock GetPosBehindVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:offset=0.5)
{
new Float:vehicleSize[3], Float:vehiclePos[3];
GetVehiclePos(vehicleid, vehiclePos[0], vehiclePos[1], vehiclePos[2]);
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehicleSize[0], vehicleSize[1], vehicleSize[2]);
GetXYBehindVehicle(vehicleid, vehiclePos[0], vehiclePos[1], (vehicleSize[1]/2)+offset);
x = vehiclePos[0];
y = vehiclePos[1];
z = vehiclePos[2];
return 1;
}
GetXYBehindVehicle(vehicleid, &Float:q, &Float:w, Float:distance)
{
new Float:a;
GetVehiclePos(vehicleid, q, w, a);
GetVehicleZAngle(vehicleid, a);
q += (distance * -floatsin(-a, degrees));
w += (distance * -floatcos(-a, degrees));
}