This is interesting topic, as I was trying to do something similar to this before.
Unfortunately, there is no way to actually do this (perfectly at least). As with SetPlayerVelocity there isn't a rotation parameter, so only allowing the velocity to push the player in a straight direction (unless there is another way that I'm not aware of, but I'm sure that would take a lot of calculations anyway). The way I made a decent look alike of this was:
- Get the radius of the circle and the position the player is at
- Have a low millisecond timer (200 for example) and select a different angle from the radius
- Use cosine and sin functions to calculate the X and Y from the position to circle based on angle
- Use SetPlayerVelocity to move the player towards that point (in correspondence to the update of the timer)
The function I used to get the new XY coordinates was GetXYInFrontOfPoint, a edit of GetXYInFrontOfPlayer, by ******:
pawn Код:
GetXYInFrontOfPoint( &Float: x, &Float: y, Float: angle, Float: distance ) {
x += ( distance * floatsin( -angle, degrees ) );
y += ( distance * floatcos( -angle, degrees ) );
}
Note it also took me FOREVER to make it look anywhere decent trying to balance the velocity to move the player by and how frequently the timer would update the velocity.