Raised This Month: $32 Target: $400
 8% 

Solved Glow on CT that has bomb.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-09-2017 , 20:41   Glow on CT that has bomb.
Reply With Quote #1

I am trying to make the CT with bomb have glow so that people can know who in the CT team has the bomb but the problem is that if the CT drops the bomb, then the glow doesn't disappear and even if the CT dies and has the bomb, the glow doesn't disappear. Please help me.

PHP Code:
#include <amxmodx>
#include <orpheu_memory>
#include <orpheu_stocks>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#pragma tabsize 0

#define get_mp_pdata(%1)    ( OrpheuMemoryGetAtAddress ( g_pGameRules, %1 ) )
#define set_mp_pdata(%1,%2)    ( OrpheuMemorySetAtAddress ( g_pGameRules, %1, 1, %2 ) )
#define m_pActiveItem        373
#define m_pNext            42
#define CSW_C4_SLOT        5
#define XO_CWEAPONBOX        4
#define XO_CBASEPLAYERITEM    4
#define MAX_DELAY        60
#define MAX_TIMER        540
#define MAX_MULTIPLIER        5.0

new const m_rgpPlayerItems_CBasePlayer[6] = { 367 368 , ... };
new const 
m_rgpPlayerItems_CWeaponBox[6] = { 34 35 , ... };
new 
booltoggle_PreThinkbooltype_valueboolMODE_NOSTEAL;
new 
bt_msgidrt_msgidsc_msgidsi_msgidsinfo_msgidg_pGameRules;
new 
delaytimer_cvartype_cvarcountdown_cvarmultiplier_cvardelaytimer_valuecountdown_valueround_timeleftupdate_timerhas_Delayhas_C4;
new 
Floatround_timestartFloatDelayStoreFloatLastDelayFloatmultiplier_value;
new 
thief[64];
new 
HamHookhandle_PreThink;

public 
plugin_init ( )
{
    
register_plugin "Steal C4""1.2""Souvik" );
    
register_cvar "sc4_version""1.2"FCVAR_SERVER );
    if ( 
find_ent_by_class ( -1"func_bomb_target" ) || find_ent_by_class ( -1"info_bomb_target" ) )
    {
        
handle_PreThink RegisterHam Ham_Player_PreThink"player""Ham_PreThink"false );
        
DisableHamForward handle_PreThink );
        
        
register_touch "weaponbox""player""C4_Touch" );
        
register_event "DeathMsg""DeathMsg" "a" );
        
register_message get_user_msgid "TextMsg" ), "TextMsg" );
        
register_logevent "Round_End"2"1=Round_End" );
        
register_logevent "Round_Start"2"1=Round_Start" );
        
register_logevent "Dropped_The_Bomb"3"2=Dropped_The_Bomb" );
        
        
delaytimer_cvar register_cvar "steal_delaytimer""1" );
        
type_cvar register_cvar "steal_type""1" )
        
countdown_cvar register_cvar "steal_timer""35" );
        
multiplier_cvar register_cvar "steal_multiplier""1.5" );
        
        
bt_msgid get_user_msgid "BarTime" );
        
rt_msgid get_user_msgid "RoundTime" );
        
sc_msgid get_user_msgid "Scenario" );
        
si_msgid get_user_msgid "StatusIcon" );
        
sinfo_msgid get_user_msgid "ScoreInfo" );
    }
    else
    {
        
server_print "[StealC4] Invalid Map Objective" );
        
pause "ad" );
    }
}

public 
plugin_precache ( )
{
    
OrpheuRegisterHook OrpheuGetFunction "InstallGameRules" ), "OnInstallGameRules"OrpheuHookPost );
    
precache_generic "sound/radio/bombst.wav" );
}

public 
OnInstallGameRules ( )
    
g_pGameRules OrpheuGetReturn ( ); 

public 
client_disconnect id )
{
    if ( 
has_Delay == id )
    {
        
StopDelay ( );
        return;
    }
    if ( 
has_C4 == id )
    {
        
has_C4 0;
        if ( !
countdown_value )
            return;    
        
RestoreRoundTimer ( );
    }
}

