SA-MP Forums Archive
meters player have ran - 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)
+--- Thread: meters player have ran (/showthread.php?tid=548124)



meters player have ran - Onfroi - 27.11.2014

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.


Re: meters player have ran - M4D - 27.11.2014

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


Re: meters player have ran - Onfroi - 27.11.2014

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 :/


Re: meters player have ran - Pottus - 27.11.2014

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


Re: meters player have ran - M4D - 27.11.2014

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