plugins/mapchooser.sp
changeset 1698 7caa46a2eb2c
parent 1664 e054be79e28a
child 1719 c9d5e55f0899
     1.1 --- a/plugins/mapchooser.sp	Mon Nov 19 22:08:51 2007 +0000
     1.2 +++ b/plugins/mapchooser.sp	Mon Nov 19 23:11:10 2007 +0000
     1.3 @@ -74,6 +74,7 @@
     1.4  new Handle:g_TeamScores = INVALID_HANDLE;
     1.5  new Handle:g_VoteMenu = INVALID_HANDLE;
     1.6  
     1.7 +new g_TotalRounds;
     1.8  new bool:g_HasVoteStarted;
     1.9  new g_mapFileTime;
    1.10  
    1.11 @@ -87,7 +88,6 @@
    1.12  	g_MapList = CreateArray(arraySize);
    1.13  	g_OldMapList = CreateArray(arraySize);
    1.14  	g_NextMapList = CreateArray(arraySize);
    1.15 -	g_TeamScores = CreateArray(2);
    1.16  
    1.17  	g_Cvar_StartTime = CreateConVar("sm_mapvote_start", "3.0", "Specifies when to start the vote based on time remaining.", _, true, 1.0);
    1.18  	g_Cvar_StartRounds = CreateConVar("sm_mapvote_startround", "2.0", "Specifies when to start the vote based on rounds remaining.", _, true, 1.0);
    1.19 @@ -139,6 +139,14 @@
    1.20  		SetupTimeleftTimer();
    1.21  		SetConVarString(g_Cvar_Nextmap, "Pending Vote");
    1.22  	}
    1.23 +	
    1.24 +	if (g_TeamScores != INVALID_HANDLE)
    1.25 +	{
    1.26 +		CloseHandle(g_TeamScores);
    1.27 +	}
    1.28 +	
    1.29 +	g_TeamScores = CreateArray(2);
    1.30 +	g_TotalRounds = 0;
    1.31  }
    1.32  
    1.33  public OnMapEnd()
    1.34 @@ -225,8 +233,7 @@
    1.35  		return;
    1.36  	}
    1.37  
    1.38 -	static total;
    1.39 -	total++;
    1.40 +	g_TotalRounds++;
    1.41  	
    1.42  	new team[2], teamPos = -1;
    1.43  	for (new i; i < GetArraySize(g_TeamScores); i++)
    1.44 @@ -268,7 +275,7 @@
    1.45  		new maxrounds = GetConVarInt(g_Cvar_Maxrounds);
    1.46  		if (maxrounds)
    1.47  		{
    1.48 -			if (total >= (maxrounds - GetConVarInt(g_Cvar_StartRounds)))
    1.49 +			if (g_TotalRounds >= (maxrounds - GetConVarInt(g_Cvar_StartRounds)))
    1.50  			{
    1.51  				InitiateVote();
    1.52  			}