AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Completely remove +Use (https://forums.alliedmods.net/showthread.php?t=75031)

hleV 07-29-2008 10:44

Completely remove +Use
 
Hi. I want to completely remove +use ability for players.

Of course I've tried to search but it can't find me a word +use due to that word's shortness.

I've tried register_clcmd(), check IN_USE but unsuccessfuly.

I could do that with Ham_Use but I need all func_ list for that.

minimiller 07-29-2008 11:52

Re: Completely remove +Use
 
on client_connect use client_cmd("unbind e")
then on client_diconnect use client_cmd("bind e +use")
?

EDIT: Unless they dont have use binded to "e"... :(

Dr. Jan Itor 07-29-2008 12:14

Re: Completely remove +Use
 
just that won't stop them from rebinding it but i guess stopping that wouldn't be to hard

Jon 07-29-2008 14:15

Re: Completely remove +Use
 
Should work.

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_forward(FM_CmdStart, "fwdCmdStart"); } public fwdCmdStart(id, handle) {     if(!is_user_alive(id))         return FMRES_IGNORED;             static button;     button = get_uc(handle, UC_Buttons);                     if((button & IN_USE))         button = (button & ~IN_USE)                     set_uc(handle, UC_Buttons, button);             return FMRES_SUPERCEDE; }

Iwon 07-29-2008 14:53

Re: Completely remove +Use
 
PHP Code:


#include <amxmodx>

public plugin_init()
{
       
register_plugin("blocked Use","v1","AmXX")
       
register_clcmd("+use","blockuse")
       
register_clcmd("-use","blockuse")
}

public 
blockuse(id) {
        
client_cmd(id,"say Sorry Use is Blocked")
        return 
PLUGIN_HANDLED



hleV 07-29-2008 18:47

Re: Completely remove +Use
 
Thanks, Jon, it works.
Quote:

Originally Posted by Iwon (Post 661097)
PHP Code:

 
#include <amxmodx>
 
public plugin_init()
{
       
register_plugin("blocked Use","v1","AmXX")
       
register_clcmd("+use","blockuse")
       
register_clcmd("-use","blockuse")
}
 
public 
blockuse(id) {
        
client_cmd(id,"say Sorry Use is Blocked")
        return 
PLUGIN_HANDLED



I've already said that I've tested with register_clcmd(). It DOESN'T WORK!

hleV 07-29-2008 21:14

Re: Completely remove +Use
 
Well, Jon already gave me working code but still thanks for what you do.

hleV 08-01-2008 19:40

Re: Completely remove +Use
 
I've added a message that is printed before the FMRES_SUPERCEDE and when I connect to server it prints the message infinitely (like 10 times in sec), I didn't even press +Use button.

I believe it can cause lag. Any ideas how to solve it?

This is what I use:
PHP Code:

#include <amxmodx>
#include <fakemeta>
 
new amx_use
 
public plugin_init()
{
        
register_plugin("Disable +Use""1.0""Jon")
 
        
amx_use register_cvar("amx_use""0")
 
        
register_forward(FM_CmdStart"fwdCmdStart")
}
 
public 
fwdCmdStart(idhandleseed)
{
        if (!
is_user_alive(id))
                return 
FMRES_IGNORED
 
        
if (!get_pcvar_num(amx_use)) // I mean if amx_use is "0" or less
        
{      
                static 
button
                button 
get_uc(handleUC_Buttons)
 
                if (
button IN_USE)
                        
button = (button & ~IN_USE)
 
                
set_uc(handleUC_Buttonsbutton)
                
console_print(id"You have no access to that command")
 
                return 
FMRES_SUPERCEDE
        
}
 
        return 
FMRES_IGNORED



Drak 08-01-2008 20:26

Re: Completely remove +Use
 
I'd use this, but I might of messed something up.
Code:
#include <amxmodx> #include <fakemeta> new p_Enable public plugin_init() {     p_Enable = register_cvar("amx_use","0");     register_forward(FM_PlayerPreThink,"forward_PreThink"); } public forward_PreThink(id) {     if(!is_user_alive(id) || !get_pcvar_num(p_Enable))         return         static Button     pev(id,pev_button,Button);         if(Button & IN_USE)          set_pev(id,pev_button,Button & ~IN_USE); }

hleV 08-02-2008 09:26

Re: Completely remove +Use
 
Doesn't work. Can anyone help? I'm really out of ideas...


All times are GMT -4. The time now is 05:35.

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