Raised This Month: $32 Target: $400
 8% 

[SOLVED] Enabling Buy Zone.


Post New Thread Reply   
 
Thread Tools Display Modes
PartialCloning
Senior Member
Join Date: Dec 2015
Old 11-27-2016 , 03:29   Re: [SOLVED] Enabling Buy Zone.
Reply With Quote #21

Code:
new iEntity = create_entity( "info_map_parameters" );
Make a global variable that holds the value of that entity, then to enable/disable buying, do:
Code:
set_pdata_int(gInfoParametersEntity, m_iBuyingStatus, VALUE, CMapInfo);

m_iBuyingStatus = 34;
CMapInfo = 4;
VALUE: 0 = Everyone can buy. 1 = Only CTs. 2 = Only Terrorists. 3 = No One.

That should work in any map even if it has no buy zone.
PartialCloning is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-27-2016 , 03:33   Re: Enabling Buy Zone.
Reply With Quote #22

Quote:
Originally Posted by Bugsy View Post
@Klippy : I am not sure.
Here: https://github.com/s1lentq/ReGameDLL...ayer.cpp#L6305
It's being called from HandleSignals where it decides whether or not to display the statusicon.
Later on in ClientCommand on several cases that have something to do with buying, you can see that only the signal is being checked, hence why it is enough just to remove the signal.

Because CBasePlayer::m_signals just so happens to be a value instead of a pointer, doing set_pdata_int(id, 235, value) actually does player->m_signals.m_flState = value, which is quite convenient.

Last edited by klippy; 11-27-2016 at 03:47.
klippy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-27-2016 , 10:10   Re: Enabling Buy Zone.
Reply With Quote #23

Quote:
Originally Posted by KliPPy View Post
Here: https://github.com/s1lentq/ReGameDLL...ayer.cpp#L6305
It's being called from HandleSignals where it decides whether or not to display the statusicon.
Later on in ClientCommand on several cases that have something to do with buying, you can see that only the signal is being checked, hence why it is enough just to remove the signal.

Because CBasePlayer::m_signals just so happens to be a value instead of a pointer, doing set_pdata_int(id, 235, value) actually does player->m_signals.m_flState = value, which is quite convenient.
I just tested this and while my method works on dust & dust2, it does not work on inferno. I wonder if your method will work on dust & dust2.
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-27-2016 , 13:20   Re: [SOLVED] Enabling Buy Zone.
Reply With Quote #24

@PartialCloning it isn't working for me on dust2.
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

enum _:BuyZoneStatus
{
    
BZ_Everyone,
    
BZ_OnlyCT,
    
BZ_OnlyT,
    
BZ_Nobody
}

const 
m_iBuyingStatus 34;
const 
CMapInfo 4;

new 
entInfoMapParams;

public 
plugin_init() 
{
    
entInfoMapParams create_entity"info_map_parameters" );

    
register_clcmd"say disable_all" "DisableAll" );
    
register_clcmd"say disable_CT" "DisableCT" );
    
register_clcmd"say disable_T" "DisableT" );
    
register_clcmd"say enable_all" "EnableAll" );
}

public 
DisableAllid )
{
    
set_pdata_intentInfoMapParams m_iBuyingStatus BZ_Nobody CMapInfo );
}

public 
DisableCTid )
{
    
set_pdata_intentInfoMapParams m_iBuyingStatus BZ_OnlyT CMapInfo );
}

public 
DisableTid )
{
    
set_pdata_intentInfoMapParams m_iBuyingStatus BZ_OnlyCT CMapInfo );
}

public 
EnableAllid )
{
    
set_pdata_intentInfoMapParams m_iBuyingStatus BZ_Everyone CMapInfo );

__________________
Bugsy is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 11-27-2016 , 13:54   Re: [SOLVED] Enabling Buy Zone.
Reply With Quote #25

It should work whenever the round restarts, that's when m_bTCantBuy and m_bCTCantBuy are updated based on the value of m_iBuyingStatus.

If you want it to work instantly, you would have to directly change m_bTCantBuy and m_bCTCantBuy as they're always checked in the "CanPlayerBuy" call. I'm not sure if that would be possible in 1.8.2, but if you're using 1.8.3 you can do: set_gamerules_int("CHalfLifeMultiplay", "m_bCTCantBuy"/"m_bTCantBuy", true/false);
PartialCloning 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 21:57.


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