AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block Kill (https://forums.alliedmods.net/showthread.php?t=134514)

GXLZPGX 08-05-2010 16:40

Block Kill
 
I used the same method to block kill as I did with blocking drop:

PHP Code:

register_clcmd"drop""cmdDrop" )
register_clcmd"kill""cmdKill" 

PHP Code:

public cmdDrop(id)
{
    if( !
is_user_alive(id) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
gLastRequest == true && gToss == false  )
    {
        
client_print_coloridBlue"^4[Jailbreak] ^1You can't drop your weapon during a last request^4!" )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


PHP Code:

public cmdKill(id)
{
    if( !
is_user_alive(id) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
gInLR[id] == true  )
    {
        
client_print_coloridBlue"^4[Jailbreak] ^1You can't kill yourself during a last request^4!" )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


But for some reason it wont work :(..

ConnorMcLeod 08-05-2010 16:43

Re: Block Kill
 
Use search button.

GXLZPGX 08-05-2010 16:44

Re: Block Kill
 
Quote:

Originally Posted by ConnorMcLeod (Post 1262570)
Use search button.

What I'm trying to ask, is why wont it work the same way as my drop command hook?

wrecked_ 08-05-2010 16:52

Re: Block Kill
 
It's not a hookable command.

Search for FM_ClientKill.

GXLZPGX 08-05-2010 16:56

Re: Block Kill
 
PHP Code:

register_forward(FM_ClientKill"cmdKill"

PHP Code:

public cmdKill(id)
{
    if( 
gInLR[id] == true  )
    {
        
client_print_coloridBlue"^4[Jailbreak] ^1You can't kill yourself during a last request^4!" )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;



wrecked_ 08-05-2010 17:03

Re: Block Kill
 
PLUGIN_HANDLED -> FMRES_SUPERCEDE
PLUGIN_CONTINUE -> FMRES_IGNORED

ConnorMcLeod 08-05-2010 17:39

Re: Block Kill
 
Code:

#define FMRES_IGNORED        1        // Calls target function, returns normal value
#define FMRES_HANDLED        2        // Tells metamod you did something, still calls target function and returns normal value
#define FMRES_OVERRIDE        3        // Supposed to still call the target function but return your value instead
                                                        // however this does not work properly with metamod; use supercede instead.
#define FMRES_SUPERCEDE        4        // Block the target call, and use your return value (if applicable)


Raddish 08-05-2010 22:09

Re: Block Kill
 
PHP Code:

if (gInLR[id] == true  )
->
if (gInLR[id]) 


shuttle_wave 08-06-2010 01:02

Re: Block Kill
 
PHP Code:

if( gLastRequest && gToss



All times are GMT -4. The time now is 00:17.

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