Raised This Month: $ Target: $400
 0% 

Jailbreak Box can kill each other CT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 10-15-2014 , 13:28   Jailbreak Box can kill each other CT
Reply With Quote #1

I have a problem, I run the Box fast Enabled and Disable
So at the same time you can quickly kill the CT, and I just run enable it does not kill ..

Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < hamsandwich >
#include < ColorChat >

#define PLUGIN "Jailbreak Box Menu"
#define VERSION "1.1"
#define AUTHOR "CheezPuff aka Fuck For Fun ;]"

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd( "say /box", "cmdBox" );
    
    register_logevent( "CmdRoundStart", 2, "1=Round_Start" );
    RegisterHam( Ham_TakeDamage, "player", "HamTakeDamage" );
}

public CmdRoundStart()
{
    server_cmd( "mp_friendlyfire 0" );
}

public cmdBox( client )
{              
         if ( !is_user_alive( client ) || cs_get_user_team( client ) != CS_TEAM_CT )
         {
                ColorChat( client, GREEN, "[Jailbreak] ^1You must to be^x03 Alive Guards^x01 to do this^x04 command.");
                return 1;
         }
    
    new szMenu[ 50 ], iMenu;
    formatex( szMenu, charsmax( szMenu ), "\r[Jailbreak] \wBox Menu \d/*Built By \yCheezPuff\d");

    iMenu = menu_create( szMenu, "sub_box" );
    
    menu_additem( iMenu, "Box \yActive");
    menu_additem( iMenu, "Box \yDeactive^n");
    menu_additem( iMenu, "Reset Health : \r[ \wTerrorist \r]" );

    menu_display( client, iMenu, 0 );
    return PLUGIN_HANDLED;
}

public sub_box(client, iMenu, item)
{      
    if( item == MENU_EXIT )
        return 1;
       
    switch( item )
    {
        case 0:
        {
            server_cmd( "mp_friendlyfire 1" );
            set_hudmessage(random_num(1,250), random_num(1,255), random_num(1,256), -1.0, -1.0, 0, 6.0, 12.0);
            show_hudmessage(0, "Gurad: %s - Active Box", szName);
            ColorChat( 0, GREEN, "[Jailbreak]^1 Guard:^3 %s ^1- Active ^4Box", szName( client ) );
        }
        
        case 1:
        {
            server_cmd( "mp_friendlyfire 0" );
            set_hudmessage(random_num(1,255), random_num(1,255), random_num(1,255), -1.0, -1.0, 0, 6.0, 12.0);
            show_hudmessage(0, "Gurad: %s - Disactived JailBreak Box",szName);
            ColorChat( 0, GREEN, "[Jailbreak]^1 Guard:^3 %s ^1- Disactived ^4Box", szName( client ) );
        }
        
        case 2:
        {
                           new players[ 32 ], pnum;
                           get_players( players, pnum, "aceh", "TERRORIST" );
                       
                           for(new i = 1; i <= pnum; i++)
                           fm_set_user_health( i, 100 );
 
                           ColorChat( 0, GREEN, "[Jailbreak]^3 %s^1 has reseted HP To ^4Prisoner's^1 Team!", szName( client ));
                        
                           cmdBox( client );
                           return 1;
                }              
        }
 
        return 1;
}

public HamTakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
{
        if ( !is_user_connected( attacker ) || !is_user_alive( attacker ) )
                return HAM_IGNORED;
       
        return ( cs_get_user_team( attacker ) == CS_TEAM_CT && cs_get_user_team( victim ) == cs_get_user_team( attacker ) ?  HAM_SUPERCEDE : HAM_IGNORED);

stock GetUserName( client )
{
    static szName[ 32 ];
    
    get_user_name( client, szName, charsmax( szName ) );
    
    return szName;
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-16-2014 , 15:29   Re: Jailbreak Box can kill each other CT
Reply With Quote #2

use ( set_pcvar_num ) instead of ( server_cmd )

PHP Code:
new g_cvar_box

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say /box""cmdBox" );
    
    
register_logevent"CmdRoundStart"2"1=Round_Start" );
    
RegisterHamHam_TakeDamage"player""HamTakeDamage" );
    
    
g_cvar_box get_cvar_pointer("mp_friendlyfire")
}

public 
CmdRoundStart()
{
    
set_pcvar_num(g_cvar_box0)
}

public 
cmdBoxclient )
{              
    if ( !
is_user_aliveclient ) || cs_get_user_teamclient ) != CS_TEAM_CT )
    {
          
ColorChatclientGREEN"[Jailbreak] ^1You must to be^x03 Alive Guards^x01 to do this^x04 command.");
          return 
PLUGIN_HANDLED
    
}
    
    new 
szMenu50 ], iMenu;
    
formatexszMenucharsmaxszMenu ), "\r[Jailbreak] \wBox Menu \d/*Built By \yCheezPuff\d");

    
iMenu menu_createszMenu"sub_box" );
    
    
menu_additemiMenu"Box \yActive");
    
