meters player have ran
#1

Like the title says, I need to save the meters a player have ran around the server, not in car, but on-foot. Does anyone have an idea? I was thinking GetPlayerDistanceFromPoint, but I don't know if it would work, because that just gets the distance from a point to point, not exactly what I want.

Thanks in advance.
Reply
#2

I have an idea.
It isn't actually exact to calculate meters that a player run but works
Make some variables
1.player run and walk meters amount
2.player old pos
3.player new pos

For example
pawn Код:
new Float:pTotalmeters[MAX_PLAYERS];
new Float:pOldPos[MAX_PLAYERS][3];
new Float:pNewPos[MAX_PLAYERS][3];
Set a timer.
Every 1 second that timer call the callback, ger player position (with loop for all players) and get distance between player position and player old position (with old player pos variable that we defined) and add it to totalplayermeters variable
+= dis………..
And after this, update old player position with new poaition.

Srry i'm with my cellphone and i couldn't give you some examples
Hope i helped.
Good luck
Reply
#3

Quote:
Originally Posted by M4D
Посмотреть сообщение
I have an idea.
It isn't actually exact to calculate meters that a player run but works
Make some variables
1.player run and walk meters amount
2.player old pos
3.player new pos

For example
pawn Код:
new Float:pTotalmeters[MAX_PLAYERS];
new Float:pOldPos[MAX_PLAYERS][3];
new Float:pNewPos[MAX_PLAYERS][3];
Set a timer.
Every 1 second that timer call the callback, ger player position (with loop for all players) and get distance between player position and player old position (with old player pos variable that we defined) and add it to totalplayermeters variable
+= dis………..
And after this, update old player position with new poaition.

Srry i'm with my cellphone and i couldn't give you some examples
Hope i helped.
Good luck
Thanks, I'll keep that one in mind, although I'm gonna see if someone else got another idea, because using a 1 second timer won't do so well in my gamemode, I already have like 5+ timers :/
Reply
#4

A lot can happen in 1 second you really need to do this on the update to have any level of accuracy.
Reply
#5

Quote:
Originally Posted by Pottus
Посмотреть сообщение
A lot can happen in 1 second you really need to do this on the update to have any level of accuracy.
Yeah i told that it is't actually exact for example may be admin teleport player
And this system will return a big distance…
It's impossible to calculate exactly but other way is using physic
Its funny
Use player velocity and acceleration lol
X = 0.5 Ч a Ч tІ + VЧ t
Its possible but very difficult
Good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)