Stock not setting vehicles trunk.
#9

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;
}
Your code don't work because you set and get params from currentvehicle what is not vehicleid.
Reply


Messages In This Thread
Stock not setting vehicles trunk. - by Zalman - 27.03.2013, 20:43
Re: Stock not setting vehicles trunk. - by Scenario - 27.03.2013, 20:45
Re: Stock not setting vehicles trunk. - by Zalman - 27.03.2013, 20:48
Re: Stock not setting vehicles trunk. - by Scenario - 27.03.2013, 20:53
Re: Stock not setting vehicles trunk. - by B-Matt - 27.03.2013, 20:54
Re: Stock not setting vehicles trunk. - by Zalman - 27.03.2013, 20:58
Re: Stock not setting vehicles trunk. - by B-Matt - 27.03.2013, 21:02
Re: Stock not setting vehicles trunk. - by Zalman - 27.03.2013, 21:07
Re: Stock not setting vehicles trunk. - by B-Matt - 27.03.2013, 21:11

Forum Jump:


Users browsing this thread: 3 Guest(s)