Raised This Month: $ Target: $400
 0% 

Detect how far someone walked.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 05-14-2010 , 23:27   Re: Detect how far someone walked.
Reply With Quote #1

Quote:
Originally Posted by Exolent[jNr] View Post
I've seen a unit->feet conversion or something similar on these forums before.
http://forums.alliedmods.net/showpos...40&postcount=9

I'm wondering from where did he got those values hmm
__________________
IneedHelp is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-13-2010 , 20:03   Re: Detect how far someone walked.
Reply With Quote #2

Thanks guys, does someone know how many feet or meter 1 unit is? Or isn't this done in-game. Cause it would be fun to see how many miles or kilometer you travelled.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-13-2010 , 20:11   Re: Detect how far someone walked.
Reply With Quote #3

Thanks Exolent, but now i don't know which version is the best. Your version seems way more complicated then wrecked_'s version. I'm a bit confused now.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-13-2010 at 20:18.
drekes is offline
Send a message via MSN to drekes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-13-2010 , 20:19   Re: Detect how far someone walked.
Reply With Quote #4

Well,
  • His uses xs, which is pretty much functions for math operations (like checking if vectors are equal, copying vectors)
  • Uses floats, slightly more accurate
  • Checks in PreThink if the old origin is equal to the current one, which kind of seems like unneeded function calls, since you'd just be calling one function anyway; you're calling two with that one
  • His also resets the distance on spawn, which is easily removable

It's up to you. They're just two very similar plugins with some small differences, such as float usage and methods of doing certain things.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-13-2010 , 20:23   Re: Detect how far someone walked.
Reply With Quote #5

Quote:
Originally Posted by wrecked_ View Post
Well,
  • Checks in PreThink if the old origin is equal to the current one, which kind of seems like unneeded function calls, since you'd just be calling one function anyway; you're calling two with that one
No, it doesn't.
That checks if it has saved an old origin already so that it can find a distance.
If that is the first origin of the player, say from spawn, then it doesn't add distance because there was no origin before that.

Also, yours doesn't reset each time player spawns (eg. new round) or when a new player connects for the same index.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-13-2010 , 20:30   Re: Detect how far someone walked.
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
No, it doesn't.
That checks if it has saved an old origin already so that it can find a distance.
If that is the first origin of the player, say from spawn, then it doesn't add distance because there was no origin before that.
Oh, alright. Just my speculations, I wasn't trying to say you were wrong.

Quote:
Originally Posted by Exolent[jNr] View Post
Also, yours doesn't reset each time player spawns (eg. new round)
That's because he said he was aiming for an achievements plugin, and in those kind of plugins people try to accumulate distance over a long period of time, not just one round. I would've done that same thing, but I've spoken to drekes about the aim of the plugin, so I guess he should've been more specific.

Quote:
Originally Posted by Exolent[jNr] View Post
or when a new player connects for the same index.
Now it does.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-13-2010 , 20:46   Re: Detect how far someone walked.
Reply With Quote #7

Thanks for your help, guys. And for the fast replies.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-13-2010 , 21:05   Re: Detect how far someone walked.
Reply With Quote #8

Quote:
Originally Posted by grimvh2 View Post
Wrecked's way is using a reference point, so infact its the distance you walked away from that point.
No. Maybe google for the terms in my post .
__________________
fysiks is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 05-13-2010 , 23:46   Re: Detect how far someone walked.
Reply With Quote #9

Sorry about this, I can see that you already got what you needed...But I think it would be much more easy to count how much time the user walked and with what speed and find the distance by using the formula D = S/T where D is the distance, S the speed and T the time...Just my opinion xD
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-14-2010 , 00:00   Re: Detect how far someone walked.
Reply With Quote #10

Quote:
Originally Posted by Brreaker View Post
D = S/T


D = S * T

But, I think it might actually be more complicated.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode