SA-MP Forums Archive
Help Me, Operation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Me, Operation (/showthread.php?tid=589417)



Help Me, Operation - Jastak - 18.09.2015

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.


Re: Help Me, Operation - Andre02 - 18.09.2015

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

This is what you need.


Re: Help Me, Operation - Jastak - 18.09.2015

Please Andre02 look the picture again.


AW: Help Me, Operation - Nero_3D - 19.09.2015

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


Re: Help Me, Operation - Jastak - 19.09.2015

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


AW: Re: Help Me, Operation - Nero_3D - 19.09.2015

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


Re: Help Me, Operation - M0HAMMAD - 19.09.2015

can you give more details !