Raised This Month: $ Target: $400
 0% 

how to know what speed the player is moving


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-21-2007 , 07:11   how to know what speed the player is moving
Reply With Quote #1

the best if in prethink function
__________________

Last edited by Voi; 04-21-2007 at 07:55.
Voi is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 04-21-2007 , 09:00   Re: how to know what speed the player is moving
Reply With Quote #2

Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    register_forward(FM_PlayerPreThink, "fm_playerthink", 1)
}

public fm_playerthink(id)
{
    if(!is_user_alive(id)) return FMRES_IGNORED
    new speed = get_currentspeed(id)
}


// stock for getting the current player speed
stock Float:get_currentspeed(id) 
{
    static Float:vel[3]
    pev(id,pev_velocity, vel)
    return vector_length(vel)
}
Hope that helps you!?

greetz regalis

PS: for further information look at my speedUP - plugin (http://forums.alliedmods.net/showthread.php?t=53603)
__________________
regalis is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-21-2007 , 10:09   Re: how to know what speed the player is moving
Reply With Quote #3

uh...
just a few changes:
PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_forward(FM_PlayerPreThink"fm_playerthink"1)
}

public 
fm_playerthink(id)
{
    if(!
is_user_alive(id)) return FMRES_IGNORED
    
new Float:speed get_currentspeed(id)
    
    
//what ever
    
\
    return 
FMRES_IGNORED
}


// stock for getting the current player speed
stock Float:get_currentspeed(id
{
    static 
Float:vel[3]
    
pev(id,pev_velocityvel)
    return 
vector_length(vel)

__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 04-21-2007 , 10:30   Re: how to know what speed the player is moving
Reply With Quote #4

Quote:
Originally Posted by Voi View Post
the best if in prethink function
It all depends on what you need it for.
[ --<-@ ] Black Rose is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-21-2007 , 11:02   Re: how to know what speed the player is moving
Reply With Quote #5

thx u all!

i need it for new recoil menagement(CS Reality mod)

and it use the prethink function, i will add it now


edit:

it works! i just need to rewrite recoil menagement
__________________

Last edited by Voi; 04-21-2007 at 12:55.
Voi 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 06:44.


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