AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to make vote to spesific team (https://forums.alliedmods.net/showthread.php?t=324882)

pr0mers 05-30-2020 09:17

How to make vote to spesific team
 
//i made voting i just need i want to show it to only t like ct cant see the vote


How can i make voting to only t players like

1 or 2
1
2

is vote
this vote will be shown only to t .ct's cant answer it

and how can i know 1 or 2 is chosen
like if answer is 1 do printtochatall("1 is answer")
else printtochatall("2 is asnwer");

and what happens if votes are 50% to 50%

SSheriFF 06-02-2020 12:41

Re: How to make vote to spesific team
 
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;




All times are GMT -4. The time now is 14:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.