summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-hud/commands.sp
blob: fc5ed4ece1896456bdf1a23084cb82ea3f3d3b94 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
void RegisterCommands()
{
	RegConsoleCmd("sm_menu", CommandMenu, "[KZ] Toggle the simple teleport menu.");
	RegConsoleCmd("sm_cpmenu", CommandMenu, "[KZ] Toggle the simple teleport menu.");
	RegConsoleCmd("sm_adv", CommandToggleAdvancedMenu, "[KZ] Toggle the advanced teleport menu.");
	RegConsoleCmd("sm_panel", CommandToggleInfoPanel, "[KZ] Toggle visibility of the centre information panel.");
	RegConsoleCmd("sm_timerstyle", CommandToggleTimerStyle, "[KZ] Toggle the style of the timer text.");
	RegConsoleCmd("sm_timertype", CommandToggleTimerType, "[KZ] Toggle visibility of your time type.");
	RegConsoleCmd("sm_speed", CommandToggleSpeed, "[KZ] Toggle visibility of your speed and jump pre-speed.");
	RegConsoleCmd("sm_hideweapon", CommandToggleShowWeapon, "[KZ] Toggle visibility of your weapon.");
}

public Action CommandMenu(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_TPMenu) != TPMenu_Disabled)
	{
		GOKZ_HUD_SetOption(client, HUDOption_TPMenu, TPMenu_Disabled);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_TPMenu, TPMenu_Simple);
	}
	return Plugin_Handled;
}

public Action CommandToggleAdvancedMenu(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_TPMenu) != TPMenu_Advanced)
	{
		GOKZ_HUD_SetOption(client, HUDOption_TPMenu, TPMenu_Advanced);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_TPMenu, TPMenu_Simple);
	}
	return Plugin_Handled;
}

public Action CommandToggleInfoPanel(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_InfoPanel) == InfoPanel_Disabled)
	{
		GOKZ_HUD_SetOption(client, HUDOption_InfoPanel, InfoPanel_Enabled);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_InfoPanel, InfoPanel_Disabled);
	}
	return Plugin_Handled;
}

public Action CommandToggleTimerStyle(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_TimerStyle) == TimerStyle_Standard)
	{
		GOKZ_HUD_SetOption(client, HUDOption_TimerStyle, TimerStyle_Precise);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_TimerStyle, TimerStyle_Standard);
	}
	return Plugin_Handled;
}

public Action CommandToggleTimerType(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_TimerType) == TimerType_Disabled)
	{
		GOKZ_HUD_SetOption(client, HUDOption_TimerType, TimerType_Enabled);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_TimerType, TimerType_Disabled);
	}
	return Plugin_Handled;
}

public Action CommandToggleSpeed(int client, int args)
{
	int speedText = GOKZ_HUD_GetOption(client, HUDOption_SpeedText);
	int infoPanel = GOKZ_HUD_GetOption(client, HUDOption_InfoPanel);
	
	if (speedText == SpeedText_Disabled)
	{
		if (infoPanel == InfoPanel_Enabled)
		{
			GOKZ_HUD_SetOption(client, HUDOption_SpeedText, SpeedText_InfoPanel);
		}
		else
		{
			GOKZ_HUD_SetOption(client, HUDOption_SpeedText, SpeedText_Bottom);
		}
	}
	else if (infoPanel == InfoPanel_Disabled && speedText == SpeedText_InfoPanel)
	{
		GOKZ_HUD_SetOption(client, HUDOption_SpeedText, SpeedText_Bottom);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_SpeedText, SpeedText_Disabled);
	}
	return Plugin_Handled;
}

public Action CommandToggleShowWeapon(int client, int args)
{
	if (GOKZ_HUD_GetOption(client, HUDOption_ShowWeapon) == ShowWeapon_Disabled)
	{
		GOKZ_HUD_SetOption(client, HUDOption_ShowWeapon, ShowWeapon_Enabled);
	}
	else
	{
		GOKZ_HUD_SetOption(client, HUDOption_ShowWeapon, ShowWeapon_Disabled);
	}
	return Plugin_Handled;
}