How to check if trunk is open?
#4

Ricardo,
you should really know this by now,

Make a variable for every vehicle, and set it to 1 if you opened the trunk,
Set it to 0 if you closed it.


pawn Код:
CMD:boot(playerid, param[])
{
    new count2 = 0;
    for(new vid = 1; vid < MAX_VEHICLES; vid++)
    {
        new Float:ppx, Float:ppy, Float:ppz;
        GetVehiclePos(vid, ppx, ppy, ppz);
        if(IsPlayerInRangeOfPoint(playerid, 3.5, ppx, ppy, ppz))
        {
            count2++;
        }
    }
    if(count2 > 0)
    {
    for(new vid = 1; vid < MAX_VEHICLES; vid++)
    {
        new Float:ppx, Float:ppy, Float:ppz;
        GetVehiclePos(vid, ppx, ppy, ppz);
        if(IsPlayerInRangeOfPoint(playerid, 3.5, ppx, ppy, ppz))
        {
            if(carboot[vid] == 1)
            {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
            SendClientMessage(playerid, COLOR_ORANGE, "Car Trunk Closed!");
            carboot[vid] = 0;
            }
            else if(carboot[vid] == 0)
            {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,true,objective);
            SendClientMessage(playerid, COLOR_ORANGE, "Car Trunk Opened!!");
            carboot[vid] = 1;
            }
        }
    }
    return 1;
    }
    else return SCM(playerid, COLOR_GREY, "Not near any vehicles!");
}
Reply


Messages In This Thread
How to check if trunk is open? - by ricardo178 - 04.06.2012, 08:20
Re: How to check if trunk is open? - by HDFord - 04.06.2012, 08:40
Re: How to check if trunk is open? - by ricardo178 - 04.06.2012, 08:49
Re: How to check if trunk is open? - by milanosie - 04.06.2012, 13:48
Re: How to check if trunk is open? - by ricardo178 - 04.06.2012, 16:27

Forum Jump:


Users browsing this thread: 1 Guest(s)