public 
Round_End ( )
{
    
MODE_NOSTEAL true;
    if ( !
has_C4 )
        return;
    static 
tempIDfrags;
    
tempID has_C4;
    
has_C4 0;
    
Execute_user_C4 tempIDtrue );
    
frags get_user_frags tempID ) + 3;
    
set_user_frags tempIDfrags );
    
message_begin MSG_BROADCASTsinfo_msgid );
    
write_byte tempID );
    
write_short frags );
    
write_short cs_get_user_deaths tempID ) );
    
write_short );
    
write_short );
    
message_end ( );
    
set_user_frags tempIDfrags );
}

public 
Round_Start ( )
{
    
MODE_NOSTEAL false;
    
delaytimer_value get_pcvar_num delaytimer_cvar );
    
clamp delaytimer_value0MAX_DELAY );
    
type_value get_pcvar_num type_cvar ) ? true false;
    
countdown_value get_pcvar_num countdown_cvar );
    
clamp countdown_value0MAX_TIMER );
    
multiplier_value get_pcvar_float multiplier_cvar );
    
floatclamp multiplier_value1.0MAX_MULTIPLIER );
    if ( !
countdown_value )
        return;
    
round_timestart get_gametime ( );
    if ( 
task_exists 80085 ) )
        
remove_task 80085 );
}

public 
DeathMsg ( )
{
    static 
id;
    
id read_data );
    if ( 
has_C4 == id )
    {
        
has_C4 0;
        
engclient_cmd id"drop""weapon_c4" );
        
message_begin MSG_ONE_UNRELIABLEsi_msgid_id );
        
write_byte );
        
write_string "c4" );
            
message_end ( );
        
get_user_name idthiefcharsmax thief ) );
        
client_print idprint_center"%s dropped the bomb"thief );
        if ( !
countdown_value )
            return;
        
RestoreRoundTimer ( );
    }    
}

public 
Dropped_The_Bomb ( )
{
    static 
idloguser[128];
    
read_logargv0logusercharsmax loguser ) );
    
parse_loguser loguserthiefcharsmax thief ) );
    
id get_user_index thief );
    if ( 
has_C4 != id )
        return;
    
has_C4 0;
    if ( !
countdown_value )
        return;
    if ( 
task_exists 80085 ) )
        
remove_task 80085 );
    
RestoreRoundTimer ( );
    
client_print idprint_center"%s dropped the bomb"thief );
}

public 
Ham_PreThink id )
{
    if ( 
has_Delay != id )
        return 
HAM_IGNORED
    
if ( ( get_gametime() - LastDelay 0.1 ) || ( type_value && !( get_user_button id ) & IN_USE ) ) )
        
StopDelay ( );
    return 
HAM_IGNORED
}

public 
C4_Touch entid )
{
    
// Primary Handle
    
if ( GetWeaponBoxType ent ) != CSW_C4
    
|| get_user_team id ) != 2
    
|| !( get_entity_flags ent ) & FL_ONGROUND )
    || 
MODE_NOSTEAL
    
|| has_C4 )
        return 
PLUGIN_CONTINUE
        
    
// Pre Save GameTime
    
static FloatGameTime;
    
GameTime get_gametime();
    
    
// Bar Time ( Delay )
    
if ( delaytimer_value )
    {
        if ( !
has_Delay )
        {
            if ( 
type_value && !( get_user_button id ) & IN_USE ) )
                return 
PLUGIN_CONTINUE
            DelayStore 
0.0;
            
LastDelay GameTime;
            
has_Delay id;
            if ( !
toggle_PreThink )
            {
                
EnableHamForward handle_PreThink );
                
toggle_PreThink true;
            }
            
message_begin MSG_ONE_UNRELIABLEbt_msgid_id );
            
write_short delaytimer_value );
            
message_end ( );
            
get_user_name idthiefcharsmax thief ) );
            
client_print 0print_center"%s is stealing the bomb!"thief );
            return 
PLUGIN_CONTINUE
        
}
        if ( 
has_Delay != id )
            return 
PLUGIN_CONTINUE
        
