Raised This Month: $ Target: $400
 0% 

Non-Moving player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-19-2007 , 19:17   Non-Moving player
Reply With Quote #1

How would I get to know if the player is standing still for (x) amount of time and is on the ground? And what would I have to: register_event to
FormulaZero is offline
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
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-19-2007 , 19:29   Re: Non-Moving player
Reply With Quote #3

So, this would moniter when they are not moving 'camping' this isn't going to be the full code though. ;)

Code:
 #include <amxmodx>  #include <fakemeta>    #define PLUGIN "Punish The Camper"  #define VERSION "1.0"  #define AUTHOR "FormulaZero"  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:time = get_gametime()     if(velocity[1] || velocity[0] || velocity[2] || !(pev(id,pev_frags) & FL_OFFGROUND))         lastMove[id] = time     if(time-lastMove[id] >= 10.7)     {         client_print(id,print_chat,"[*]You havn't moved for 11 seconds, you will now be punished")         lastMove[id] = time     }     return FMRES_IGNORED  }


Last edited by FormulaZero; 02-19-2007 at 19:36.
FormulaZero is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 02-19-2007 , 19:34   Re: Non-Moving player
Reply With Quote #4

post in small tags..
__________________
i stop around here and there.
Da_sk8rboy is offline
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-19-2007 , 19:36   Re: Non-Moving player
Reply With Quote #5

I have edited it.
FormulaZero is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-19-2007 , 19:44   Re: Non-Moving player
Reply With Quote #6

Probably. But there is no FL_OFFGROUND, only FL_ONGROUND (which is why I use !, for NOT).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SpikeyHair
BANNED
Join Date: Feb 2007
Old 02-21-2007 , 07:53   Re: Non-Moving player
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
Probably. But there is no FL_OFFGROUND, only FL_ONGROUND (which is why I use !, for NOT).
Thank you Avalanche this helped me to. good luck formula
SpikeyHair is offline
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-19-2007 , 19:48   Re: Non-Moving player
Reply With Quote #8

Ah, okay.
FormulaZero 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 07:56.


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