Angle?
#1

How can I make if player will write a command it will turn his angle to the nearest vehicle?
Reply
#2

if you don't understand something feel free to ask...
Reply
#3

For what actually do you need this, it's very unrealistic to just rapidly 'look at' a vehicle.
As to how to do it, getting the angle between the two coords, use atan2 (or search for SetPlayerFacePoint by RyDeR` I think).
Reply
#4

Well it for /plantbomb command when player will write that command near one car it will automaticly turn him towards that car he is near and apply animation "planting bomb"... that's why I need that
Reply
#5

Bump
Reply
#6

Not sure if you mean this:
pawn Код:
stock SetPlayerFacePlayer(playerid, vehicleid)
{
    new Float:Px, Float:Py, Float: Pa;
    GetPlayerPos(playerid, Px, Py, Pa);
    new Float:fpX, Float:fpY, Float: fpZ;
    GetVehiclePos(vehicleid, fpX, fpY, fpZ);
    Pa = floatabs(atan((fpY-Py)/(fpX-Px)));
    if(fpX <= Px && fpY >= Py) Pa = floatsub(180, Pa);
    else if(fpX < Px && fpY < Py) Pa = floatadd(Pa, 180);
    else if(fpX >= Px && fpY <= Py) Pa = floatsub(360.0, Pa);
    Pa = floatsub(Pa, 90.0);
    if(Pa >= 360.0) Pa = floatsub(Pa, 360.0);
    if(!IsPlayerInAnyVehicle(playerid)) SetPlayerFacingAngle(playerid, Pa);
    else SetVehicleZAngle(GetPlayerVehicleID(playerid), Pa);
}
And not sure who made this, but i've edited it to be like you want.
Reply
#7

More then great, rep+ for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)