if ( DelayStore delaytimer_value 0.01 )
        {
            
DelayStore += GameTime LastDelay;
            
LastDelay GameTime;
            return 
PLUGIN_CONTINUE
        
}
        
StopDelay ( );
    }
    else if ( 
type_value && !( get_user_button id ) & IN_USE ) )  
        return 
PLUGIN_CONTINUE
    
    
// Turn On Steal Mode
    
entity_set_int entEV_INT_flagsentity_get_int entEV_INT_flags ) | FL_KILLME );
    
ExecuteHam Ham_Thinkent );
    
Execute_user_C4 idfalse );
    
has_C4 id;
    
client_print 0print_center"The bomb has been stolen!" );
    
client_cmd 0"spk sound/radio/bombst.wav" );
    new 
random_num(0,255)
    new 
random_num(0,255)
    new 
random_num(0,255)
    
set_user_rendering(idkRenderFxGlowShellrgbkRenderNormal150)
    
    
// Secondary Handle
    
if ( !countdown_value )
        return 
PLUGIN_CONTINUE
    
    
// Give Bomb StatusIcon to Player
    
message_begin MSG_ONE_UNRELIABLEsi_msgid_id );
    
write_byte );
    
write_string "c4" );
    
write_byte 225 );
    
write_byte 225 );
    
write_byte );
    
message_end ( );
    
    
// Steal Scenario
    
message_begin MSG_BROADCASTsc_msgid );
    
write_byte );
    
write_string "defuser" );
    
write_byte 255 );
    
write_short 100 );
    
write_short );
    
message_end ( );
    
    
// Time Control
    
static time_elapsedcountdown_filter_value;
    
countdown_filter_value floatround countdown_value * ( cs_get_user_defuse id ) ? 1.0 multiplier_value ) );
    
time_elapsed floatround GameTime round_timestart );
    
round_timeleft get_mp_pdata "m_iRoundTimeSecs" ) - time_elapsed;
    
set_mp_pdata "m_iRoundTimeSecs" countdown_filter_value time_elapsed );
    
message_begin MSG_BROADCASTrt_msgid );
    
write_short countdown_filter_value );
    
message_end ( );
    if ( 
countdown_filter_value 10 )
    {
        
update_timer countdown_filter_value;
        
CountDownTimer 80085 );
    }
    else
    {
        
update_timer 10;
        
set_task float countdown_filter_value ) - 10.0"CountDownTimer"80085 );
    }
    
    return 
PLUGIN_CONTINUE
}

public 
CountDownTimer fid )
{
    if ( !
has_C4 )
    {
        if ( 
task_exists fid ) )
            
remove_task fid );
        return;
    }
    static 
numstr[8];
    
num_to_word update_timer--, numstrcharsmax numstr ) );
    
client_cmd 0"spk %s"numstr );
    if ( 
update_timer )
        
set_task 1.0"CountDownTimer"80085 );
}

public 
TextMsg msgIdmsgDestid )
{
    if ( 
get_msg_args ( ) < )
        return 
PLUGIN_CONTINUE
    
static buffer[32];
    
get_msg_arg_string 2buffercharsmax buffer ) );
    if ( 
equal buffer"#Bomb_Planted" ) )
    {
        
MODE_NOSTEAL true;
        return 
PLUGIN_CONTINUE
    
}
    if ( 
equal buffer"#Game_will_restart_in" ) || equal buffer"#Game_Commencing" ) )
    {
        
MODE_NOSTEAL true;
        if ( 
has_Delay )
            
StopDelay ( );
        else if ( 
has_C4 )
        {
            
has_C4 0;
            if ( !
countdown_value )
                return 
PLUGIN_CONTINUE    
            RestoreRoundTimer 
( );
        }
        return 
PLUGIN_CONTINUE
    
}
    if ( 
has_C4 == id && equal buffer"#C4") )
        return 
PLUGIN_HANDLED
    
return PLUGIN_CONTINUE
}

GetWeaponBoxType ent )
{
    static 
weapon;
    for ( new 
i=1i<=5i++ )
    {
        
weapon get_pdata_cbase entm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX );
        if( 
weapon )
            return 
cs_get_weapon_id weapon );
    }
    return 
