AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [CSS] Buy relive (https://forums.alliedmods.net/showthread.php?t=141345)

Devzirom 10-23-2010 00:36

[CSS] Buy relive
 
1 Attachment(s)
CSS: Buy relive

Allows players to buy relive(respawn)
Plugin cvar's
  • sm_buy_relive_enabled = 1/0 - plugin is enabled/disabled, (def. 1)
  • sm_buy_relive_cost = 0-16000 - Set the price for the relive(respawn), (def. 5000)
  • sm_buy_relive_message = 1/0 plugin message is enabled/disabled, (def. 1)
  • sm_buy_relive_version - current plugin version

Сlients сommands

say
or say_team:
  • relive
  • respawn
  • buyrespawn
  • buyrelive

GrO 10-24-2010 01:20

Re: [CSS] Buy relive
 
Good idea, will test it on my server with $15000 cost ;].

Devzirom 10-24-2010 06:20

Re: [CSS] Buy relive
 
Quote:

Originally Posted by GrO (Post 1332773)
Good idea, will test it on my server with $15000 cost ;].

Thanks!

sinblaster 10-24-2010 10:01

Re: [CSS] Buy relive
 
great idea

GrO 10-24-2010 23:08

Re: [CSS] Buy relive
 
Devzirom is it possible for You to add a ConVar:

sm_buy_relive_buytime 0.50 (Min = 0.25; Default = 1.0; Disabled = 0.0) - Every value greater than "0.0" allows ReLived player to buy weapons and stuff (at his BuyZone) for a specified amount of time (in Minutes).

Even, if standard mp_buytime has already expired, so sm_buy_relive_buytime should override it's functionality for ReLived players.

And I also think that the sm_buy_relive_buytime timer should be resetted on RoundEnd to avoid any problems, when someone will ReLive just before RoundEnd.

Devzirom 10-30-2010 02:43

Re: [CSS] Buy relive
 
Can simply return to the player its armor and the weapon (if other players haven't picked up)?

GrO 10-30-2010 04:45

Re: [CSS] Buy relive
 
Quote:

Originally Posted by Devzirom (Post 1337104)
Can simply return to the player its armor and the weapon (if other players haven't picked up)?

This way it may be unfair, cause:

1) One player ReLives for x$ and gets all his stuff back.
2) Other player also ReLives for x$ with knife + pistol only, cause someone took his weapon (what happens quite often).

So the only 2 senseful methods are:

1) ReLived player always gets his stuff back.
2) ReLived player gets ability of buying stuff for x.x minutes (extended mp_buytime).

Devzirom 11-01-2010 09:26

[CSS] Buy relive 2 beta
 
1 Attachment(s)
[CSS] Buy relive 2 beta

The сvar is added:
sm_buy_relive_buytime = Time in seconds in which flow players can buy items again, (def. 0)

Mr. GrO, test it! I wait for Your results!

note: The variable mp_buytime installs value 1440.0 - don't pay attention to it

GrO 11-01-2010 14:16

Re: [CSS] Buy relive
 
Nice work, thanks.

But what, if I want my mp_buytime to stay at 0.25?

Devzirom 11-02-2010 03:13

Re: [CSS] Buy relive 2 beta
 
Quote:

Originally Posted by GrO (Post 1339406)
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


All times are GMT -4. The time now is 21:12.

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