AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me use oprheu to block defusal of bomb (https://forums.alliedmods.net/showthread.php?t=246356)

aron9forever 08-16-2014 06:35

Help me use oprheu to block defusal of bomb
 
So I run a furien server. I made multiple c4s available to be bought and I'm stuck now because if they're 2 bombs planted, if any of them gets defused the round ends.

PHP Code:

public bomb_defused(id)
{
    
g_plantedbombs--
    if(
g_plantedbombs>0)
        return 
PLUGIN_HANDLED
        
    
return PLUGIN_CONTINUE


obviously doesn't work, but I need a simple crude solution to block round end on bomb defusal.
I've first tried looking at infinite round, but couldn't understand anything. The plugin is so complex and even tho I could use it by setting it to only block def, I still need the bomb to be defused, but only when it's the last one planted.

I've also found a non orpheu way also made by connor but he mentioned it being unefficient so much I'm not scared to use it(grenade think)

I can't understand anything from oprheu so if someone could be kind enough to write a snippet for me to block it, it would be great. Thanks a lot.

baneado 08-16-2014 09:49

Re: Help me use oprheu to block defusal of bomb
 
better solution is to block planting another bomb if one is planted, what do you think?

aron9forever 08-16-2014 10:57

Re: Help me use oprheu to block defusal of bomb
 
Quote:

Originally Posted by baneado (Post 2184705)
better solution is to block planting another bomb if one is planted, what do you think?

well, the point is to make it harder to win by defusing
so basically, you can plant as many bombs as you want, they have to defuse them all to win and to avoid being boomed

hornet 08-16-2014 12:49

Re: Help me use oprheu to block defusal of bomb
 
The Infinite Round API is your answer.

PHP Code:

/**
 * @brief Called when a round ends.
 *
 * @note  You can block a round end happening by returning PLUGIN_HANDLED.
 *        Blocking from the forward supercedes always the ir_block_roundend cvar value.
 *
 * @param type     The type of round end. See RoundEndType constants.
 */
forward OnRoundEnd( const RoundEndType:type ); 

You can check for other bomb entities there and if you find one then return.

aron9forever 08-17-2014 18:03

Re: Help me use oprheu to block defusal of bomb
 
Quote:

Originally Posted by hornet (Post 2184770)
The Infinite Round API is your answer.

PHP Code:

/**
 * @brief Called when a round ends.
 *
 * @note  You can block a round end happening by returning PLUGIN_HANDLED.
 *        Blocking from the forward supercedes always the ir_block_roundend cvar value.
 *
 * @param type     The type of round end. See RoundEndType constants.
 */
forward OnRoundEnd( const RoundEndType:type ); 

You can check for other bomb entities there and if you find one then return.

so how exactly would I go about using this?
I just need to include the infinite round api?
How do I declare/hook/register whatever the forward?
What are the RoundEndTypes? are those the flags defined in infinte round(the letters?)

hornet 08-18-2014 02:27

Re: Help me use oprheu to block defusal of bomb
 
It is the same as using any other forward. The RoundEndType's can be found in the infinite_round.inc.
You just need to keep in mind that the default value of ir_block_roundend ( "*" ) can be superceded by returning, but will not allow the round to end if you return PLUGIN_CONTINUE. Therefore you will need to use a flag that is irrelevant to the scenario such as k ( prevent prison escape ).

Something like this should suffice:
PHP Code:

#include <amxmodx>
#include <engine>
#include <infinite_round>

/*
    ir_active_api 1
    ir_block_roundend k
*/

public OnRoundEnd( const RoundEndType:iType )
{
    if( 
iType == RoundEndType_BombDefused )
    {
        if( 
find_ent_by_model0"grenade""models/w_c4.mdl" ) )
            return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;



bibu 08-18-2014 04:26

Re: Help me use oprheu to block defusal of bomb
 
hornet, better check c4 grenade type ;)

aron9forever 08-18-2014 04:30

Re: Help me use oprheu to block defusal of bomb
 
Quote:

Originally Posted by hornet (Post 2185559)
PHP Code:

        if( find_ent_by_model0"grenade""models/w_c4.mdl" ) )
            return 
PLUGIN_HANDLED


This is for checking if there are more bombs right?
Just asking because I'm already caching bombs as they're being planted so no need to look trough ents

hornet 08-18-2014 04:30

Re: Help me use oprheu to block defusal of bomb
 
Quote:

Originally Posted by bibu (Post 2185604)
hornet, better check c4 grenade type ;)

How many types of grenades do you know of that have the same model as C4? ;)

Quote:

Originally Posted by aron9forever (Post 2185607)
This is for checking if there are more bombs right?
Just asking because I'm already caching bombs as they're being planted so no need to look trough ents

Yes that's correct.

bibu 08-18-2014 07:53

Re: Help me use oprheu to block defusal of bomb
 
Quote:

Originally Posted by hornet (Post 2185608)
How many types of grenades do you know of that have the same model as C4? ;)

You could use a custom c4 model. ;)


All times are GMT -4. The time now is 12:53.

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