0;
}

Execute_user_C4 idboolaction )
{
    static 
weapon;
    
weapon get_pdata_cbase idm_rgpPlayerItems_CBasePlayer[CSW_C4_SLOT] );
    while ( 
weapon )
    {
        if ( 
cs_get_weapon_id weapon ) == CSW_C4 )
            break;
            
weapon get_pdata_cbase weaponm_pNextXO_CBASEPLAYERITEM );
    }
    if ( 
action )
    {
        if ( 
weapon )
            return 
0;
        if( 
get_pdata_cbase idm_pActiveItem ) == weapon )
            
ExecuteHamBHam_Weapon_RetireWeaponweapon );
        if( 
ExecuteHamB Ham_RemovePlayerItemidweapon ) )
        {
            
user_has_weapon idCSW_C4);
            
ExecuteHamB Ham_Item_Killweapon );
            return 
1;
        }
    }
    else
    {
        if ( 
weapon )
            return 
0;
        
weapon create_entity "weapon_c4" );
        if ( !
is_valid_ent weapon ) )
            return 
0;
        
entity_set_int weaponEV_INT_spawnflagsSF_NORESPAWN );
        
ExecuteHam Ham_Spawnweapon );
        if ( !
ExecuteHamB Ham_AddPlayerItemidweapon ) )
        {
             if ( 
is_valid_ent weapon ) ) 
                 
entity_set_int weaponEV_INT_flagsentity_get_int weaponEV_INT_flags ) | FL_KILLME );
             return 
0;
        }
        
ExecuteHamB Ham_Item_AttachToPlayerweaponid );
        return 
1;
    }    
    return 
0;
}

StopDelay ( )
{
    
message_begin MSG_ONE_UNRELIABLEbt_msgid_has_Delay );
    
write_short );
    
message_end ( );
    if ( 
toggle_PreThink )
    {
        
DisableHamForward handle_PreThink );
        
toggle_PreThink false;
    }
    
has_Delay 0;
}

RestoreRoundTimer ( )
{
    if ( 
task_exists 80085 ) )
        
remove_task 80085 );
    
set_mp_pdata "m_iRoundTimeSecs"round_timeleft floatround get_gametime() - round_timestart ) );
    
message_begin MSG_BROADCASTrt_msgid );
    
write_short round_timeleft );
    
message_end ( );
    
message_begin MSG_BROADCASTsc_msgid );
    
write_byte );
    
message_end ( );

PHP Code:
        // Turn On Steal Mode 
    
entity_set_int entEV_INT_flagsentity_get_int entEV_INT_flags ) | FL_KILLME ); 
    
ExecuteHam Ham_Thinkent ); 
    
Execute_user_C4 idfalse ); 
    
has_C4 id
    
client_print 0print_center"The bomb has been stolen!" ); 
    
client_cmd 0"spk sound/radio/bombst.wav" ); 
    new 
random_num(0,255
    new 
random_num(0,255
    new 
random_num(0,255
    
set_user_rendering(idkRenderFxGlowShellrgbkRenderNormal150

Last edited by Copper; 05-09-2017 at 22:55.
Copper is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-09-2017 , 21:57   Re: Glow on CT that has bomb.
Reply With Quote #2

You need to remove it.
Take a look at this
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-09-2017 , 22:09   Re: Glow on CT that has bomb.
Reply With Quote #3

Quote:
Originally Posted by wickedd View Post
You need to remove it.
Take a look at this
I have no idea what you mean by removing it. Explain please.
Copper is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-09-2017 , 22:17   Re: Glow on CT that has bomb.
Reply With Quote #4

You must remove the glow, it doesn't remove itself.
PHP Code:
set_user_renderingid 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-09-2017 , 22:54   Re: Glow on CT that has bomb.
Reply With Quote #5

Quote:
Originally Posted by wickedd View Post
You must remove the glow, it doesn't remove itself.
PHP Code:
set_user_renderingid 
Oh I get it. Thanks I got it working.
Copper is offline
Reply


Thread Tools
Display Modes

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 19:29.


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