Raised This Month: $ Target: $400
 0% 

Detect how far someone walked.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-13-2010 , 18:59   Re: Detect how far someone walked.
Reply With Quote #1

Wrecked's way is using a reference point, so infact its the distance you walked away from that point. That's quite interesting, im wondering how u could do that.

this might work :

PHP Code:
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Grim"

new Walk[33]
new 
Float:OldOrigin[3]
new 
Float:DistWalked

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say walk""startwalk")
    
register_clcmd("say stop""stopwalk")
    
RegisterHam(Ham_Player_PreThink"player""FwdPreThink")
}

public 
startwalk(id)
{
    
Walk[id]++
    
pev(id,pev_origin,OldOrigin)
}

public 
stopwalk(id)
{
    
Walk[id]=0
    client_print
(id,print_chat"%d"floatround(DistWalked))
}

public 
FwdPreThink(id)
{
    if(
Walk[id])
    {
        new 
Float:Origin[3]
        
pev(id,pev_origin,Origin)
        
        
DistWalked get_distance_f(OldOriginOrigin)
        
        
pev(id,pev_origin,OldOrigin)
    }

__________________
I am out of order!

Last edited by grimvh2; 05-13-2010 at 19:08.
grimvh2 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