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

Buy after x seconds.


Post New Thread Reply   
 
Thread Tools Display Modes
4ever16
Veteran Member
Join Date: Apr 2015
Old 08-29-2015 , 14:36   Re: Buy after x seconds.
Reply With Quote #11

Tnx will try.
4ever16 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 08-29-2015 , 17:26   Re: Buy after x seconds.
Reply With Quote #12

Dr.

I found one problem. This only works when round has started.
Would like it to work on freeze time.

Thanks!

Last edited by 4ever16; 08-29-2015 at 17:33.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2015 , 18:30   Re: Buy after x seconds.
Reply With Quote #13

Do you want to start the timer at new round, round start, or end of freeze time? And the blocking should occur at each round?
__________________

Last edited by Bugsy; 08-29-2015 at 18:31.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 08-29-2015 , 18:38   Re: Buy after x seconds.
Reply With Quote #14

The thing i would love is: When we have freezetime 4 seconds no buy.

The timer starts when freezetime starts.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2015 , 19:17   Re: Buy after x seconds.
Reply With Quote #15

You need client buy include/plugin by ConnorMcLeod: https://forums.alliedmods.net/showthread.php?t=149380. This requires that you compile the client_buy plugin and add it to plugins.ini, then you are able to use the cl_buy include in your plugins.

This blocks any type or buying, but it can be easily made to block specific items.

The New Round event does not fire at the first round (freeze time start) after server start or map change so I set the variable at plugin_init(). If you find that the blocking time is short by a few seconds after a map change or server start, just do + 3 or something to compensate (in plugin_init()); so it would be g_FreezeStart = get_systime() + 3;

PHP Code:
#include <amxmodx>  
#include <cl_buy>

new const Version[] = "0.1";

const 
VIP ADMIN_BAN;

new 
g_IsVIP g_FreezeStart g_pAllowedTime;

public 
plugin_init()
{
    
register_plugin"Block Buy" Version "bugsy" );
    
    
register_event"HLTV" "NewRound" "a" "1=0" "2=0" );
    
    
g_pAllowedTime register_cvar"bb_canbuy" "15" );
    
    
g_FreezeStart get_systime();
}

public 
client_authorizedid )
{
    
g_IsVIP |= ( get_user_flagsid ) & VIP ) ? << ( id 31 );
}

public 
NewRound()
{
    
g_FreezeStart get_systime();
}

public 
client_buyid item 
{
    new 
iAllowedTime iSysTime;

    if ( !( 
g_IsVIP & ( id 31 ) ) )
    {
        
iAllowedTime get_pcvar_numg_pAllowedTime );
        
iSysTime get_systime();
        
        if ( ( 
iSysTime g_FreezeStart ) < iAllowedTime )
        {
            
client_printid print_chat "* Sorry, you must wait %d seconds to buy" iAllowedTime - ( iSysTime g_FreezeStart ) );
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

__________________

Last edited by Bugsy; 08-29-2015 at 19:31.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 08-29-2015 , 19:36   Re: Buy after x seconds.
Reply With Quote #16

Bad load both plugins bugsy.

Tested with 1.8.2 and 1.8.3

Last edited by 4ever16; 08-29-2015 at 21:59.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2015 , 22:59   Re: Buy after x seconds.
Reply With Quote #17

It works fine for me, using 1.8.3 build.
__________________
Bugsy 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 05:33.


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