Raised This Month: $51 Target: $400
 12% 

How to detect...?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BLACO
Junior Member
Join Date: Dec 2007
Location: Espaņa / Spain
Old 02-11-2008 , 13:57   How to detect...?
Reply With Quote #1

How can I detect if a player is stopped even he is pressing a move key (IN_FORWARD, IN_BACKWARD , IN_LEFT , IN_RIGHT) ?

I mean a player is walking and then he touch a wall , player or entity which stop him.
__________________

Funny Post: http://forums.alliedmods.net/showthread.php?t=66485
PHP Code:
while (true){
system.out.println ("What what what???");
}
return 
incoherence
BLACO is offline
Send a message via Skype™ to BLACO
pharse
Senior Member
Join Date: Jan 2008
Location: Germany, BW
Old 02-11-2008 , 15:05   Re: How to detect...?
Reply With Quote #2

you could save and check the origin in PreThink, perhaps with a little tolerance range... dirty workaround though
__________________
pharse is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-11-2008 , 15:23   Re: How to detect...?
Reply With Quote #3

new Float:velocity[3];
pev( Client, pev_velocity, velocity );
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
BLACO
Junior Member
Join Date: Dec 2007
Location: Espaņa / Spain
Old 02-11-2008 , 15:25   Re: How to detect...?
Reply With Quote #4

Quote:
Originally Posted by Greenberet View Post
new Float:velocity[3];
pev( Client, pev_velocity, velocity );
With that, I can walk on X axis only, and, how can u detect if Im pressing IN_FORWARD or IN_LEFT (for example) and dont move???
__________________

Funny Post: http://forums.alliedmods.net/showthread.php?t=66485
PHP Code:
while (true){
system.out.println ("What what what???");
}
return 
incoherence

Last edited by BLACO; 02-11-2008 at 15:26. Reason: Sintax
BLACO is offline
Send a message via Skype™ to BLACO
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 02-11-2008 , 15:26   Re: How to detect...?
Reply With Quote #5

fakemeta
Code:
new iButton = pev(id, pev_button);
 
if(iButton & IN_FORWARD)
  //lolz, you go forward...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-11-2008 , 16:27   Re: How to detect...?
Reply With Quote #6

and no combine both snippets, and you can detect x,y, and z axis with the velocity not only x
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Old 02-11-2008, 16:33
pharse
This message has been deleted by pharse. Reason: misunderstood
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-11-2008 , 16:59   Re: How to detect...?
Reply With Quote #7

if the velocity is 0 then the player is not moving
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
BLACO
Junior Member
Join Date: Dec 2007
Location: Espaņa / Spain
Old 02-11-2008 , 17:05   Re: How to detect...?
Reply With Quote #8

Quote:
Originally Posted by Greenberet View Post
if the velocity is 0 then the player is not moving
I could press IN_FORWARD and IN_LEFT touching a wall. So, I whould move only on the direction of the wall. In this case, pressing IN_FORWARD and IN_LEFT should be the same that pressing IN_FORWARD (or IN_LEFT depending if I aiming perpendicular or parallel to the wall).


Sorry 4 my english, its maybe the reason u dont understand me.
__________________

Funny Post: http://forums.alliedmods.net/showthread.php?t=66485
PHP Code:
while (true){
system.out.println ("What what what???");
}
return 
incoherence
BLACO is offline
Send a message via Skype™ to BLACO
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-11-2008 , 17:15   Re: How to detect...?
Reply With Quote #9

Code:
new Float:velocity[3];
pev(id, pev_velocity, velocity);
if(pev(id, pev_flags) & FL_ONGROUND)
    velocity[0] = 0.0;
if(vector_length(velocity) > 0.0)
    // moving
else
    // not moving
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 02-12-2008 , 02:53   Re: How to detect...?
Reply With Quote #10

@Greenberet: I don't think that would work as that assumes wall must be on the x / y axis.
@X-olent: That wouldn't work as a person can be moving while touching a wall.
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
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 17:33.


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