AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [CS:GO] Overtime Plugin request (https://forums.alliedmods.net/showthread.php?t=329652)

Flex1z 01-02-2021 14:11

[CS:GO] Overtime Plugin request
 
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);



Rugal 01-02-2021 14:51

Re: [CS:GO] Overtime Plugin request
 
But why do you need a plugin to run an Overtime ?, most PUG 5x5 plugins already include this in the configuration.

Flex1z 01-03-2021 04:11

Re: [CS:GO] Overtime Plugin request
 
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?

Rugal 01-03-2021 13:52

Re: [CS:GO] Overtime Plugin request
 
Quote:

Originally Posted by Flex1z (Post 2731129)
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.

Flex1z 01-03-2021 14:13

Re: [CS:GO] Overtime Plugin request
 
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.

SSheriFF 01-03-2021 20:16

Re: [CS:GO] Overtime Plugin request
 
Quote:

Originally Posted by Flex1z (Post 2731194)
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);



Flex1z 01-04-2021 08:00

Re: [CS:GO] Overtime Plugin request
 
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.

azalty 01-05-2021 17:53

Re: [CS:GO] Overtime Plugin request
 
Quote:

Originally Posted by Flex1z (Post 2731284)
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]))

Flex1z 01-06-2021 18:56

Re: [CS:GO] Overtime Plugin request
 
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.

azalty 01-13-2021 15:23

Re: [CS:GO] Overtime Plugin request
 
Does it not already says that?

You can try to add:

Code:

int percentage = RoundToNearest((float(item_info[0][VOTEINFO_ITEM_VOTES]) / float(num_votes)) * 100);
PrintToChatAll("Vote passed! %i%% voted yes.", percentage);

not tested, but should work


All times are GMT -4. The time now is 00:54.

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