#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
public void OnPluginStart()
{
ConVar h_gameMode = FindConVar("mp_gamemode");
HookConVarChange(h_gameMode, ConVarChange_GameMode);
SetConVarString(h_gameMode, "coop");
ConVar h_difficulty = FindConVar("z_difficulty");
HookConVarChange(h_difficulty, ConVarChange_Difficulty);
SetConVarString(h_difficulty, "Impossible");
AddCommandListener(OnCommandCallvote, "callvote");
}
public void ConVarChange_GameMode(ConVar convar, const char [] oldValue, const char [] newValue)
{
if (strcmp("coop", newValue) != 0)
{
SetConVarString(convar, "coop");
}
}
public void ConVarChange_Difficulty(ConVar convar, const char [] oldValue, const char [] newValue)
{
if (strcmp("Impossible", newValue) != 0)
{
SetConVarString(convar, "Impossible");
}
}
public Action OnCommandCallvote(int client, const char[] command, int args)
{
if (client && IsClientInGame(client) && !IsFakeClient(client))
{
char voteName[16];
GetCmdArg(1, voteName, 16);
if (strcmp(voteName, "ChangeDifficulty", false) == 0)
{
return Plugin_Handled;
}
}
return Plugin_Continue;
}