Port funvotes.sp.

This commit is contained in:
David Anderson 2014-11-09 16:28:03 -08:00
parent c425305cde
commit 8fd0cbecf7

View File

@ -53,10 +53,10 @@ public Plugin:myinfo =
new Handle:g_hVoteMenu = INVALID_HANDLE;
new Handle:g_Cvar_Limits[5] = {INVALID_HANDLE, ...};
new Handle:g_Cvar_Gravity = INVALID_HANDLE;
new Handle:g_Cvar_Alltalk = INVALID_HANDLE;
new Handle:g_Cvar_FF = INVALID_HANDLE;
ConVar g_Cvar_Limits[5] = {null, ...};
ConVar g_Cvar_Gravity;
ConVar g_Cvar_Alltalk;
ConVar g_Cvar_FF;
// new Handle:g_Cvar_Show = INVALID_HANDLE;
@ -199,8 +199,9 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
}
else if (action == MenuAction_VoteEnd)
{
decl String:item[64];
new Float:percent, Float:limit, votes, totalVotes;
char item[64];
float percent, limit;
int votes, totalVotes;
GetMenuVoteInfo(param2, votes, totalVotes);
GetMenuItem(menu, param1, item, sizeof(item));
@ -212,7 +213,7 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
percent = GetVotePercent(votes, totalVotes);
limit = GetConVarFloat(g_Cvar_Limits[g_voteType]);
limit = g_Cvar_Limits[g_voteType].FloatValue;
/* :TODO: g_voteClient[userid] needs to be checked.
*/
@ -235,7 +236,7 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
{
PrintToChatAll("[SM] %t", "Cvar changed", "sv_gravity", item);
LogAction(-1, -1, "Changing gravity to %s due to vote.", item);
SetConVarInt(g_Cvar_Gravity, StringToInt(item));
g_Cvar_Gravity.IntValue = StringToInt(item);
}
case (voteType:burn):
@ -257,16 +258,16 @@ public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
case (voteType:alltalk):
{
PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
LogAction(-1, -1, "Changing alltalk to %s due to vote.", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
SetConVarBool(g_Cvar_Alltalk, !GetConVarBool(g_Cvar_Alltalk));
PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (g_Cvar_Alltalk.BoolValue ? "0" : "1"));
LogAction(-1, -1, "Changing alltalk to %s due to vote.", (g_Cvar_Alltalk.BoolValue ? "0" : "1"));
g_Cvar_Alltalk.BoolValue = !g_Cvar_Alltalk.BoolValue;
}
case (voteType:ff):
{
PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
SetConVarBool(g_Cvar_FF, !GetConVarBool(g_Cvar_FF));
PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (g_Cvar_FF.BoolValue ? "0" : "1"));
LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (g_Cvar_FF.BoolValue ? "0" : "1"));
g_Cvar_FF.BoolValue = !g_Cvar_FF.BoolValue;
}
}
}