Page 1 of 1

CS:S send Buy Menu anytime/anywhere

Posted: Thu Jan 11, 2018 12:27 pm
by BackRaw
Hi,

I have a question about the the buy menu in CS:S. I want to simulate the behavior of mp_buy_anywhere for CS:GO. As I see it, those two things contribute to how buying is restricted by time/position in CS:S:
  • mp_buytime
  • "Range" of each of the func_buyzone entities
Is this assumption correct? If so, then I can set mp_buytime to 60 to be able to buy anytime.
Still, the "range" thing is a problem. Is there a way to somehow make it available across the whole map? If I can do this, I see one big problem: each map is different and I would need to know the boundaries of each map and set the buy zone properties accordingly.

There has to be another way. Can one buy zone be made accessible to all teams? This way I wouldn't need to have multiple buy zones.
Can I get rid of the buy zones entirely and just send the buy menu to the player when they press the buy button without sending the client command buy?

Thanks!!

Re: CS:S send Buy Menu anytime/anywhere

Posted: Thu Jan 11, 2018 5:44 pm
by Ayuto
I tried two things:
  1. Modify the existing buyzones (make them bigger).
  2. Create new buyzones.
Unfortunately, both didn't work, so here is the hacky solution:

Syntax: Select all

import memory

from entities.hooks import EntityPreHook
from entities.hooks import EntityCondition
from entities.entity import BaseEntity

@EntityPreHook(EntityCondition.is_player, 'post_think')
def pre_post_think(args):
player = memory.make_object(BaseEntity, args[0])
player.set_network_property_bool('m_bInBuyZone', True)
This solution doesn't require func_buyzone entities.

Edit:
I didn't test it, but I'm pretty sure that you can also send buy menus using VGUIMenu.

Re: CS:S send Buy Menu anytime/anywhere

Posted: Sat Jan 13, 2018 7:35 am
by BackRaw
Ayuto wrote:I tried two things:
  1. Modify the existing buyzones (make them bigger).
  2. Create new buyzones.
Unfortunately, both didn't work, so here is the hacky solution:

Syntax: Select all

import memory

from entities.hooks import EntityPreHook
from entities.hooks import EntityCondition
from entities.entity import BaseEntity

@EntityPreHook(EntityCondition.is_player, 'post_think')
def pre_post_think(args):
player = memory.make_object(BaseEntity, args[0])
player.set_network_property_bool('m_bInBuyZone', True)
This solution doesn't require func_buyzone entities.

That hook is sweet! I can't get rid of the shopping cart icon on the left, can I?

Ayuto wrote:Edit:
I didn't test it, but I'm pretty sure that you can also send buy menus using VGUIMenu.
This works when "you're in a buyzone", meaning the hook is needed for CS:S anyway:

Syntax: Select all

from messages import VGUIMenu

VGUIMenu('buy').send(player.index)
Maybe I could send another empty VGUIMenu to override the shopping cart icon? :D

Re: CS:S send Buy Menu anytime/anywhere

Posted: Sat Jan 13, 2018 10:25 am
by Ayuto
The only way I have found so far is using HideHudFlags.PLAYERDEAD. But that hides a lot more than just the shopping cart icon. :grin:

Re: CS:S send Buy Menu anytime/anywhere

Posted: Sat Jan 13, 2018 9:10 pm
by BackRaw
Haha okay. Maybe I'll leave it for now. :D