AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Need: Vote Extend maptime (https://forums.alliedmods.net/showthread.php?t=319935)

NIELSAD 11-27-2019 08:48

Need: Vote Extend maptime
 
I have been searching for a long time for a plugin that lets players start a vote by typing "!extend" or "!ve" and it would start a vote to extend the maptime of a KZ server by 10 minutes.

Can anybody link a plugin like this to me ? or even make one ?

Thank you in advance!

-Níels

Ilusion9 11-28-2019 08:06

Re: Need: Vote Extend maptime
 
PHP Code:


#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_ve"Command_ExtendMapTime);
    
RegConsoleCmd("sm_extend"Command_ExtendMapTime);
}

public 
Action Command_ExtendMapTime(int clientint args)
{
    if (
IsVoteInProgress())
    {
        return 
Plugin_Handled;
    }
    
    
Menu menu = new Menu(MenuHandler_ExtendMapTimeMENU_ACTIONS_ALL);
    
menu.VoteResultCallback VoteResultCallback_ExtendMapTime;
    
    
menu.SetTitle("Extend map time by 10 minutes?");
    
menu.AddItem("Yes""Yes");
    
menu.AddItem("No""No");
    
    
menu.ExitButton false;
    
menu.DisplayVoteToAll(15);
    
    return 
Plugin_Handled;
}

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

public 
void VoteResultCallback_ExtendMapTime(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"Yes"false))
    {
        
ExtendMapTimeLimit(600);
        
PrintToChatAll("[SM] The current map has been extended with 10 minutes");
    }




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

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