menu_additemiMenu"Box \yDeactive^n");
    
menu_additemiMenu"Reset Health : \r[ \wTerrorist \r]" );

    
menu_displayclientiMenu);
    return 
PLUGIN_CONTINUE;
}

public 
sub_box(clientiMenuitem)
{      
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
       
    switch( 
item )
    {
        case 
0:
        {
            
set_pcvar_num(g_cvar_box1)
            
set_hudmessage(random_num(1,250), random_num(1,255), random_num(1,256), -1.0, -1.006.012.0);
            
show_hudmessage(0"Gurad: %s - Active Box"GetUserName(client));
            
ColorChat0GREEN"[Jailbreak]^1 Guard:^3 %s ^1- Active ^4Box"GetUserName(client) );
        }
        
        case 
1:
        {
            
set_pcvar_num(g_cvar_box1)
            
set_hudmessage(random_num(1,255), random_num(1,255), random_num(1,255), -1.0, -1.006.012.0);
            
show_hudmessage(0"Gurad: %s - Disactived JailBreak Box"GetUserName(client));
            
ColorChat0GREEN"[Jailbreak]^1 Guard:^3 %s ^1- Disactived ^4Box"GetUserName(client) );
        }
        
        case 
2:
        {
               new 
players32 ], pnum;
               
get_playersplayerspnum"aceh""TERRORIST" );
               
               for(new 
0pnumi++)
                        
fm_set_user_healthplayers[i], 100 );
 
               
ColorChat0GREEN"[Jailbreak]^3 %s^1 has reseted HP To ^4Prisoner's^1 Team!"GetUserName(client));
               
               
cmdBoxclient );
        }              
    }
    return 
PLUGIN_HANDLED
}

public 
HamTakeDamagevictiminflictorattackerFloat:damagedamagebits )
{
        if (!
get_pcvar_num(g_cvar_box))
                       return 
HAM_IGNORED
        
if ( (!is_user_connectedattacker ) || !is_user_aliveattacker ))  && (!is_user_connected(victim) || !is_user_alivevictim )))
                return 
HAM_IGNORED;
       
        static 
CsTeams:AteamCsTeams:Vteam
        Ateam 
cs_get_user_team(attacker)
        
Vteam cs_get_user_team(victim)
        if(
Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)
                   return 
HAM_SUPERCEDE
        
return HAM_IGNORED
}

stock GetUserNameclient )
{
    static 
szName32 ];
    
    
get_user_nameclientszNamecharsmaxszName ) );
    
    return 
szName;


Last edited by Natsheh; 10-17-2014 at 11:15. Reason: Fixing
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-16-2014 , 15:33   Re: Jailbreak Box can kill each other CT
Reply With Quote #3

DON'T use set_cvar_num, use set_pcvar_num.
__________________
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-16-2014 , 15:47   Re: Jailbreak Box can kill each other CT
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
DON'T use set_cvar_num, use set_pcvar_num.

the cvar is already exist why use set_pcvar_num???
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-16-2014 , 16:03   Re: Jailbreak Box can kill each other CT
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
the cvar is already exist why use set_pcvar_num???
You should always be using pCVars. Each call to *et_cvar_* results in a complete search of the CVar list until it finds the CVar it needs. Using *et_pcvar_*, you only search through the list once (if using get_cvar_pointer) or you know exactly where the CVar is (when using register_cvar)
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-16-2014 , 16:13   Re: Jailbreak Box can kill each other CT
Reply With Quote #6

Quote:
Originally Posted by YamiKaitou View Post
You should always be using pCVars. Each call to *et_cvar_* results in a complete search of the CVar list until it finds the CVar it needs. Using *et_pcvar_*, you only search through the list once (if using get_cvar_pointer) or you know exactly where the CVar is (when using register_cvar)
Thanks for the information!

Last edited by Natsheh; 10-16-2014 at 16:14.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 10-16-2014 , 17:55   Re: Jailbreak Box can kill each other CT
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
use ( set_cvar_num ) instead of ( server_cmd )

PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say /box""cmdBox" );
    
    
register_logevent"CmdRoundStart"2"1=Round_Start" );
    
RegisterHamHam_TakeDamage"player""HamTakeDamage" );
}

public 
CmdRoundStart()
{
    
server_cmd"mp_friendlyfire 0" );
}

public 
cmdBoxclient )
{              
         if ( !
is_user_aliveclient ) || cs_get_user_teamclient ) != CS_TEAM_CT )
         {
                
ColorChatclientGREEN"[Jailbreak] ^1You must to be^x03 Alive Guards^x01 to do this^x04 command.");
                return 
PLUGIN_HANDLED
         
}
    
    new 
szMenu50 ], iMenu;
    
formatexszMenucharsmaxszMenu ), "\r[Jailbreak] \wBox Menu \d/*Built By \yCheezPuff\d");

    
iMenu menu_createszMenu"sub_box" );
    
    
menu_additemiMenu"Box \yActive");
    
