Raised This Month: $ Target: $400
 0% 

Fix bomb bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 11-30-2010 , 08:39   Fix bomb bug
Reply With Quote #1

Sometimes after the bomb (c4) was planted and round is end the bomb is still count and explode..

Here is the code I will try to fix this:
PHP Code:
#include < amxmodx >
#include < engine >
#include < fakemeta >

#define m_C4 96
#define IsC4(%1) get_pdata_int( %1, m_C4 ) & ( 1<<8 )

new g_iBombPlantedOrDefused

public plugin_init() 
{
    new 
entity = -1
    
new iMapBomb

    
while( ( entity find_ent_by_classentity"func_bomb_target" ) ) > )
    {
        
iMapBomb true
    
}

    
entity = -1
    
    
while( ( entity find_ent_by_classentity"info_bomb_target" ) ) > )
    {
        
iMapBomb true
    
}

    if( 
iMapBomb )
    {
        
register_event"TextMsg""Event_RoundEnd""a""2&#Game_C""2&#Game_w" )
        
        
register_event"HLTV""Event_RoundEnd""a""1=0""2=0" )
        
register_logevent"Event_RoundEnd"2"1=Round_Start" )
        
        
register_event"SendAudio""Event_RoundEnd""a""2=%!MRAD_terwin""2=%!MRAD_ctwin""2=%!MRAD_rounddraw" )
        
register_logevent"Event_RoundEnd"2"1=Round_End" )
        
        
register_logevent"LogEvent_BombPlanted"3"2=Planted_The_Bomb" )
        
register_logevent"LogEvent_BombPlanted"3"2=Defused_The_Bomb" )
        
        
register_logevent"LogEvent_BombPlanted"6"3=Target_Saved" )
    }
    
    else
    {
        
pause"ad" )
        
g_iBombPlantedOrDefused false
        
return
    }
}

public 
Event_RoundEnd()
{
    if( 
g_iBombPlantedOrDefused )
    {
        static 
iC4
        iC4 
= -1
        
        
while( ( iC4 find_ent_by_classiC4"grenade" ) ) > )
        {
            if( 
IsC4iC4 ) > )
            {
                
remove_entityiC4 )
                
g_iBombPlantedOrDefused false
                
break
            }
        }
    }
}

public 
LogEvent_BombPlanted()
{
    
g_iBombPlantedOrDefused true

But sometimes server crash with this error:
FATAL ERROR (shutting down): NUM_FOR_EDICT: bad pointer

Last edited by dFF; 11-30-2010 at 08:42.
dFF is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-30-2010 , 12:48   Re: Fix bomb bug
Reply With Quote #2

Why don't you set it's explode time to 9999.0?

Code:
#define OFFSET_C4_EXPLODETIME   100 public Event_RoundEnd() {     if( g_iBombPlantedOrDefused )     {         static iC4         iC4 = -1                 while( ( iC4 = find_ent_by_class( iC4, "grenade" ) ) > 0 )         {             if( IsC4( iC4 ) > 0 )             {                 //remove_entity( iC4 )                 set_pdata_float( iC4, OFFSET_C4_EXPLODETIME, 9999.0 )                 g_iBombPlantedOrDefused = false                 break             }         }     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 11-30-2010 , 13:00   Re: Fix bomb bug
Reply With Quote #3

Ok, I will try. Thanks.
dFF 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 11:16.


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