"jump" or "port" to the way being viewed
#1

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.
Reply
#2

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);
Reply
#3

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.
Reply
#4

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)