plugins/randomcycle.sp
changeset 1664 e054be79e28a
parent 1606 4fb3959c2c96
child 1889 5b4d6acc4d82
     1.1 --- a/plugins/randomcycle.sp	Fri Nov 09 18:08:09 2007 +0000
     1.2 +++ b/plugins/randomcycle.sp	Fri Nov 09 23:46:05 2007 +0000
     1.3 @@ -53,8 +53,9 @@
     1.4  
     1.5  public OnPluginStart()
     1.6  {
     1.7 -	g_MapList = CreateArray(33);
     1.8 -	g_OldMapList = CreateArray(33);
     1.9 +	new arraySize = ByteCountToCells(33);	
    1.10 +	g_MapList = CreateArray(arraySize);
    1.11 +	g_OldMapList = CreateArray(arraySize);
    1.12  
    1.13  	g_Cvar_Mapfile = CreateConVar("sm_randomcycle_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
    1.14  	g_Cvar_ExcludeMaps = CreateConVar("sm_randomcycle_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
    1.15 @@ -83,7 +84,7 @@
    1.16  	decl String:map[32];
    1.17  
    1.18  	new bool:oldMaps = false;
    1.19 -	if (GetArraySize(g_MapList) > GetConVarInt(g_Cvar_ExcludeMaps))
    1.20 +	if (GetConVarInt(g_Cvar_ExcludeMaps) && GetArraySize(g_MapList) > GetConVarInt(g_Cvar_ExcludeMaps))
    1.21  	{
    1.22  		oldMaps = true;
    1.23  	}
    1.24 @@ -91,7 +92,7 @@
    1.25  	new b = GetRandomInt(0, GetArraySize(g_MapList) - 1);
    1.26  	GetArrayString(g_MapList, b, map, sizeof(map));
    1.27  
    1.28 -	while (oldMaps && IsStringInArray(g_OldMapList, map))
    1.29 +	while (oldMaps && FindStringInArray(g_OldMapList, map) != -1)
    1.30  	{
    1.31  		b = GetRandomInt(0, GetArraySize(g_MapList) - 1);
    1.32  		GetArrayString(g_MapList, b, map, sizeof(map));