menu_additemiMenu"Box \yDeactive^n");
    
menu_additemiMenu"Reset Health : \r[ \wTerrorist \r]" );

    
menu_displayclientiMenu);
    return 
PLUGIN_CONTINUE;
}

public 
sub_box(clientiMenuitem)
{      
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
       
    switch( 
item )
    {
        case 
0:
        {
            
set_cvar_num("mp_friendlyfire"1)
            
set_hudmessage(random_num(1,250), random_num(1,255), random_num(1,256), -1.0, -1.006.012.0);
            
show_hudmessage(0"Gurad: %s - Active Box"szName);
            
ColorChat0GREEN"[Jailbreak]^1 Guard:^3 %s ^1- Active ^4Box"szNameclient ) );
        }
        
        case 
1:
        {
            
set_cvar_num("mp_friendlyfire"0)
            
set_hudmessage(random_num(1,255), random_num(1,255), random_num(1,255), -1.0, -1.006.012.0);
            
show_hudmessage(0"Gurad: %s - Disactived JailBreak Box",szName);
            
ColorChat0GREEN"[Jailbreak]^1 Guard:^3 %s ^1- Disactived ^4Box"szNameclient ) );
        }
        
        case 
2:
        {
                           new 
players32 ], pnum;
                           
get_playersplayerspnum"aceh""TERRORIST" );
                       
                           for(new 
0pnumi++)
                                       
fm_set_user_healthplayers[i], 100 );
 
                           
ColorChat0GREEN"[Jailbreak]^3 %s^1 has reseted HP To ^4Prisoner's^1 Team!"szNameclient ));
                        
                           
cmdBoxclient );
                           return 
PLUGIN_CONTINUE;
                }              
        }
 
        return 
PLUGIN_HANDLED;
}

public 
HamTakeDamagevictiminflictorattackerFloat:damagedamagebits )
{
        if ( (!
is_user_connectedattacker ) || !is_user_aliveattacker ))  && (!is_user_connectedvictim ) || !is_user_alivevictim ))
                return 
HAM_IGNORED;
       
        new 
Ateam fm_get_user_team(attacker)
        new 
Vteam fm_get_user_team(victim)
        if(
Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)
                   return 
HAM_SUPERCEDE
        HAM_IGNORE
}

stock GetUserNameclient )
{
    static 
szName32 ];
    
    
get_user_nameclientszNamecharsmaxszName ) );
    
    return 
szName;

i got 2 error:

Code:
public HamTakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
{
        if ( (!is_user_connected( attacker ) || !is_user_alive( attacker ))  && (!is_user_connected( victim ) || !is_user_alive( victim ) )
                return HAM_IGNORED;
       
        new Ateam = cs_get_user_team(attacker)
        new Vteam = cs_get_user_team(victim)
        if(Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)
                   return HAM_SUPERCEDE
        HAM_IGNORE
}
why u add HAM_IGNORE line?
and i think u missed more )
in last line
Code:
!is_user_alive( victim ) )
>
Code:
!is_user_alive( victim ) ) )
Code:
Warning: Function "HamTakeDamage" should return a value

Last edited by Fuck For Fun; 10-16-2014 at 17:56.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-17-2014 , 06:12   Re: Jailbreak Box can kill each other CT
Reply With Quote #8

Quote:
Originally Posted by Fuck For Fun View Post
i got 2 error:

Code:
public HamTakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
{
        if ( (!is_user_connected( attacker ) || !is_user_alive( attacker ))  && (!is_user_connected( victim ) || !is_user_alive( victim ) )
                return HAM_IGNORED;
       
        new Ateam = cs_get_user_team(attacker)
        new Vteam = cs_get_user_team(victim)
        if(Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)
                   return HAM_SUPERCEDE
        HAM_IGNORE
}
why u add HAM_IGNORE line?
and i think u missed more )
in last line
Code:
!is_user_alive( victim ) )
>
Code:
!is_user_alive( victim ) ) )
Code:
Warning: Function "HamTakeDamage" should return a value
alright i fixed it
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 10-17-2014 , 10:31   Re: Jailbreak Box can kill each other CT
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
alright i fixed it
Line:
Code:
        new Vteam = fm_get_user_team(victim)
        if(Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)
Quote:
Warning: Tag mismatch
Tag mismatch happens when something messy.

So I think the test of CT> CT can be done in a different way?
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-17-2014 , 11:17   Re: Jailbreak Box can kill each other CT
Reply With Quote #10

Quote:
Originally Posted by Fuck For Fun View Post
Line:
Code:
        new Vteam = fm_get_user_team(victim)
        if(Ateam == CS_TEAM_CT && Vteam == CS_TEAM_CT)

Tag mismatch happens when something messy.

So I think the test of CT> CT can be done in a different way?
alright i fix it again and no its a good way

the code is too messy.... ( part messy fixed )
No more warnings! and no more error's!
Compiles fine...

Last edited by Natsheh; 10-17-2014 at 11:18.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 02:40.


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