Help Me, Operation
#1

Hi everybody, I just want help with it. I want make a function than gets a value depending of angle and position of vehicle.
An example of what I want:


PS: Sorry for my English and I wait what help me.
Reply
#2

GetVehiclePos - https://sampwiki.blast.hk/wiki/GetVehiclePos
GetVehicleZAngle - https://sampwiki.blast.hk/wiki/GetVehicleZAngle

This is what you need.
Reply
#3

Please Andre02 look the picture again.
Reply
#4

I guess you are searching for GetXYInFrontOfPlayer, works also inside vehicles

Otherwise you can use it to calculate any other position on the circle depending how you change the angle
Reply
#5

No, it isn't the what i want. That function not drops position behind of the car as in the example.
Reply
#6

Quote:
Originally Posted by Jastak
Посмотреть сообщение
No, it isn't the what i want. That function not drops position behind of the car as in the example.
The car looked like a point in the picture, couldn't determine in which direction is faces

So here you go, the function generalised
pawn Код:
GetXYAroundPlayer(playerid, & Float: X, & Float: Y, Float: distance, Float: angle) {
    new
        Float: A
    ;
    if(GetPlayerPos(playerid, X, Y, A)) {
        new
            vehicleid = GetPlayerVehicleID(playerid)
        ;
        if(vehicleid) {
            GetVehicleZAngle(vehicleid, A);
        } else {
            GetPlayerFacingAngle(playerid, A);
        }
        A += angle;
    X -= distance * floatsin(A, degrees);
    Y += distance * floatcos(A, degrees);
        return true;
    }
    return false;
}
To get the position behind use 180.0 for the angle
Reply
#7

can you give more details !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)