SA-MP Forums Archive
SetPlayerPos Forward - 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: SetPlayerPos Forward (/showthread.php?tid=307413)



SetPlayerPos Forward - lukas567 - 30.12.2011

What script makes player position one point forward?


Re: SetPlayerPos Forward - fangoth1 - 30.12.2011

like this
Код HTML:
new Float:x, Float:y, Float:z, Float:ang;

GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, ang);

SetPlayerPos(playerid, x+10, y, z);
SetPlayerFacingAngle(playerid, ang)



Re: SetPlayerPos Forward - lukas567 - 30.12.2011

No... I need if you facing north, then you go one point forward to the north, if you facing east, then you go one point forward to the east


Re: SetPlayerPos Forward - Rob_Maate - 30.12.2011

GetPlayerCameraFrontVector is what your looking for.
Just set the player's position to ^ + 1


Re: SetPlayerPos Forward - lukas567 - 30.12.2011

Like this:

Код:
if (!strcmp(cmdtext, "/Test"))
	{
		new
			Float:fPX, Float:fPY, Float:fPZ,
			Float:fVX, Float:fVY, Float:fVZ,
			Float:object_x, Float:object_y, Float:object_z;
		const
			Float:fScale = 5.0;
 
		GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
		GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
 
		object_x = fPX + floatmul(fVX, fScale);
		object_y = fPY + floatmul(fVY, fScale);
		object_z = fPZ + floatmul(fVZ, fScale);
 
		SetPlayerPos(playerid, object_x, object_y, object_z);
 
		return 1;
	}



Re: SetPlayerPos Forward - lukas567 - 30.12.2011

Doesn't work
Im making new system, that if you crash with a car you will teleport one point forward...


Re: SetPlayerPos Forward - MP2 - 30.12.2011

Search for GetXYInfrontOfPlayer.