AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client-command kill forbidden (https://forums.alliedmods.net/showthread.php?t=40233)

sen-me 06-25-2006 06:16

client-command kill forbidden
 
the cvar mp_kill is 1

Code:

public client_kill(id)
{
    if(get_cvar_num("mp_kill"))
    {
        new name[32]
        get_user_name(id, name, 31)
        client_print(id, print_chat, "[%s] The command kill is forbidden!", name)
       
        return PLUGIN_HANDLED
    }
}


but why this dont work?

Gizmo 06-25-2006 07:54

Re: client-command kill forbidden
 
PHP Code:

if(get_cvar_num("mp_kill")) 

Should be

PHP Code:

if(get_cvar_num("mp_kill") == 1


sen-me 06-25-2006 08:11

Re: client-command kill forbidden
 
that i tried before, but it didnt work

v3x 06-25-2006 08:15

Re: client-command kill forbidden
 
Code:
public client_kill(id) {     if(get_cvar_num("mp_kill"))     {         new name[32]         get_user_name(id, name, 31)         client_print(id, print_chat, "[%s] The command kill is forbidden!", name)                 return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
If you're still having problems then show me the full code.

Gizmo 06-25-2006 08:16

Re: client-command kill forbidden
 
Can you show the rest of the code?

sen-me 06-25-2006 08:51

Re: client-command kill forbidden
 
thats only the pluginini with register_plugin and register_cvar

Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    register_plugin("No Kill", "1.0", "sen-me http://privat.multi-pages.de")
    register_cvar("mp_kill", "0")
}

public client_kill(id)
{
    if(get_cvar_num("mp_kill") == 1)
    {
        new name[32]
        get_user_name(id, name, 31)
        client_print(0, print_chat, "[%s] The command kill is forbidden!", name)
       
        return PLUGIN_HANDLED
    }
 
 return PLUGIN_CONTINUE
}

i set mp_kill on 1 and type kill in my console, but i die and no message apeared

v3x 06-25-2006 08:54

Re: client-command kill forbidden
 
Try this:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("No Kill", "1.0", "sen-me http://privat.multi-pages.de")     register_cvar("mp_kill", "0")     register_clcmd("kill" , "cmd_kill"); } public cmd_kill(id) {     if(get_cvar_num("mp_kill") == 1)     {         new name[32]         get_user_name(id, name, 31)         client_print(0, print_chat, "[%s] The command kill is forbidden!", name)                 return PLUGIN_HANDLED     }        return PLUGIN_CONTINUE }
I slightly modified your code & hooked the kill command to a function that should block it.

mysticssjgoku4 06-25-2006 08:54

Re: client-command kill forbidden
 
Are you setting the mp_kill to 1 in your config?

VEN 06-25-2006 09:51

Re: client-command kill forbidden
 
client_kill if from engine module.
You should add
PHP Code:

#include <engine> 

to the top.
Also kill can't be handled by register_clcmd.

Gizmo 06-25-2006 10:40

Re: client-command kill forbidden
 
Typing only "kill" in console does kill you even without amxmodx, itīs a "standard" command


All times are GMT -4. The time now is 07:57.

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