PlayerBehindVehicle
#1

Hey, is there any stock for this?
Reply
#2

Not that I know of...

If you're thinking of doing something along the lines of a trunk system, in which you have to be close to a vehicle to open the trunk or the hood of the car, I suggest using ' GetVehiclePos ' and ' IsPlayerInRangeOfPoint ' together.
Reply
#3

I tried to do something like that:
pawn Код:
stock PlayerBehindVehicle(playerid)
{
    new Float:vX, Float:vY, Float:vZ, Float:vA;
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(VehicleInfo[i][carOwned] == 1)
        {
            GetVehiclePos(i, vX, vY, vZ);
            GetVehicleZAngle(i, vA);
            if(vA >= 270 && vA <= 360 && IsPlayerInRangeOfPoint(playerid, 2.0, vX-3.0, vY, vZ))
                return i;
            if(vA >= 180 && vA <= 270 && IsPlayerInRangeOfPoint(playerid, 2.0, vX, vY-3.0, vZ))
                return i;
            if(vA >= 90 && vA <= 180 && IsPlayerInRangeOfPoint(playerid, 2.0, vX+3.0, vY, vZ))
                return i;
            if(vA >= 0 && vA <= 90 && IsPlayerInRangeOfPoint(playerid, 2.0, vX, vY-3.0, vZ))
                return i;
        }
    }
    return INVALID_VEHICLE_ID;
}
It works on some positions. but I can't calculate all of them.... can someone help me?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=348044
Reply
#5

The stock there doesn't even works...
Reply
#6

You're not making yourself clear. Do you want a function that PUTS a player behind a vehicle, or a function that DETECTS when a player is behind a vehicle?
Reply
#7

DETECTS.!
Reply
#8

Nevermind.Sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)