Raised This Month: $202 Target: $400
 50% 

[CS:GO] Overtime Plugin request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flex1z
Junior Member
Join Date: Dec 2020
Old 01-02-2021 , 15:11   [CS:GO] Overtime Plugin request
Reply With Quote #1

Hello, I'm using this plugin but it does not work.
On round 28 nothing shows up and no errors. Can someone pls help

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart() 
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);
    
RegConsoleCmd("test_command"Command_Test);
}


public 
Action Command_Test(int clientint args)

    
DoVoteMenu();
}

public 
Action Event_RoundStart(Event evEvent, const char[] szNamebool bDontBroadcast)
{
    
int CurrentRoundNum GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT);
    
    if(
CurrentRoundNum 28 != 0) {
        return;
    }
    
    
    
PrintToChatAll("Round %d Test message."CurrentRoundNum);
}  



public 
int Handle_VoteMenu(Menu menuMenuAction actionint param1int param2)
{
    
char buffer[64], display[64];
    
menu.GetItem(param1buffersizeof(buffer), _displaysizeof(display));

    if (
action == MenuAction_End)
    {
        
delete menu;
    } 
    else if (
action == MenuAction_VoteEnd
    {
        if (
param1 == 0)
        {
            
//menu.GetItem(param1);
            
ServerCommand("mp_overtime_enable 1");
        }
    }
}

 
void DoVoteMenu()
{
    if (
IsVoteInProgress())
    {
        return;
    }
 
    
Menu menu = new Menu(Handle_VoteMenu);
    
menu.SetTitle("Should there be an overtime?");
    
menu.AddItem("yes""Yes");
    
menu.AddItem("no""No");
    
menu.ExitButton false;
    
menu.DisplayVoteToAll(20);

Flex1z is offline
Rugal
Member
Join Date: Jun 2020
Location: Brazil
Old 01-02-2021 , 15:51   Re: [CS:GO] Overtime Plugin request
Reply With Quote #2

But why do you need a plugin to run an Overtime ?, most PUG 5x5 plugins already include this in the configuration.
__________________
Need to set up a server? access
www.rugalservidores.com.br
Rugal is offline
Flex1z
Junior Member
Join Date: Dec 2020
Old 01-03-2021 , 05:11   Re: [CS:GO] Overtime Plugin request
Reply With Quote #3

I run a community competitive server where I want to give users the option to have overtime or not.
The plugin unfortunately does not work. Do you maybe know why or possibly have a working one?
Flex1z is offline
Rugal
Member
Join Date: Jun 2020
Location: Brazil
Old 01-03-2021 , 14:52   Re: [CS:GO] Overtime Plugin request
Reply With Quote #4

Quote:
Originally Posted by Flex1z View Post
I run a community competitive server where I want to give users the option to have overtime or not.
The plugin unfortunately does not work. Do you maybe know why or possibly have a working one?

The Warmod BFG plugin already has this feature included, if players want to play OverTime, just use !ot to activate the feature. If
no one types this, the game will end in a draw, as well as the standard competitive valve. And no, I don't know of an overtime plugin, why doesn't it make sense to have one if it already comes with competitive plugins.
__________________
Need to set up a server? access
www.rugalservidores.com.br

Last edited by Rugal; 01-03-2021 at 14:53.
Rugal is offline
Flex1z
Junior Member
Join Date: Dec 2020
Old 01-03-2021 , 15:13   Re: [CS:GO] Overtime Plugin request
Reply With Quote #5

But that's not the point of the plugin at all. I'm trying to let the players vote for overtime when round 28 starts with the menu. If that works get more then 50% yes to have overtime otherwise a draw. With just typing !OT you instantly active overtime which I'm not trying to achieve.
Flex1z is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 01-03-2021 , 21:16   Re: [CS:GO] Overtime Plugin request
Reply With Quote #6

Quote:
Originally Posted by Flex1z View Post
But that's not the point of the plugin at all. I'm trying to let the players vote for overtime when round 28 starts with the menu. If that works get more then 50% yes to have overtime otherwise a draw. With just typing !OT you instantly active overtime which I'm not trying to achieve.
Try that
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart() 
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);
}

public 
Action Event_RoundStart(Event evEvent, const char[] szNamebool bDontBroadcast)
{
    
int CurrentRoundNum GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT);
    
    if(
CurrentRoundNum == 28) {
        
DoVoteMenu();
    }   
}  

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

 public 
void VoteResultCallback(Menu menuint num_votesint num_clients, const int[][] client_infoint num_items, const int[][] item_info)
{
    
char item[16];
    
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], itemsizeof(item)); 
    if (
StrEqual(item"yes"false))
    {
        
ServerCommand("mp_overtime_enable 1");
    }
}

void DoVoteMenu()
{
    if (
IsVoteInProgress())
    {
        return;
    }
    
Menu menu = new Menu(Handle_VoteMenu);
    
menu.VoteResultCallback VoteResultCallback;
    
menu.SetTitle("Should there be an overtime?");
    
menu.AddItem("yes""Yes");
    
menu.AddItem("no""No");
    
menu.ExitButton false;
    
menu.DisplayVoteToAll(20);

__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is online now
Flex1z
Junior Member
Join Date: Dec 2020
Old 01-04-2021 , 09:00   Re: [CS:GO] Overtime Plugin request
Reply With Quote #7

Thank you, this works perfectly!
I have one question. Is it possible to let most votes count. So if 3 people do yes and 2 people do no it will go into overtime.
Flex1z is offline
azalty
Member
Join Date: Feb 2020
Old 01-05-2021 , 18:53   Re: [CS:GO] Overtime Plugin request
Reply With Quote #8

Quote:
Originally Posted by Flex1z View Post
Thank you, this works perfectly!
I have one question. Is it possible to let most votes count. So if 3 people do yes and 2 people do no it will go into overtime.
That should already be the case. It might NOT be the case if there is 50% yes and 50% no, not sure if the first menu item takes the priority in this case or if it is the first one to get to 50%.

If no overtime occurs after a tie, just change (at line 32):
Code:
if (StrEqual(item, "yes", false))
to
Code:
if (StrEqual(item, "yes", false) || (item_info[0][VOTEINFO_ITEM_VOTES] == item_info[1][VOTEINFO_ITEM_VOTES]))
__________________
azalty is offline
Flex1z
Junior Member
Join Date: Dec 2020
Old 01-06-2021 , 19:56   Re: [CS:GO] Overtime Plugin request
Reply With Quote #9

Oh thanks! Is there a way to check that specificaly? For example when the voting is done it says like X% voted yes for overtime in chat.
Flex1z is offline
azalty
Member
Join Date: Feb 2020
Old 01-13-2021 , 16:23   Re: [CS:GO] Overtime Plugin request
Reply With Quote #10

Does it not already says that?

You can try to add:

Code:
int percentage = RoundToNearest((item_info[0][VOTEINFO_ITEM_VOTES] / num_votes) * 100);
PrintToChatAll("Vote passed! %i%% voted yes.", percentage);
not tested, but should work
__________________
azalty is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:31.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode