Stock not setting vehicles trunk.
#8

Quote:
Originally Posted by B-Matt
Посмотреть сообщение
1. You don't need loop at all. Put vehicleid parameter in your function.
2. You need return boot status not currentvehicle. Am I right?
Ok this is what I have now and it does't work.
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++)
    {
        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)
        {
            currentvehicle = v;
            distance = odist;
        }
    }

    GetVehicleParamsEx(currentvehicle, engine, lights, alarm, doors, bonnet, boot, objective);
    if(boot == 1) SetVehicleParamsEx(currentvehicle, engine, lights, alarm, doors, bonnet, 0, objective);
    else if(boot == 0) SetVehicleParamsEx(currentvehicle, engine, lights, alarm, doors, bonnet, 1, objective);
    return boot;
}
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: 1 Guest(s)