Raised This Month: $32 Target: $400
 8% 

Solved How to turn off moving keys?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iGANGNAM
AlliedModders Donor
Join Date: Sep 2012
Location: Lithuania
Old 08-25-2016 , 05:54   How to turn off moving keys?
Reply With Quote #1

How to turn off moving keys? I tried OnRunCmd but didn't helped.

Code:
	if(IsBeingPulled(client)) {
		if (getTeam(client) == CS_TEAM_CT) {
			if(buttons & IN_FORWARD || buttons & IN_BACK || buttons & IN_LEFT || buttons & IN_RIGHT || buttons & IN_WALK)
				return Plugin_Handled;
		} else {
			return Plugin_Continue;
		}
	}
In other code part I use TeleportEntity( target, NULL_VECTOR, NULL_VECTOR, fl_Velocity); and when player press backwards key (S) it just stops teleports. (Prevents moving)
__________________

Last edited by iGANGNAM; 08-25-2016 at 08:26.
iGANGNAM is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-25-2016 , 06:06   Re: How to turn off moving keys?
Reply With Quote #2

See: https://forums.alliedmods.net/showthread.php?t=286297

Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2]) {     if(client >= 1 && client <= MaxClients && IsClientInGame(client))     {         if(IsBeingPulled(client))         {             if (getTeam(client) == CS_TEAM_CT)             {                 if(buttons & IN_FORWARD || buttons & IN_BACK || buttons & IN_LEFT || buttons & IN_RIGHT || buttons & IN_WALK)                 {                     //Strip all the movement keys, I know this can be done in one line, but I prefer make it this way.                     buttons &= ~IN_FORWARD;                     buttons &= ~IN_BACK;                     buttons &= ~IN_LEFT;                     buttons &= ~IN_RIGHT;                     buttons &= ~IN_WALK;                 }             }         }     } }
__________________
Benoist3012 is offline
iGANGNAM
AlliedModders Donor
Join Date: Sep 2012
Location: Lithuania
Old 08-25-2016 , 08:26   Re: How to turn off moving keys?
Reply With Quote #3

Seem to be working thanks.
__________________
iGANGNAM is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 08-25-2016 , 19:26   Re: How to turn off moving keys?
Reply With Quote #4

I'd recommend not doing it that way because it can be bypassed with hacks. Instead do vel[0] = 0.0 & vel[1] = 0.0
blaacky is offline
Reply


Thread Tools
Display Modes

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


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