PDA

View Full Version : [REQ] [ANY] exclude spectators from votes


stoneyschillhouse
06-26-2016, 06:01
Hi

I want this in any vote , the spectators will be excluded!

I have found something for the rtv.sp

I have replaced the lines 187 - 255

AttemptRTV(client)
{
if (!g_RTVAllowed || (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished()))
{
ReplyToCommand(client, "[SM] %t", "RTV Not Allowed");
return;
}

if (!CanMapChooserStartVote())
{
ReplyToCommand(client, "[SM] %t", "RTV Started");
return;
}

if (GetClientCount(true) < g_Cvar_MinPlayers.IntValue)
{
ReplyToCommand(client, "[SM] %t", "Minimal Players Not Met");
return;
}

if (g_Voted[client])
{
ReplyToCommand(client, "[SM] %t", "Already Voted", g_Votes, g_VotesNeeded);
return;
}

new String:name[64];
GetClientName(client, name, sizeof(name));

g_Votes++;
g_Voted[client] = true;

PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);

if (g_Votes >= g_VotesNeeded)
{
StartRTV();
}
}with these

AttemptRTV(client)
{
if (!g_RTVAllowed || (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished()))
{
ReplyToCommand(client, "[SM] %t", "RTV Not Allowed");
return;
}

if (!CanMapChooserStartVote())
{
ReplyToCommand(client, "[SM] %t", "RTV Started");
return;
}

if (GetClientCount(true) < g_Cvar_MinPlayers.IntValue)
{
ReplyToCommand(client, "[SM] %t", "Minimal Players Not Met");
return;
}

if (g_Voted[client])
{
ReplyToCommand(client, "[SM] %t", "Already Voted", g_Votes, g_VotesNeeded);
return;
}

new String:name[64];
GetClientName(client, name, sizeof(name));

if (GetClientTeam(client) != 1)
{
g_Votes++;
g_Voted[client] = true;

new totalvalid = 0;
for (new i = 1; i < MaxClients; i++)
{
if (IsClientInGame(i))
{
if (GetClientTeam(i) > 1)
{
totalvalid++;
}
}
}

// if we reached this far the minimum amount of players required has already been met..
new needed = RoundToFloor(float(totalvalid) * GetConVarFloat(g_Cvar_Needed));
PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, needed);

if (g_Votes >= needed)
{
StartRTV();
}
}
else
{
PrintToChat(client, "Spectators aren't allowed to RTV.");
}
}This works grate - only clients on t + ct team are included for rtv
Spectators will get the massage....

Is there any way to handle this for all votes ? (kick, ban, mute with this plugin https://forums.alliedmods.net/showthread.php?t=72058 )

it does not matter if one by one or globaly for all.

the main thing is that it works properly
If one by one or globaly