AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restrict use function (https://forums.alliedmods.net/showthread.php?t=333051)

Barlap 06-16-2021 16:11

Restrict use function
 
Hello guys, can somebody help me with a code ?
I need to restrict Use function(pressing E button) but also add a cvar for exemple when sv_blockuse 1 dont' let players press E

Shadows Adi 06-16-2021 16:34

Re: Restrict use function
 
PHP Code:

/* Sublime AMXX Editor v4.2 */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

public plugin_init()
{
    
register_forward(FM_CmdStart"fw_CmdStart")
}

public 
fw_CmdStart(iducseed)
{
    static 
buttons
    buttons 
get_uc(ucUC_Buttons)
    
    if (
buttons IN_USE)
    {
        
buttons &= ~IN_USE
        set_uc
(ucUC_Buttonsbuttons)
        return 
FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED



CrazY. 06-16-2021 16:37

Re: Restrict use function
 
You should hook Ham_Use for every usable entity and return HAM_SUPERCEDE.


All times are GMT -4. The time now is 02:31.

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