Raised This Month: $ Target: $400
 0% 

Bomb help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 05-03-2011 , 17:16   Bomb help
Reply With Quote #1

Is there a way to locate who has the bomb and strip it from him??
Doc-Holiday is offline
epix
Junior Member
Join Date: May 2011
Old 05-03-2011 , 17:35   Re: Bomb help
Reply With Quote #2

I'd do something like this to find the right player, not sure how to make him drop it.

Code:
public getBombPlayer() {     new Players[32]     new playerCount, i     get_players(Players, playerCount, "gh")         for (i=0; i < playerCount; i++) {         if(user_has_weapon(Players[i], "weapon_c4"))             return Players[i]     } }

(Not tested)

Last edited by epix; 05-03-2011 at 17:51.
epix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-03-2011 , 17:54   Re: Bomb help
Reply With Quote #3

If you use orpheu, i think i have seen some usefull function to retrieve either bomb either bomb carrier.

Method above seems fine though.

EDIT :
Excepted flags wrong usage...

PHP Code:
get_bomb_carrier()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ae""TERRORIST")
    for(--
iNumiNum>=0iNum--)
    {
        if( 
user_has_weapon(iPlayers[i], CSW_C4) )
        {
            return 
iPlayers[i]
        }
    }
    return 
0

Note that you could replcae user_has_weapon with cs_get_user_defuse.

Then, do:
engclient_cmd(player, "drop", "weapon_c4")
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-03-2011 at 17:59.
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 05-03-2011 , 18:42   Re: Bomb help
Reply With Quote #4

I do use orpheu however codeing with it is confusing lol..

And small typo on yours iPlayers[i] should be iPlayers[iNum]

PHP Code:
public BombCarrier()
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"ae""TERRORIST");
    
    for(--
iNum;iNum>=0;iNum--)
    {
        if( 
user_has_weapon(iPlayers[iNum], CSW_C4) )
        {
            if(
iPlayers[iNum] != g_iLeaderid)
            {
                
engclient_cmd(iPlayers[iNum], "drop""weapon_c4");
                
                new 
bomb = -1
                while( ( 
bomb find_ent_by_modelbomb"weaponbox""models/w_backpack.mdl" ) ) )
                {
                    
remove_entitybomb );
                }

            }
        }
    }
    return 
0;


Last edited by Doc-Holiday; 05-03-2011 at 20:15.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-04-2011 , 01:39   Re: Bomb help
Reply With Quote #5

Don't forget to break/end the loop ;)

orpheu would let you do something like this :

Code:
if( (bomber = IsThereABomber()) )
{
 drop
 if( (bomb = IsThereABomb() )
 {
   remove
 }
}
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 04:29.


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