ConVar hm_blockvote_difficulty_easy;
ConVar hm_blockvote_difficulty_normal;
ConVar hm_blockvote_difficulty_impossible;
public void OnPluginStart()
{
RegConsoleCmd("callvote", Callvote_Handler);
hm_blockvote_difficulty_easy = CreateConVar("hm_blockvote_difficulty_easy", "1", "", FCVAR_NONE);
hm_blockvote_difficulty_normal = CreateConVar("hm_blockvote_difficulty_normal", "1", "", FCVAR_NONE);
hm_blockvote_difficulty_impossible = CreateConVar("hm_blockvote_difficulty_impossible", "1", "", FCVAR_NONE);
}
public Action Callvote_Handler(int client, int args)
{
if (client == 0)
{
return Plugin_Continue;
}
char voteName[32];
char voteValue[128];
GetCmdArg(1, voteName, sizeof(voteName));
GetCmdArg(2, voteValue, sizeof(voteValue));
if (StrEqual(voteName, "ChangeDifficulty", false))
{
if (StrEqual(voteValue, "Easy", false))
{
if (hm_blockvote_difficulty_easy.IntValue > 0)
{
return Plugin_Handled;
}
else
{
return Plugin_Continue;
}
}
else if (StrEqual(voteValue, "Normal", false))
{
if (hm_blockvote_difficulty_normal.IntValue > 0)
{
return Plugin_Handled;
}
else
{
return Plugin_Continue;
}
}
else if (StrEqual(voteValue, "Impossible", false))
{
if (hm_blockvote_difficulty_impossible.IntValue > 0)
{
return Plugin_Handled;
}
else
{
return Plugin_Continue;
}
}
return Plugin_Continue;
}
return Plugin_Continue;
}
держите от начинающего кодера