SA-MP Forums Archive
"jump" or "port" to the way being viewed - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: "jump" or "port" to the way being viewed (/showthread.php?tid=262670)



"jump" or "port" to the way being viewed - TehEbil - 18.06.2011

Hey guys,
I need some help;

I'd like to make a command which ports me like 10 metres in front of me.

So normally it would be sth like that:
SetPlayerPos(id, x+10, y, z) or y+10 ... but that just ports you along the x- or y-coordinates, not 10 metres the way being viewed.


So how can I make the command porting the player 10 metres from his angle?

Thank you very much in advande - TehEbil.


AW: "jump" or "port" to the way being viewed - Nero_3D - 18.06.2011

Search for GetXYInFrontOfPlayer

But basically its just

pawn Code:
new
    Float: X,
    Float: Y,
    Float: Z,
    Float: A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
SetPlayerPos(playerid,
    X - floatsin(A, degrees) * 10.0,
    Y + floatcos(A, degrees) * 10.0,
    Z);



Re: "jump" or "port" to the way being viewed - TehEbil - 19.06.2011

Thanks, it's for a friend, so he'll test it.

I'd had created sth like for i<360 in connection with f(x) = 450 - x where x is degree, but that was a bit too complicated, so I thought there would be an easier solution, and there is =)

ty again.


- TehEbil - 19.06.2011

Thanks, it's for a friend, so he'll test it.

I'd had created sth like for i<360 in connection with f(x) = 450 - x where x is degree, but that was a bit too complicated, so I thought there would be an easier solution, and there is =)

ty again.

//e:
sry for double posting...