Raised This Month: $51 Target: $400
 12% 

Block suicide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MarLeo94
Junior Member
Join Date: Jul 2013
Location: Reino de Europa.
Old 03-09-2015 , 12:58   Block suicide
Reply With Quote #1

Hello, I have the following code assumes that serves to block suicide, is controlled by a cvar (0 off, 1 zombies can not commit suicide, 2 humans can not commit suicide, 3 no one can commit suicide), the problem is that does not work, what's the problem?

PHP Code:
cvar_blocksuicide register_cvar("zp_block_suicide""1"// 0 nobody, 1 zombies, 2 humans, 3 all 
PHP Code:
// Client Kill Forward
public fw_ClientKill(id)
{
    if(!
is_user_alive(id) && !is_user_connected(id)) {
        return 
FMRES_IGNORED;
    }
    
    
// Prevent players from killing themselves?
    
if(get_pcvar_num(cvar_blocksuicide) == && cs_get_user_team(id) == CS_TEAM_T) {
        
client_print(idprint_chat"[ZP] Los zombies no pueden suicidarse.");
        
client_print(idprint_console"[ZP] Los zombies no pueden suicidarse.");
        
        return 
FMRES_SUPERCEDE;
    }
    else if(
get_pcvar_num(cvar_blocksuicide) == && cs_get_user_team(id) == CS_TEAM_CT) {
        
client_print(idprint_chat"[ZP] Los humanos no pueden suicidarse.");
        
client_print(idprint_console"[ZP] Los humanos no pueden suicidarse.");
        
        return 
FMRES_SUPERCEDE;
    }
    else if(
get_pcvar_num(cvar_blocksuicide) == 3) {
        
client_print(idprint_chat"[ZP] No puedes suicidarte.");
        
client_print(idprint_console"[ZP] No puedes suicidarte.");
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;

PHP Code:
// 7. Join spec
    
if(!g_isalive[id] || get_pcvar_num(cvar_blocksuicide) == || (userflags g_access_flag[ACCESS_ADMIN_MENU])) {
        if((
get_pcvar_num(cvar_blocksuicide) == && cs_get_user_team(id) == CS_TEAM_CT
        || (
get_pcvar_num(cvar_blocksuicide) == && cs_get_user_team(id) == CS_TEAM_T)) {
            
len += formatex(menu[len], charsmax(menu) - len"\r7.\w %L^n^n"id"MENU_SPECTATOR")
        }
        else if(
get_pcvar_num(cvar_blocksuicide) == 3) {
            
len += formatex(menu[len], charsmax(menu) - len"\d7. %L^n^n"id"MENU_SPECTATOR")
        }
    }
    else {
        
len += formatex(menu[len], charsmax(menu) - len"\d7. %L^n^n"id"MENU_SPECTATOR")
    } 
PHP Code:
case 6// Join Spectator
        
{
            
// Player alive?
            
if(g_isalive[id]) {
                
// Prevent abuse by non-admins if block suicide setting is enabled
                
if(get_pcvar_num(cvar_blocksuicide) && !(get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU])) {
                    
zp_colored_print(id"^x04[ZP]^x01 %L"id"CMD_NOT")
                    
                    return 
PLUGIN_HANDLED;
                }
                
                
// Check that we still have both humans and zombies to keep the round going
                
check_round(id)
                
                
// Kill him before he switches team
                
dllfunc(DLLFunc_ClientKillid)
            }
code...

__________________

MarLeo94 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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