Placing player 1 in front of player 2 by angle
#1

Hello, I'm making script, where you can tackle other person when you aim at him (with right click mark on him) and you are near him + press ENTER, both players will receive animation to fall down to ground, but I want to SetPlayerPos of the player 1 to second player but I want to set player 1 angle so he will be front facing player 2, and I don't know how to do this.
Reply
#2

Found those in Useful Functions, didn't use yet tho.
Код:
stock GetPointInfrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) //Credit to Sacky/Simon/****** for this, I haven't actually found out whos the original was
{
    new Float:angle,
	    Float:z;
    
    GetPlayerPos(playerid, x, y, z);
    
    GetPlayerFacingAngle(playerid, angle);
    
    if (IsPlayerInAnyVehicle(playerid))
	 {
		 GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
	 }
    
    x += (distance * floatsin(-angle + LookingAngle[playerid], degrees));

    y += (distance * floatcos(-angle + LookingAngle[playerid], degrees));
}
Код:
stock Float:AngleToPoint(Float:x,Float:y,Float:x1,Float:y1)
{
    new Float:newang = atan(floatabs((x-x1)/(y-y1)));
    if (x1 <= x && y1 >= y) newang += 90.0;
    else if (x1 < x && y1 < y) newang = -newang + 270.0;
    else if (x1 >= x && y1 <= y) newang += 270.0;
    else if (x1 > x && y1 > y) newang = 90.0 - newang;
    return newang;
}
Reply
#3

use 3DTryg.inc

https://github.com/AbyssMorgan/ADM/b...SAM/3DTryg.inc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)