AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Block E (https://forums.alliedmods.net/showthread.php?t=325352)

jugule 06-18-2020 06:15

Block E
 
Hi, I have a restriction on the E key to not be able to take weapons from the buttons, the phase is that I can't open any door, because I have the E key locked so as not to take weapons from the buttons. My question is, how can I block it so that it can no longer take weapons from the buttons, but go open doors? (CS: GO)

actual code in OnPlayerRunCmd

Code:

if(Test)
        {
                if (buttons & IN_USE)
                {
                        buttons &= ~IN_USE;
                }
        }

/

andi67 06-18-2020 08:36

Re: Block E
 
Just add a check if it is a weapon or if it is a func_door.......

Ilusion9 06-18-2020 10:29

Re: Block E
 
GetClientAimTarget and check the classname if it's different than weapon_*

jugule 06-19-2020 18:53

Re: Block E
 
examples?

Kellan123 06-20-2020 03:51

Re: Block E
 
PHP Code:

#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

public Action:OnPlayerRunCmd(client, &buttons)
{
    if(
buttons IN_USE)
    {
        new 
target GetClientAimTarget(clientfalse);
        
        if(
target != -1)
        {
            if(
IsValidEntity(target))
            {
                new 
String:szClassname[64];
                
GetEntityClassname(targetszClassnamesizeof(szClassname));
                
                if(
StrContains(szClassname"func_button"false) != || StrContains(szClassname"func_rot_button"false) != 1)
                {
                    
buttons &= ~IN_USE;
                    
                    return 
Plugin_Changed;
                }
            }
        }
    }
    
    return 
Plugin_Continue;



zipcore 06-20-2020 11:26

Re: Block E
 
What about using SDKHook_WeaponCanUse and check if the player is IN_USE?

jugule 06-21-2020 21:19

Re: Block E
 
Quote:

Originally Posted by zipcore (Post 2706550)
What about using SDKHook_WeaponCanUse and check if the player is IN_USE?

one example?

Kellan123 06-22-2020 09:13

Re: Block E
 
https://forums.alliedmods.net/showthread.php?t=271450

jugule 06-22-2020 10:13

Re: Block E
 
Quote:

Originally Posted by Kellan123 (Post 2706819)

Not working...

Kellan123 06-22-2020 10:24

Re: Block E
 
Quote:

Originally Posted by jugule (Post 2706824)
Not working...

try my post again


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

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