Raised This Month: $ Target: $400
 0% 

Fix bomb bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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