Move player to facing angle ?
#2

I don't quite understand what you're asking but if you're looking to get the coordinates a certain distance in front of the player's position this function is extremely useful:

Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) {

	new Float:a;
	
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	
	if (GetPlayerVehicleID(playerid)) {
	
	    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	    
	}
	
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
	
}
Here's an example of how you could use it:

Код:
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetXYInFrontOfPlayer(playerid, pos[0], pos[1], 4.0);
Reply


Messages In This Thread
Move player to facing angle ? - by ignas1125 - 30.10.2014, 19:39
Re: Move player to facing angle ? - by quagga - 30.10.2014, 20:17
Re: Move player to facing angle ? - by ignas1125 - 30.10.2014, 20:24

Forum Jump:


Users browsing this thread: 1 Guest(s)