Player walk distance
How would you make a function that gets called for example each time player walks 100 units? I've tried saving their old origin and comparing it to the new in a task, but that is not a great solution as when the player falls, uses teleport of any kind or something similar, it shows greatly incorrect values.
I'm creating an achievement that gets unlocked after player moves 50000 units, therefore this should be called each 100 units so I can save accordingly. Thanks in advance. |
Re: Player walk distance
Heres how I did it a while back, if it's of any help (you get the idea, it's pretty self-explanatory);
Code:
|
Re: Player walk distance
Thanks, however that doesn't solve the problem with things such as teleports. Checking whether the difference in origins is higher than X should work though, as it's called too often.
|
Re: Player walk distance
store as static value oldorigins
and before do increement check if distance(old origin,new origin)<=10 if yes you can increement if no do nothing.. |
Re: Player walk distance
That's exactly what I've just said.
|
Re: Player walk distance
you can do it with task instead of using prethink like this:
PHP Code:
|
Re: Player walk distance
task for loop through 32 players... every 0.1 seconds?
.. witch uses 5-6natives? better to use one more variable and native get_time(halftime).. but why not to use only origins.. |
Re: Player walk distance
Quote:
@Sylwester: Thank you, this is exactly what I need. |
Re: Player walk distance
Quote:
|
Re: Player walk distance
if(timedifference(current,old)<0.1) skip;
else { .... calculate meters old_time=current. } |
| All times are GMT -4. The time now is 20:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.