View Single Post
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 06-02-2020 , 12:41   Re: How to make vote to spesific team
Reply With Quote #2

PHP Code:
#pragma semicolon 1

#define DEBUG
#pragma tabsize 0
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma newdecls required
int Terrorists[MAXPLAYERS 1];
int counter 0;
public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_command"Command,"The command that opens the vote");//edit this
}

public 
Action Command(int clientint args)
{
    if (
IsVoteInProgress())
    {
        return 
Plugin_Handled;
    }
    
    
Menu menu = new Menu(MenuHandler_Vote);
    
menu.VoteResultCallback VoteResultCallback_Vote;
    
menu.SetTitle("Your Vote Title");//edit this
    
for (int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)&&!IsFakeClient(i)&&GetClientTeam(i)== CS_TEAM_T)
        {
            
Terrorists[counter] = i;
            
counter++;
        }
    }
    
    
menu.AddItem("option1""option1");//edit this
    
menu.AddItem("option2""option2");//edit this
    
    
menu.ExitButton false;
    
menu.DisplayVote(Terroristscounter15);//15 is the number of seconds the menu will be shown to the Terrorists. editable.
    
return Plugin_Handled;
}

public 
int MenuHandler_Vote(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
void VoteResultCallback_Vote(Menu menuint num_votesint num_clients, const int[][] client_infoint num_items, const int[][] item_info)
{
    
char item[65];
    
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], itemsizeof(item));
    
    if (
StrEqual(item"option1"false))//edit this
       
PrintToChatAll("%s is the answer",item);
    else if(
StrEqual(item"option2"false))//edit this
    
PrintToChatAll("%s is the answer",item);
    for (
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)&&!IsFakeClient(i))
            
Terrorists[i] = 0;
    }
    
counter 0;

SSheriFF is offline