27.03.2013, 20:43
As the title says the stock I am working on isn't setting the vehicles boot to 1 it just says as 0.
pawn Код:
stock BootStatusOfNearestVehicle(playerid, 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]);
for(new v = 1; v < MAX_VEHICLES; v++)
{
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));
GetVehiclePos(v, sPos[0], sPos[1], sPos[2]);
if (odist < distance)
{
currentvehicle = v;
distance = odist;
if(IsPlayerInRangeOfPoint(playerid, sPos[0], sPos[1], sPos[2], distance))
{
if(boot == 1)
{
GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, 0, objective);
}
else if(boot == 0)
{
GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, 1, objective);
}
}
}
}
return currentvehicle;
}