AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved How to turn off moving keys? (https://forums.alliedmods.net/showthread.php?t=286801)

iGANGNAM 08-25-2016 05:54

How to turn off moving keys?
 
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)

Benoist3012 08-25-2016 06:06

Re: How to turn off moving keys?
 
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;                 }             }         }     } }

iGANGNAM 08-25-2016 08:26

Re: How to turn off moving keys?
 
Seem to be working thanks.

blaacky 08-25-2016 19:26

Re: How to turn off moving keys?
 
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


All times are GMT -4. The time now is 21:56.

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