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

Enable buy for both teams on maps w/o func_buyzone or info_map_parameters


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 02-21-2020 , 05:51   Enable buy for both teams on maps w/o func_buyzone or info_map_parameters
Reply With Quote #1

As the title says I want to enable buy for both teams on maps like de_nuke to be able to buy if a player spawns at enemy base (rtd thing), but without making the "default buyzone around players spawn" area bigger (like VEN's plugin) or enabling anywhere buy.

On maps where func_buyzone exists I got that work successfully with
Code:
entity_set_int( i_BuyZone, EV_INT_team, 0 );
But I have no idea for de_nuke

Edit: I do now, create a func_buyzone somewhere on the map and use fake_touch based on mp_buytime then supercede it, even if I have this idea a small help would be cool

Any help appreciated and thanks in advance!

Last edited by RaZ_HU; 02-21-2020 at 06:47.
RaZ_HU is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-21-2020 , 19:23   Re: Enable buy for both teams on maps w/o func_buyzone or info_map_parameters
Reply With Quote #2

de_nuke has info_map_parameters
__________________
Bugsy is offline
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 02-22-2020 , 07:32   Re: Enable buy for both teams on maps w/o func_buyzone or info_map_parameters
Reply With Quote #3

I realized that later, but it only allows/blocks the buy per team, it does not create a buyzone if a T spawns at CT for example.
RaZ_HU is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-22-2020 , 10:59   Re: Enable buy for both teams on maps w/o func_buyzone or info_map_parameters
Reply With Quote #4

What about disabling the default buy zones and create a func_buyzone at each spawn?
__________________
Bugsy is offline
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 02-22-2020 , 15:40   Re: Enable buy for both teams on maps w/o func_buyzone or info_map_parameters
Reply With Quote #5

I had that in my mind too, but it is easier to create a new buyzone for only the time it is needed I think.

This is where I got so far, I'm sure there are some mistakes but it works yet

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>

public plugin_init()
{
    
register_plugin"Shared Buy Zones""0.2""RaZ_HU" );
}

public 
plugin_natives()
{
    
register_native("create_fake_buyzone""native_create_fake_buyzone");
}

public 
plugin_cfg()
{
    
// Set every buyzone usable for both teams
    
new iBuyZone = -1;

    if( 
fm_find_ent_by_classiBuyZone"func_buyzone" ) )
    {
        while( ( 
iBuyZone fm_find_ent_by_classiBuyZone"func_buyzone" ) ) )
        {
            
set_peviBuyZonepev_team);
        }
    }
}

/*
* Creates a fake buyzone around the player.
* If timer is defined then remove buyzone after that in seconds.
* native create_fake_buyzone(iEnt, iTeam = 0, Float:fTimeleft = 0.0);
*/

public native_create_fake_buyzone(plugin_idparams)
{
    new 
iEnt get_param(1);

    
// Stop if entity doesn't exist
    
if( !pev_validiEnt ) )
        return 
PLUGIN_HANDLED;

    new 
iTeam get_param(2);
    new 
Float:fTimeleft get_param_f(3);
    new 
Float:iOrigin[3];

    
// Get the origin of the entity (player) where we want to create a buyzone
    
fm_get_brush_entity_originiEntiOrigin );

    new 
iZone engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"func_buyzone" ) );
    if ( 
iZone )
    {
        
dllfuncDLLFunc_SpawniZone );
        
set_peviZonepev_teamiTeam );
        
engfuncEngFunc_SetSizeiZoneFloat:{-96.0, -96.0, -48.0}, Float:{96.096.048.0} );
        
engfuncEngFunc_SetOriginiZoneiOrigin );
        
// To make sure it triggers
        
dllfuncDLLFunc_TouchiEntiZone );
    }
    
// Timer option, if not supplied then it will remain until mapchange
    
if( params == )
    {
        
set_taskfTimeleft"cancelBuy"iZone );
    }

    return 
PLUGIN_CONTINUE;
}

public 
cancelBuyiEnt )
{
    
engfuncEngFunc_RemoveEntityiEnt );

The usage is this simple (in the RTD plugin in my example where players spawn at next round):
PHP Code:
create_fake_buyzone(id0get_cvar_float("mp_buytime") ); 
Map filtering (aim, fy, scout etc.) is done in the RTD plugin too, but I wouldn't put that in this plugin for no reason.
RaZ_HU 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 13:38.


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