Raised This Month: $ Target: $400
 0% 

[CSS] Buy relive


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Devzirom
Junior Member
Join Date: Dec 2008
Location: Russian Federation
Old 11-02-2010 , 03:13   Re: [CSS] Buy relive 2 beta
Reply With Quote #10

Quote:
Originally Posted by GrO View Post
Nice work, thanks.

But what, if I want my mp_buytime to stay at 0.25?
1.
PHP Code:
// on plugin start
public OnPluginStart() {
    
mp_buytime FindConVar("mp_buytime"); //find a cvar
    
buytime GetConVarFloat(mp_buytime); //find value and memorize
    
HookConVarChange(mp_buytimeConVarChanged); //intercept value change
}
// on map start
public OnMapStart() {
    if(
buy_relive_enabled)
        
SetConVarFloat(mp_buytime1440.0true); //A new value
}

//when the value changes
public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[]) {
       
buytime GetConVarFloat(mp_buytime); //find value and memorize
        
       
if(buy_relive_enabled)
           
SetConVarFloat(mp_buytime1440.0true); //A new value
}

// on plugin stoped or disabled
public OnPluginEnd() {    
    
SetConVarFloat(mp_buytimebuytimetrue); // Set cvar mp_buytime to default


Thus, we obtain the following: buyzone always available


2.
PHP Code:

public OnPluginStart() {    
    
HookEvent("round_freeze_end"EventFreezeEndEventHookMode_Post); // hook "Freeze End" event
    
HookEvent("round_end"EventRoundEndEventHookMode_Post); // hook "Round End" event
}

//"Freeze End" event
public Action:EventFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast) {
    
StopBuyTimer(BuyTimer0); // remove old buy timer
    
BuyTimer CreateTimer(buytime 60.0StopBuyTimer0); // create new buy timer
}

// "Round End" event
public Action:EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) {
    
    
StopBuyTimer(BuyTimer0); // Remove buy timer
    
}

public 
OnGameFrame() {
    if(
BuyTimer != INVALID_HANDLE)
           return;
    
// if buytimer == 0.0
    
for(new i=1i<=MaxClientsi++) {

        
SetEntProp(iProp_Send"m_bInBuyZone"0); // Block buyzone!
    
}

Thus, we obtain the following: buyzone is blocked

3.

PHP Code:
//on relive command
public Action:Command_Say(clientargs) {
        
PlayerBuyTimer[client] = CreateTimer(buy_relive_buytime,  StopBuyTimerclient); // Create individual buy timer
        
CS_RespawnPlayer(client); //Respawn
}

public 
OnGameFrame() {
    for(new 
i=1i<=MaxClientsi++) {
        
// if individual buytimer > 0
        
if(PlayerBuyTimer[i] != INVALID_HANDLE)
            continue; 
// <---- blocking does not happen
        
        
SetEntProp(iProp_Send"m_bInBuyZone"0); // block buyzone
    
}

Thus, players can buy items


-----------------

Other methods, I do not know
Devzirom is offline
 



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:12.


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