You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

91 lines
2.3 KiB

#include <sourcemod>
#define TF2_MAXPLAYERS 101
#define _one_person
#define VOTE_NO "###no###"
#define VOTE_YES "###yes###"
g_CurrentVoteTarget = 0;
/*stock DisplayVote(int client, int target, &Callback, const char[] phrare, const char[] menu_phrare, bool random = true){
g_CurrentVoteTarget = GetClientUserId(target);
PrintToChatAll(phrare, client, target);
PrintCenterTextAll(phrare, client, target);
Handle VoteMenuProcessing = new Menu(Callback, MENU_ACTIONS_ALL);
SetMenuTitle(VoteMenuProcessing, menu_phrare);
if(random){
int range_a = 6, range_b = 10;
int yes = GetRandomInt(range_a, range_b);
for(int i = range_a; i < range_b; i++){
if(i == yes) AddMenuItem(VoteMenuProcessing, VOTE_YES, "ДА");
else AddMenuItem(VoteMenuProcessing, VOTE_NO, "НЕТ НЕ НАДО");
}
} else {
AddMenuItem(VoteMenuProcessing, VOTE_YES, "ДА");
AddMenuItem(VoteMenuProcessing, VOTE_NO, "НЕТ НЕ НАДО");
}
SetMenuExitButton(VoteMenuProcessing, false);
VoteMenuToAll(VoteMenuProcessing, 20);
}
*/
bool TestVoteDelay(int client){
int delay = CheckVoteDelay();
if (delay > 0)
{
if (delay > 60)
{
ReplyToCommand(client, "Чтоб начать новое голосование нужно подождать %i минут!", (delay / 60));
}
else
{
ReplyToCommand(client, "Чтоб начать новое голосование нужно подождать %i секунд!", delay);
}
return false;
}
return true;
}
stock ClearPlayerVotes(int client, int[][] votes){
for(int sub_client = 0; sub_client < TF2_MAXPLAYERS; sub_client++){
votes[client][sub_client] = 0;
votes[sub_client][client] = 0;
}
}
stock int ReturnVoteCount(int client, int[][] votes){
int count = 0;
for(int i = 1; i <= TF2_MAXPLAYERS; i++){
if(votes[client][i]) count++;
}
return count;
}
stock int CalcNeedCount(float count){
float current_player_count = float(GetClientCount());
return RoundToCeil(current_player_count * count);
}
stock bool IsValidClient(int client){
if(client > 4096){
client = EntRefToEntIndex(client);
}
if(client < 1 || client > MaxClients) return false;
if(!IsClientInGame(client)) return false;
if(IsFakeClient(client)) return false;
if(GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false;
return true;
}