Using vehicle controls outside of the vehicle with range point.
#1

Fixed
Reply
#2

Код:
new lastcar = P_LastVeh[playerid]; 
                new Float:lcX, Float:lcY, Float:lcZ; 
                GetVehiclePos(lastcar, lcX, lcY, lcZ); 
                if(!IsPlayerInRangeOfPoint(playerid, 2, lcX, lcY, lcZ))
It gets the pos. of the last vehicle driven.
Reply
#3

pawn Код:
new P_LastVeh[MAX_PLAYERS] = (-1);
Public on enter vehicle and exit:
pawn Код:
if(GetPlayerState(playerid) == 2)
    {
    P_LastVeh[playerid] = GetPlayerVehicleID(playerid);
    return 1;
    }
Reply
#4

how about this
pawn Код:
if(strcmp(x_nr,"hood",true) == 0)
            {
                new lastcar = P_LastVeh[playerid];
                new Float:lcX, Float:lcY, Float:lcZ;
                GetVehiclePos(lastcar, lcX, lcY, lcZ);
                if(IsPlayerInRangeOfPoint(playerid, 2, lcX, lcY, lcZ))
                {
                    if(GetPVarInt(playerid, "Hood") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,trunk,objective);
                        SetPVarInt(playerid, "Hood", 1);
                    }
                    else if(GetPVarInt(playerid, "Hood") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,trunk,objective);
                        SetPVarInt(playerid, "Hood", 0);
                    }
                    return 1;
                }
                else {
                    SendClientMessage(playerid,COLOR_WHITE,"[Vehicle Control] You're not in range of your last vehicle!");
                    return 1;
                }
            }
if that dont make any diffrence try printing both positions and see if your just out or there miles out
coz i kinda remember something like when you get a empty vehicles pos it returns the pos where it spawned
not where it is now not 100% on that though
Reply
#5

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
how about this
pawn Код:
if(strcmp(x_nr,"hood",true) == 0)
            {
                new lastcar = P_LastVeh[playerid];
                new Float:lcX, Float:lcY, Float:lcZ;
                GetVehiclePos(lastcar, lcX, lcY, lcZ);
                if(IsPlayerInRangeOfPoint(playerid, 2, lcX, lcY, lcZ))
                {
                    if(GetPVarInt(playerid, "Hood") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,trunk,objective);
                        SetPVarInt(playerid, "Hood", 1);
                    }
                    else if(GetPVarInt(playerid, "Hood") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,hood,trunk,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,trunk,objective);
                        SetPVarInt(playerid, "Hood", 0);
                    }
                    return 1;
                }
                else {
                    SendClientMessage(playerid,COLOR_WHITE,"[Vehicle Control] You're not in range of your last vehicle!");
                    return 1;
                }
            }
if that dont make any diffrence try printing both positions and see if your just out or there miles out
coz i kinda remember something like when you get a empty vehicles pos it returns the pos where it spawned
not where it is now not 100% on that though
Nah, same thing, doesn't work outside the car within the range.
Reply
#6

did you print the player and vehicle pos's?
Reply
#7

No, I've got the "&&"s so you have to be within range of the vehicle, but it only works if you IN it, it doesn't make sense.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)