Raised This Month: $ Target: $400
 0% 

Help me use oprheu to block defusal of bomb


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-16-2014 , 06:35   Help me use oprheu to block defusal of bomb
Reply With Quote #1

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.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 08-16-2014 , 09:49   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #2

better solution is to block planting another bomb if one is planted, what do you think?

Last edited by baneado; 08-16-2014 at 09:50.
baneado is offline
Old 08-16-2014, 09:49
baneado
This message has been deleted by baneado. Reason: oops
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-16-2014 , 10:57   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #4

Quote:
Originally Posted by baneado View Post
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
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-16-2014 , 12:49   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #5

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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-17-2014 , 18:03   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #6

Quote:
Originally Posted by hornet View Post
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?)
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-18-2014 , 02:27   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #7

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;

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 08-18-2014 , 04:30   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #8

Quote:
Originally Posted by hornet View Post
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
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-18-2014 , 04:26   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #9

hornet, better check c4 grenade type ;)
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-18-2014 , 04:30   Re: Help me use oprheu to block defusal of bomb
Reply With Quote #10

Quote:
Originally Posted by bibu View Post
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 View Post
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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 08-18-2014 at 04:32.
hornet 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 12:53.


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