Posts: 723
Threads: 366
Joined: Jun 2016
Hi,
How to get back of player? i'am now using GetXYInBackOfPlayer, and AC_SetPlayerPosFindZ, what i want to do if player out from area teleport him back some meters. If he out, some time i give him kick, but there is times that player position is changing and he is teleport out from area, of course he get warnings, and kick that he is not in area. How to fix that?
Posts: 2,856
Threads: 6
Joined: Jun 2007
Reputation:
0
Well get the nearest border of your area and teleport him there because the back of the player could be anywhere (like when he is moving backwards)
Posts: 723
Threads: 366
Joined: Jun 2016
How to get nearest border?
Posts: 2,856
Threads: 6
Joined: Jun 2007
Reputation:
0
Depends on your area, is it a circle, a rectangle, a square or even a polygon
If you have a circle you just need to check if the distance from the middle of it and the player is higher than the radius and set him back to the radius
For a rectangle you get the x and the y distance and set the either x or the y value depends on which border the player is
Posts: 723
Threads: 366
Joined: Jun 2016
Current i have polygon, createdynamicpolygon, how to calculate?
Posts: 723
Threads: 366
Joined: Jun 2016
I don't understand that formulas...
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
Back of the player? get players facing angle, calculate a position with opposite of that with a 1 meter relative pos, it's literally one sin/cos away from you -_- (For sa-mp tho you'd need to use the angle itself)
Here's another hint, relative pos*sin + x, relativepos*cos + y
Thats as much help I can provide without literally giving you the code, if you can't write that ^ in pawn you need to learn more about pawn.
@Nero When calculating infront of something or behind it is usually 2D and sometimes a Z finder, hence it'd turn into a point relative to another point, that makes it too complicated.
Posts: 723
Threads: 366
Joined: Jun 2016
No, i just use back of player to back player, all i want to do don't let player out from zone, without using setplayerworldboundries