Raised This Month: $ Target: $400
 0% 

[CS]Bomb Events Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 12-20-2008 , 10:45   [CS]Bomb Events Help
Reply With Quote #1

How would one go and hook the planting of a bomb(After the planting bar finishes), remove it, remove the "The bomb has been planted" text, and then execute an event? I've never needed to do this until now so I'm not quite sure how to go and do it. D:
fang is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-20-2008 , 11:24   Re: [CS]Bomb Events Help
Reply With Quote #2

First read this :
http://forums.alliedmods.net/showthread.php?t=40164

After you have caught the planted logevent, find the bomb entity and remove it.
Also, hook TestMsg message and block the sentence you wish.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 12-20-2008 , 11:28   Re: [CS]Bomb Events Help
Reply With Quote #3

Ohh... Ty
fang is offline
Old 12-20-2008, 13:19
fang
This message has been deleted by fang.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-20-2008 , 16:17   Re: [CS]Bomb Events Help
Reply With Quote #4

Classic way is using register_message.
I don't like this way when it's possible to do another way.

PHP Code:
/*    Copyright © 2008, ConnorMcLeod

    Bomb Tests is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Bomb Tests; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "C4 Remover"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

new g_iPlanter
new gmsgSendAudio
new g_iFhMessageBeging_iFhWriteString

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    if( !
engfuncEngFunc_FindEntityByString FM_NULLENT "classname" "func_bomb_target" )
    &&  !
engfuncEngFunc_FindEntityByString FM_NULLENT "classname" "info_bomb_target" )  )
    {
        
pause("ad")
        return
    }

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_event("BarTime""Event_BarTime_Stop_Planting""be""1=0")
    
RegisterHam(Ham_Killed"player""Player_Killed"1)
    
register_logevent("Logevent_Round_End"2"1=Round_End")

    
register_event("BarTime""Event_BarTime_Planting""be""1=3")
    
    
register_logevent("LogEvent_Planted_The_Bomb"3"2=Planted_The_Bomb")

    
gmsgSendAudio get_user_msgid("SendAudio")
}

public 
Event_HLTV_New_Round()
{
    
Plantingfalse )
}

public 
Event_BarTime_Stop_Planting(id)
{
    if( 
g_iPlanter == id )
    {
        
Plantingfalse )
    }
}

public 
Player_Killed(id)
{
    if( 
g_iPlanter == id )
    {
        
Plantingfalse )
    }
}

public 
Logevent_Round_End()
{
    
Plantingfalse )
}

Plantingbool:bState )
{
    if( 
bState )
    {
        if( !
g_iFhMessageBegin )
        {
            
g_iFhMessageBegin register_forward(FM_MessageBegin"MessageBegin")
        }
        return
    }

    
g_iPlanter 0

    
if( g_iFhMessageBegin )
    {
        
unregister_forward(FM_MessageBeging_iFhMessageBegin)
        
g_iFhMessageBegin 0
    
}
    if( 
g_iFhWriteString )
    {
        
unregister_forward(FM_WriteStringg_iFhWriteString)
        
g_iFhWriteString 0
    
}
}

public 
Event_BarTime_Planting(id)
{
    if( 
get_user_weapon(id) == CSW_C4 )
    {
        
g_iPlanter id

        Planting
true )
    }
}

public 
LogEvent_Planted_The_Bomb()
{
    new 
iEnt engfuncEngFunc_FindEntityByString FM_NULLENT "classname" "grenade" )
    while( 
iEnt )
    {
        if( 
get_pdata_int(iEnt96) & (1<<8) )
        {
            
engfuncEngFunc_RemoveEntityiEnt )
            break
        }
        
iEnt engfuncEngFunc_FindEntityByString iEnt "classname" "grenade" )
    }
    
g_iPlanter 0
    
// Send what you want to send here
}

public 
MessageBegin(MSG_DESTiMsgId)
{
    if( 
iMsgId == gmsgSendAudio && !g_iFhWriteString )
    {
        
g_iFhWriteString register_forward(FM_WriteString"WriteString")
    }
}

public 
WriteString(const szString[])
{
    if( 
Equal(szString"%!MRAD_BOMBPL") )
    {
        
write_string("%")
        return 
FMRES_SUPERCEDE
    
}

    if( 
Equal(szString"#Bomb_Planted") )
    {
        
write_string(" ")
        
Plantingfalse )
        return 
FMRES_SUPERCEDE
    
}

    return 
FMRES_IGNORED
}

Equal(const szA[], const szB[])
{
    static 
a0

    a 
szA[i]
    do
    {
        if( 
!= szB[i])
            return 
0
    
}
    while( (
szA[++i]) )

    return 
1

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 12-20-2008 , 16:26   Re: [CS]Bomb Events Help
Reply With Quote #5

Oh! Okay I see now. Thanks connorr
+Karma'd!
fang is offline
Old 12-20-2008, 16:32
Dores
This message has been deleted by Dores. Reason: O.k, nevermind.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-20-2008 , 16:59   Re: [CS]Bomb Events Help
Reply With Quote #6

Quote:
Originally Posted by Dores View Post
Correct me if I'm wrong...
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-20-2008 , 17:07   Re: [CS]Bomb Events Help
Reply With Quote #7

This isn't using register_message(), it is hooking when message_begin is used.
So, the parameters of message_begin are passed.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 12-29-2008 , 22:13   Re: [CS]Bomb Events Help
Reply With Quote #8

PHP Code:
#include <csx>

forward bomb_planting(planter);
forward bomb_planted(planter);
forward bomb_explode();
forward bomb_defusing(defuser);
forward bomb_defused(defuser);

public 
bomb_planting(id) { 

// your code here

}

public 
bomb_planted(id) { 

// your code here

}

public 
bomb_explode(id) { 

// your code here

}
public 
bomb_defuse(id) { 

// your code here

}

public 
bomb_defusing(id) { 

// your code here


__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor 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 09:19.


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