AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   console cmd blocker (https://forums.alliedmods.net/showthread.php?t=171257)

FPcokE 11-03-2011 19:56

console cmd blocker
 
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("blocker""1.0""cokE")
    
    
register_clcmd("vote""vote_block")

    
register_clcmd("name""name_block")
}

public 
vote_block(id)
{
    
console_print(id"Ikke tilladt!")

    return 
PLUGIN_HANDLED
}

public 
name_block(id)
{
    
console_print(id"Ikke tilladt!")

    return 
PLUGIN_HANDLED


Can someone tell me why the name cmd doesnt get blocked but the vote does? ive also tryed with "kill" cmd, didnt work neither, pls help

kramesa 11-03-2011 20:03

Re: console cmd blocker
 
Test is:

PHP Code:

#include <amxmodx> 
#include <amxmisc>
#include <fakemeta> 

public plugin_init() 

    
register_plugin("Block change name and vote""1.0""kramesa"
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged"
    
register_clcmd("vote""CmdBlock")



public 
ClientUserInfoChanged(id

    static const 
name[] = "name" 
    
static szOldName[32], szNewName[32
    
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
    if( 
szOldName[0] ) 
    { 
        
get_user_info(idnameszNewNamecharsmax(szNewName)) 
        if( !
equal(szOldNameszNewName) ) 
        { 
            
set_user_info(idnameszOldName
            return 
FMRES_HANDLED 
        

    } 
    return 
FMRES_IGNORED 
}  

public 
CmdBlock(id)
{
    
console_print(id"Ikke tilladt!")
    return 
PLUGIN_HANDLED_MAIN;



FPcokE 11-03-2011 20:07

Re: console cmd blocker
 
Thanks alot but how does it work so that i can add more stuff like the "kill" cmd etc. in the future

FPcokE 11-03-2011 20:17

Re: console cmd blocker
 
Btw, i only want to block the player to change name him self, cause i got a script that allows me to force name change on the player, but with that i cant use that script either

FPcokE 11-03-2011 20:33

Re: console cmd blocker
 
is register_clcmd("name", "name_block") wrong? for me it doesnt make sense that it doesnt work like the vote cmd.

MyPc 11-04-2011 01:09

Re: console cmd blocker
 
Quote:

Originally Posted by FPcokE (Post 1589516)
is register_clcmd("name", "name_block") wrong? for me it doesnt make sense that it doesnt work like the vote cmd.

Edit button stop double or triple posting

fysiks 11-04-2011 01:36

Re: console cmd blocker
 
You can't register the "name" command. It is a client-side command.

Quote:

Originally Posted by MyPc (Post 1589579)
Edit button stop double or triple posting

Punctuation!

MyPc 11-04-2011 09:22

Re: console cmd blocker
 
Quote:

Originally Posted by fysiks (Post 1589592)
You can't register the "name" command. It is a client-side command.



Punctuation!

I wrote it while walking to school, I didn't have time to write a little comma..

joshknifer 11-04-2011 12:50

Re: console cmd blocker
 
http://t1.gstatic.com/images?q=tbn:A...X4PWsltvWvyWRL

MyPc 11-04-2011 14:16

Re: console cmd blocker
 
Quote:

Originally Posted by joshknifer (Post 1589907)

Nice one:wink:


All times are GMT -4. The time now is 14:19.

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