summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-core/map/prefix.sp
blob: 3ecbf89be9102c72bbe268dfc4e398cbea9dc573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
	Mapping API - Prefix

	Detects the map's prefix.
*/



static int currentMapPrefix;



// =====[ PUBLIC ]=====

int GetCurrentMapPrefix()
{
	return currentMapPrefix;
}



// =====[ LISTENERS ]=====

void OnMapStart_Prefix()
{
	char map[PLATFORM_MAX_PATH], mapPrefix[PLATFORM_MAX_PATH];
	GetCurrentMapDisplayName(map, sizeof(map));

	// Get all characters before the first '_' character
	for (int i = 0; i < sizeof(mapPrefix); i++)
	{
		if (map[i] == '\0' || map[i] == '_')
		{
			break;
		}

		mapPrefix[i] = map[i];
	}

	if (StrEqual(mapPrefix[0], "kzpro", false))
	{
		currentMapPrefix = MapPrefix_KZPro;
	}
	else
	{
		currentMapPrefix = MapPrefix_Other;
	}
}