AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   TF2 Critvote (https://forums.alliedmods.net/showthread.php?t=83961)

r5053 01-18-2009 06:21

TF2 Critvote
 
1 Attachment(s)
This plugin starts a critvote 20 sec after the first client is connected.

Changelog:
v.1.0.0
-initial release

Sexual Harassment Panda 01-26-2009 19:43

Re: TF2 Critvote
 
is this a vote for crits to be on with normal settings or completely off, or is it something else?

blissend 01-27-2009 18:45

Re: TF2 Critvote
 
Quote:

Originally Posted by Sexual Harassment Panda (Post 750767)
is this a vote for crits to be on with normal settings or completely off, or is it something else?

looking at the source it has...

ServerCommand("tf_weapon_criticals 0");

so yeah it seems to turn crits completely off depending on vote. though I'm not a programmer so don't quote me.

sirmoe 01-28-2009 06:41

Re: TF2 Critvote
 
does this vote start every map change?

DJ Tsunami 01-28-2009 09:15

Re: TF2 Critvote
 
Yes.

liam12360 01-28-2009 15:52

Re: TF2 Critvote
 
Woah looking at the source this could be edited to be almost anything.. Cheats vote, Alltalk, even toggling other plugins! Call me stupid but I find this a very valuable example as I'm not really a 'start from scratch' programmer. Thanks for this even if it dosent get approved! Rep+

r5053 01-28-2009 16:50

Re: TF2 Critvote
 
:)

noremac430 03-27-2009 10:02

Re: TF2 Critvote
 
Hey man. Love the plugin. Our server runs nocrits all the time, so i tweaked the vote to reflect that. It now asks to enable crits instead of disabling them. I'll repost the updated code.

Thanks again for all your work on this. It's a lifesaver!!

Code:

//Includes:
#include <sourcemod>

#define PLUGIN_VERSION "1.0.0"

new bool:firstclientconnected = false

public Plugin:myinfo =
{
    name = "TF2 Critvote",
    author = "R-Hehl",
    description = "TF2 Critvote",
    version = PLUGIN_VERSION,
    url = "http://HLPortal.de"
};
public OnPluginStart()
{
    CreateConVar("sm_tf2_critvote_version", PLUGIN_VERSION, "TF2 Critvote", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
public OnMapStart()
{
    firstclientconnected = false
}
public OnClientPostAdminCheck()
{
    if (!firstclientconnected)
    {
    CreateTimer(30.0, StartVote)
    firstclientconnected = true
    }
}
public Action:StartVote(Handle:timer)
{
    DoVoteMenu()
}

public Handle_VoteMenu(Handle:menu, MenuAction:action, param1, param2)
{
    if (action == MenuAction_End)
    {
        /* This is called after VoteEnd */
        CloseHandle(menu);
    } else if (action == MenuAction_VoteEnd) {
        /* 0=yes, 1=no */
        if (param1 == 1)
        {
            ServerCommand("tf_weapon_criticals 0");
            PrintToChatAll("\x04[\x03TF2-Critvote\x04]\x01 Crits Disabled")
        }
        else
        {
            PrintToChatAll("\x04[\x03TF2-Critvote\x04]\x01 Crits Enabled")
            ServerCommand("tf_weapon_criticals 1");
        }
    }
}
 
DoVoteMenu()
{
    if (IsVoteInProgress())
    {
        return;
    }
 
    new Handle:menu = CreateMenu(Handle_VoteMenu)
    SetMenuTitle(menu, "Enable Crits?")
    AddMenuItem(menu, "yes", "Yes")
    AddMenuItem(menu, "no", "No")
    SetMenuExitButton(menu, false)
    VoteMenuToAll(menu, 20);
}


Johnny_Napalm 04-27-2009 18:41

Re: TF2 Critvote
 
I'm still a little new at all this, but could this be modified to allow it to be a client-triggered vote instead of automatic?

retsam 04-27-2009 21:29

Re: TF2 Critvote
 
Quote:

Originally Posted by Johnny_Napalm (Post 815819)
I'm still a little new at all this, but could this be modified to allow it to be a client-triggered vote instead of automatic?


Sourcemod can do anything. Remember that. :)


All times are GMT -4. The time now is 23:44.

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