IsPlayerInFrontOfVehicle? -
Dusl12 - 04.06.2012
Is there some function like that? :S
I think, I saw something like that...
Re: IsPlayerInFrontOfVehicle? -
G-Force - 04.06.2012
Do you've picture?
i think i saw someone too like that...Some player drive while hes above the car.
Not infront...
lol
Re: IsPlayerInFrontOfVehicle? -
AndreT - 04.06.2012
There are plenty of functions that will get a position ahead of the player/vehicle (. Then you can use IsPlayerInRangeOfPoint to see if the player is within that area.
Quote:
Originally Posted by G-Force
Do you've picture?
i think i saw someone too like that...Some player drive while hes above the car.
Not infront...
lol
|
Sir, what the hell are you talking about?
AW: IsPlayerInFrontOfVehicle? -
Dusl12 - 04.06.2012
No, I mean infront ^^
For something, like if you're mechanic and want to repair a car, so you can check, if the player is in front of the car at the engine
Re: IsPlayerInFrontOfVehicle? -
Niko_boy - 04.06.2012
GetVehicleFacingAngel (idk if it acutaly exists )
GetPlayerFacingAngle
GetPlayerCameravector such stuff can be used to make what u want
Re: IsPlayerInFrontOfVehicle? -
AIped - 04.06.2012
maybe you can make your own using this function?
pawn Код:
stock GetXYInFrontOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetVehiclePos(vehicleid, x, y, a);
GetVehicleZAngle(vehicleid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Re: IsPlayerInFrontOfVehicle? -
G-Force - 04.06.2012
Quote:
Originally Posted by AndreT
There are plenty of functions that will get a position ahead of the player/vehicle (. Then you can use IsPlayerInRangeOfPoint to see if the player is within that area.
Sir, what the hell are you talking about?
|
I think im missunderstanding sorry.. lawl
Re: IsPlayerInFrontOfVehicle? -
Sandiel - 04.06.2012
pawn Код:
public OnGameModeInit()
{
SetTimer("IsPlayerInFrontOfCar", 1000, true);
return 1;
}
forward IsPlayerInFrontOfCar();
public IsPlayerInFrontOfCar()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:vehX, Float:vehY, Float:VehZ;
if(IsPlayerInRangeOfPoint(playerid, 2, vehX+1, vehY, vehZ))
{
// Your code here.
}
}
}
Re: IsPlayerInFrontOfVehicle? -
Dovydux - 20.11.2012
Quote:
Originally Posted by Sandiel
pawn Код:
public OnGameModeInit() { SetTimer("IsPlayerInFrontOfCar", 1000, true); return 1; }
forward IsPlayerInFrontOfCar(); public IsPlayerInFrontOfCar() { for(new i = 0; i < MAX_PLAYERS; i++) { new Float:vehX, Float:vehY, Float:VehZ; if(IsPlayerInRangeOfPoint(playerid, 2, vehX+1, vehY, vehZ)) { // Your code here. } } }
|
Would It be useable, if I edit It like this :
Код:
new Float:vehX, Float:vehY, Float:VehZ;
if(IsPlayerInRangeOfPoint(playerid, 2, vehX))
#pragma unused vehY
#pragma unused vehZ

-
Re: IsPlayerInFrontOfVehicle? -
iggy1 - 20.11.2012
Quote:
Originally Posted by Sandiel
pawn Код:
public OnGameModeInit() { SetTimer("IsPlayerInFrontOfCar", 1000, true); return 1; }
forward IsPlayerInFrontOfCar(); public IsPlayerInFrontOfCar() { for(new i = 0; i < MAX_PLAYERS; i++) { new Float:vehX, Float:vehY, Float:VehZ; if(IsPlayerInRangeOfPoint(playerid, 2, vehX+1, vehY, vehZ)) { // Your code here. } } }
|
That checks if a player is in range of a vehicle but it doesn't tell you if he is in front.