(Err, sorry if I posted this in the wrong area)
Tried searching around, but have been unsuccessful at finding anything, but here is what I was wanting to do.
I want to be able to find how many defibs have been used in the round and be able to manipulate that number into the scoreboard at the end of each round (like adding or subtracting to that number).
Is such a thing even possible?
*edit (4/22/12)
Found out the answer to this. In case anyone ends up stumbling upon this, it lies in the "m_iVersusDefibsUsed" netprop. You have to manipulate it by using this:
Code:
GameRules_SetProp("m_iVersusDefibsUsed", <value>, 4, 0);
In order to change both teams, set the value to an array, then when adjusting the array, check if the teams are flipped by using this:
Code:
...
if(GameRules_GetProp("m_bAreTeamsFlipped", 4, 0))
{
<code> (This will be for the team going 2nd)
}
else
{
<code> (This will be for the team going 1st)
}
...
*edit 9/11/12
I figured I would elaborate on how to do this properly.
Include Left4Downtown:
PHP Code:
#include <left4downtown>
Next index a defib counter and a respawn counter:
PHP Code:
new DefibCounter[2]; //This is used to make sure the correct number of defibs show up on the RoundEnd scoreboard
new RespawnCounter; //Just to count how many respawns there were
Next, make that number increase for every defib/respawn a player does. Hook events "round_end", "defibrillator_used" and whatever function you use for respawning.
Wipe both numbers on map start:
PHP Code:
public OnMapStart()
{
ReviveCounter[0] = 0;
ReviveCounter[1] = 0;
}
On the defib event/respawn function:
PHP Code:
if(GameRules_GetProp("m_bAreTeamsFlipped", 4, 0))
{
ReviveCounter[1] +=1;
}
else
{
ReviveCounter[0] +=1;
}
On the RoundEnd event:
PHP Code:
new score[2];
new Handle:defibpenalty = FindConVar("vs_defib_penalty");
GameRules_GetProp("m_iVersusDefibsUsed", 4, 0);
GameRules_GetProp("m_iVersusDefibsUsed", 4, 1);
L4D2_GetVersusCampaignScores(score);
if(GameRules_GetProp("m_bAreTeamsFlipped", 4, 0))
{
score[1] -= RespawnCount*GetConVarInt(defibpenalty);
}
else
{
score[0] -= RespawnCount*GetConVarInt(defibpenalty);
}
L4D2_SetVersusCampaignScores(score);
GameRules_SetProp("m_iVersusDefibsUsed", ReviveCounter[0], 4, 0);
GameRules_SetProp("m_iVersusDefibsUsed", ReviveCounter[1], 4, 1);
GameRules_SetProp("m_iCampaignScore", score[0], 4, 0);
GameRules_SetProp("m_iCampaignScore", score[1], 4, 1);
That should do it. Without the 9/11/12 edit, it would subtract the defibs, but won't mirror it on the scoreboard when you hold down TAB which is what you want to reflect to.
__________________