Raised This Month: $51 Target: $400
 12% 

[SOLVED] Enabling Buy Zone.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-26-2016 , 05:32   [SOLVED] Enabling Buy Zone.
Reply With Quote #1

Hello,

I want to disable buy zone for specific round. I have managed to disable for a round but now I cannot re enable it. Here is my code.
PHP Code:
//This function is called to disable buy zone.
public hideBuyIcon() 


    
register_messageget_user_msgid"StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
            
    // Remove buyzone on map
    
remove_entity_name"info_map_parameters" );
    
remove_entity_name"func_buyzone" );
    
    
// Create own entity to block buying
    
new iEntity create_entity"info_map_parameters" );
    
    
DispatchKeyValueiEntity"buying""3" );
    
DispatchSpawniEntity );

  
}


public 
MsgStatusIconmsg_idmsg_destid ) {
    new 
szIcon];
    
get_msg_arg_string2szIcon);
    
    static const 
BuyZone[ ] = "buyzone";
    
    if( 
equalszIconBuyZone ) ) {
        
set_pdata_intidOFFSET_BZget_pdata_intidOFFSET_BZ) & ~( << ), );
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;

How do I enable it again in next round ?


Thanks!

Last edited by abhishek_deshkar; 11-27-2016 at 00:08. Reason: Solved by bugsy.
abhishek_deshkar is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-26-2016 , 07:10   Re: Enabling Buy Zone.
Reply With Quote #2

That's not disabling it, it's removing it.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-26-2016 , 08:12   Re: Enabling Buy Zone.
Reply With Quote #3

Then how do I re add it ? or is there any alternative to disable buy for specific round and then enable it on next ?
abhishek_deshkar is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 11-26-2016 , 10:35   Re: Enabling Buy Zone.
Reply With Quote #4

Quote:
Originally Posted by abhishek_deshkar View Post
Then how do I re add it ? or is there any alternative to disable buy for specific round and then enable it on next ?
Yes, add a cvar wich toggle the plugin on/off, when you want to disable , change the cvar and after wait for next round ( entities are respawned each new round ).
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-26-2016 , 10:49   Re: Enabling Buy Zone.
Reply With Quote #5

As you said that I have removed it then how can I re add it again ? It has not respawned on next round.
abhishek_deshkar is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 11-26-2016 , 10:57   Re: Enabling Buy Zone.
Reply With Quote #6

Quote:
Originally Posted by abhishek_deshkar View Post
As you said that I have removed it then how can I re add it again ? It has not respawned on next round.
Can you see the function wich remove the entity ? Add a cvar and a condition only if the cvar is 1 to remove the entity, when you want to disable the plugin set the cvar to '0' and wait for the next round.
__________________
Project: Among Us

Last edited by Craxor; 11-26-2016 at 10:57.
Craxor is offline
Send a message via ICQ to Craxor
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-26-2016 , 11:02   Re: Enabling Buy Zone.
Reply With Quote #7

The function hideBuyIcon() is only called when I say /start. Otherwise it won't be called. So when I say /start it's removing for that round and on the next round it remains same. No entity created !
abhishek_deshkar is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-26-2016 , 11:08   Re: Enabling Buy Zone.
Reply With Quote #8

Quote:
Originally Posted by Craxor View Post
( entities are respawned each new round )
No, I don't think so.

Quote:
Originally Posted by abhishek_deshkar View Post
The function hideBuyIcon() is only called when I say /start. Otherwise it won't be called. So when I say /start it's removing for that round and on the next round it remains same. No entity created !
Provide whole code, not just the snippet from OP.

Last edited by klippy; 11-26-2016 at 11:08.
klippy is offline
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-26-2016 , 11:18   Re: Enabling Buy Zone.
Reply With Quote #9

PHP Code:

#include <amxmodx> 
#include <engine>  
#include <fun> 
#include <cstrike> 
#include <hamsandwich> 
#include <fakemeta_util>


#if cellbits == 32
    #define OFFSET_BZ 235
#else
    #define OFFSET_BZ 268
#endif



public plugin_init() 

    
register_plugin("Block Buy Zone""1.0""Abhishek Deshkar"
    
register_clcmd("amx_startit""hideBuyIcon"ADMIN_IMMUNITY"No Buy Zone");





//Remove Buy Zone
public hideBuyIcon() 


    
register_messageget_user_msgid"StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
            
    // Remove buyzone on map
    
remove_entity_name"info_map_parameters" );
    
remove_entity_name"func_buyzone" );
    
    
// Create own entity to block buying
    
new iEntity create_entity"info_map_parameters" );
    
    
DispatchKeyValueiEntity"buying""3" );
    
DispatchSpawniEntity );

}

public 
MsgStatusIconmsg_idmsg_destid ) {
    new 
szIcon];
    
get_msg_arg_string2szIcon);
    
    static const 
BuyZone[ ] = "buyzone";
    
    if( 
equalszIconBuyZone ) ) {
        
set_pdata_intidOFFSET_BZget_pdata_intidOFFSET_BZ) & ~( << ), );
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


Last edited by abhishek_deshkar; 11-26-2016 at 11:18.
abhishek_deshkar is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 11-26-2016 , 13:10   Re: Enabling Buy Zone.
Reply With Quote #10

Quote:
Originally Posted by KliPPy View Post
No, I don't think so.
At least at each new map ? Maybe i'm wrong about buyzone, but as i know some entities are respawned at new round ?

Or after you delete them you need to wait a new map for appear?
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
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 03:40.


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