27.03.2013, 21:11
pawn Код:
stock BootStatusOfNearestVehicle(playerid, vehicleid, Float:distance = 2.0)
{
new
Float:fPos[3],
Float:sPos[3],
currentvehicle,
engine,
lights,
alarm,
doors,
bonnet,
boot,
objective
;
GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
GetVehiclePos(v, sPos[0], sPos[1], sPos[2]);
new Float:odist =
floatsqroot(
floatpower(floatsub(sPos[0], fPos[0]), 2.0) +
floatpower(floatsub(sPos[1], fPos[1]), 2.0) +
floatpower(floatsub(sPos[2], fPos[2]), 2.0)
);
if (odist < distance) //What the hell is that?
{
currentvehicle = v;
distance = odist;
}
}
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == 1) SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
else if(boot == 0) SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
return boot;
}