Port rockthevote.
This commit is contained in:
parent
16330d1c4c
commit
86d4cdc0c4
@ -46,12 +46,12 @@ public Plugin:myinfo =
|
|||||||
url = "http://www.sourcemod.net/"
|
url = "http://www.sourcemod.net/"
|
||||||
};
|
};
|
||||||
|
|
||||||
new Handle:g_Cvar_Needed = INVALID_HANDLE;
|
ConVar g_Cvar_Needed;
|
||||||
new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;
|
ConVar g_Cvar_MinPlayers;
|
||||||
new Handle:g_Cvar_InitialDelay = INVALID_HANDLE;
|
ConVar g_Cvar_InitialDelay;
|
||||||
new Handle:g_Cvar_Interval = INVALID_HANDLE;
|
ConVar g_Cvar_Interval;
|
||||||
new Handle:g_Cvar_ChangeTime = INVALID_HANDLE;
|
ConVar g_Cvar_ChangeTime;
|
||||||
new Handle:g_Cvar_RTVPostVoteAction = INVALID_HANDLE;
|
ConVar g_Cvar_RTVPostVoteAction;
|
||||||
|
|
||||||
new bool:g_CanRTV = false; // True if RTV loaded maps and is active.
|
new bool:g_CanRTV = false; // True if RTV loaded maps and is active.
|
||||||
new bool:g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes.
|
new bool:g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes.
|
||||||
@ -106,7 +106,7 @@ public OnConfigsExecuted()
|
|||||||
{
|
{
|
||||||
g_CanRTV = true;
|
g_CanRTV = true;
|
||||||
g_RTVAllowed = false;
|
g_RTVAllowed = false;
|
||||||
CreateTimer(GetConVarFloat(g_Cvar_InitialDelay), Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(g_Cvar_InitialDelay.FloatValue, Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnClientConnected(client)
|
public OnClientConnected(client)
|
||||||
@ -117,7 +117,7 @@ public OnClientConnected(client)
|
|||||||
g_Voted[client] = false;
|
g_Voted[client] = false;
|
||||||
|
|
||||||
g_Voters++;
|
g_Voters++;
|
||||||
g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
|
g_VotesNeeded = RoundToFloor(float(g_Voters) * g_Cvar_Needed.FloatValue);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ public OnClientDisconnect(client)
|
|||||||
|
|
||||||
g_Voters--;
|
g_Voters--;
|
||||||
|
|
||||||
g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
|
g_VotesNeeded = RoundToFloor(float(g_Voters) * g_Cvar_Needed.FloatValue);
|
||||||
|
|
||||||
if (!g_CanRTV)
|
if (!g_CanRTV)
|
||||||
{
|
{
|
||||||
@ -146,7 +146,7 @@ public OnClientDisconnect(client)
|
|||||||
g_Votes >= g_VotesNeeded &&
|
g_Votes >= g_VotesNeeded &&
|
||||||
g_RTVAllowed )
|
g_RTVAllowed )
|
||||||
{
|
{
|
||||||
if (GetConVarInt(g_Cvar_RTVPostVoteAction) == 1 && HasEndOfMapVoteFinished())
|
if (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ public Action:Command_RTV(client, args)
|
|||||||
|
|
||||||
AttemptRTV(client)
|
AttemptRTV(client)
|
||||||
{
|
{
|
||||||
if (!g_RTVAllowed || (GetConVarInt(g_Cvar_RTVPostVoteAction) == 1 && HasEndOfMapVoteFinished()))
|
if (!g_RTVAllowed || (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished()))
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] %t", "RTV Not Allowed");
|
ReplyToCommand(client, "[SM] %t", "RTV Not Allowed");
|
||||||
return;
|
return;
|
||||||
@ -198,7 +198,7 @@ AttemptRTV(client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers))
|
if (GetClientCount(true) < g_Cvar_MinPlayers.IntValue)
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] %t", "Minimal Players Not Met");
|
ReplyToCommand(client, "[SM] %t", "Minimal Players Not Met");
|
||||||
return;
|
return;
|
||||||
@ -255,13 +255,13 @@ StartRTV()
|
|||||||
|
|
||||||
if (CanMapChooserStartVote())
|
if (CanMapChooserStartVote())
|
||||||
{
|
{
|
||||||
new MapChange:when = MapChange:GetConVarInt(g_Cvar_ChangeTime);
|
new MapChange:when = MapChange:g_Cvar_ChangeTime.IntValue;
|
||||||
InitiateMapChooserVote(when);
|
InitiateMapChooserVote(when);
|
||||||
|
|
||||||
ResetRTV();
|
ResetRTV();
|
||||||
|
|
||||||
g_RTVAllowed = false;
|
g_RTVAllowed = false;
|
||||||
CreateTimer(GetConVarFloat(g_Cvar_Interval), Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(g_Cvar_Interval.FloatValue, Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,4 +288,4 @@ public Action:Timer_ChangeMap(Handle:hTimer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user