Is player in front of an object?
#1

Hi,

how can I check if a player is in the front of an object? I need such a function for my speed cameras.

The players speed should only be checked if the player is in the visible area of the speed camera (Object model: 18880).

Any ideas?
Reply
#2

Maybe it can hepl you

http://forum.sa-mp.com/showthread.ph...nFrontOfPlayer
pawn Code:
forward GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle);
public GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle) {
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    a += angle;
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)