Using vehicle controls outside of the vehicle with range point. -
Jack_Leslie - 28.06.2011
Fixed
Re: Using vehicle controls outside of the vehicle with range point. -
Jack_Leslie - 28.06.2011
Код:
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.
Re: Using vehicle controls outside of the vehicle with range point. -
Jack_Leslie - 28.06.2011
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;
}
Re: Using vehicle controls outside of the vehicle with range point. -
(SF)Noobanatior - 28.06.2011
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
Re: Using vehicle controls outside of the vehicle with range point. -
Jack_Leslie - 28.06.2011
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.
Re: Using vehicle controls outside of the vehicle with range point. -
(SF)Noobanatior - 28.06.2011
did you print the player and vehicle pos's?
Re: Using vehicle controls outside of the vehicle with range point. -
Jack_Leslie - 28.06.2011
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.