AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if someone isn't moving. (https://forums.alliedmods.net/showthread.php?t=192549)

Napoleon_be 08-11-2012 12:00

Check if someone isn't moving.
 
How do i check if someone isn't moving, if so set him invisible. From when he's moving again, i want to reset the invisibility

Arkshine 08-11-2012 12:05

Re: Check if someone isn't moving.
 
Check his velocity.

Napoleon_be 08-11-2012 12:33

Re: Check if someone isn't moving.
 
is there a tutorial on velocity usements?

Bugsy 08-11-2012 12:38

Re: Check if someone isn't moving.
 
PHP Code:

#include <fakemeta>

new Float:fVelocity];
pevid pev_velocity fVelocity ); 

Check the 3 values.

Napoleon_be 08-11-2012 12:39

Re: Check if someone isn't moving.
 
which function should i use for this? Cmd_Start?

Bugsy 08-11-2012 12:48

Re: Check if someone isn't moving.
 
Sure, you could check for buttons there and then check velocity:
PHP Code:

#define IN_JUMP                         (1<<1)
#define IN_FORWARD                      (1<<3)
#define IN_BACK                         (1<<4)
#define IN_MOVELEFT                     (1<<9)
#define IN_MOVERIGHT                    (1<<10) 


ConnorMcLeod 08-11-2012 13:00

Re: Check if someone isn't moving.
 
Player can move without holding a key (falling, end of run, jump, ...)

About where to check, it more depends on what you want to do exactly.

fysiks 08-11-2012 13:07

Re: Check if someone isn't moving.
 
You can check it whenever you want. If you put it in a function that is not called often then they will be able to move and remain visible for between executions of the code. If you want to have them become visible immediately when they move then you need to use a function that is called very often.

Quote:

Originally Posted by Napoleon_be (Post 1769301)
is there a tutorial on velocity usements?

What kind of word is that?

ConnorMcLeod 08-11-2012 13:19

Re: Check if someone isn't moving.
 
Oh, you want to set invisible, i think you could use a 0.1 looping task, would be enough, no one could bypass this :)

Napoleon_be 08-11-2012 19:11

Re: Check if someone isn't moving.
 
Quote:

Originally Posted by ConnorMcLeod (Post 1769340)
Oh, you want to set invisible, i think you could use a 0.1 looping task, would be enough, no one could bypass this :)

So i can set this task in plugin_init or? Is it better to use ham_spawn?


All times are GMT -4. The time now is 05:43.

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