Raised This Month: $ Target: $400
 0% 

Non-Moving player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-19-2007 , 19:23   Re: Non-Moving player
Reply With Quote #2

Code:
 #include <amxmodx>  #include <fakemeta>  new Float:lastMove[33];  public plugin_init()  {     register_forward(FM_PlayerPreThink,"fw_playerprethink",1);  }  public fw_playerprethink(id)  {     static Float:velocity[3];     pev(id,pev_velocity,velocity);     new Float:gtime = get_gametime();     if(velocity[0] || velocity[1] || velocity[2] || !(pev(id,pev_flags) & FL_ONGROUND))         lastMove[id] = gtime;     if(gtime-lastMove[id] >= 5.0)     {         client_print(id,print_chat,"* You haven't moved for five seconds!");         lastMove[id] = gtime;     }     return FMRES_IGNORED;  }

This monitors when they move (have velocity) or get off the ground (FL_ONGROUND is not a part of their entity flags). Then, it records that time. It also checks to see if it's been 5.0 seconds since the last recorded time that they moved.

You'll probably want to not check this on death, and also reset the lastMove time on spawn.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
 



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 07:56.


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