Raised This Month: $13 Target: $400
 3% 

Block E


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jugule
Member
Join Date: Apr 2020
Old 06-18-2020 , 06:15   Block E
Reply With Quote #1

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;
		}
	}
/

Last edited by jugule; 06-18-2020 at 06:27.
jugule is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 06-18-2020 , 08:36   Re: Block E
Reply With Quote #2

Just add a check if it is a weapon or if it is a func_door.......
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 06-18-2020 , 10:29   Re: Block E
Reply With Quote #3

GetClientAimTarget and check the classname if it's different than weapon_*
__________________
Ilusion9 is online now
jugule
Member
Join Date: Apr 2020
Old 06-19-2020 , 18:53   Re: Block E
Reply With Quote #4

examples?
jugule is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-20-2020 , 03:51   Re: Block E
Reply With Quote #5

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;


Last edited by Kellan123; 06-22-2020 at 10:25. Reason: updated
Kellan123 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 06-20-2020 , 11:26   Re: Block E
Reply With Quote #6

What about using SDKHook_WeaponCanUse and check if the player is IN_USE?
__________________
zipcore is offline
jugule
Member
Join Date: Apr 2020
Old 06-21-2020 , 21:19   Re: Block E
Reply With Quote #7

Quote:
Originally Posted by zipcore View Post
What about using SDKHook_WeaponCanUse and check if the player is IN_USE?
one example?
jugule is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-22-2020 , 09:13   Re: Block E
Reply With Quote #8

https://forums.alliedmods.net/showthread.php?t=271450
Kellan123 is offline
jugule
Member
Join Date: Apr 2020
Old 06-22-2020 , 10:13   Re: Block E
Reply With Quote #9

Quote:
Originally Posted by Kellan123 View Post
Not working...
jugule is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-22-2020 , 10:24   Re: Block E
Reply With Quote #10

Quote:
Originally Posted by jugule View Post
Not working...
try my post again
Kellan123 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 13:17.


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