IsPlayerInFrontOfVehicle?
#1

Is there some function like that? :S
I think, I saw something like that...
Reply
#2

Do you've picture?
i think i saw someone too like that...Some player drive while hes above the car.
Not infront...
lol
Reply
#3

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?
Reply
#4

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
Reply
#5

GetVehicleFacingAngel (idk if it acutaly exists )
GetPlayerFacingAngle
GetPlayerCameravector such stuff can be used to make what u want
Reply
#6

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));
}
Reply
#7

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
Reply
#8

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.
        }
    }
}
Reply
#9

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
-
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)