AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with vote plugin! (https://forums.alliedmods.net/showthread.php?t=84588)

EzzEt 01-28-2009 13:44

Help with vote plugin!
 
Hi all! I have a vote plugin that i need help with. I did so that the vote comes up every 15 minutes with "set_task(300.0, "ShowVote")" and also when a player just've connected to the server. And I also did so that when a player says: "/showvote" in chat, the votemenu comes up. But here is the problem: when a player says "/showvote", let us say 12 miutes after the first vote comes up, but just 3 minutes after a new vote comes up, the "set_task(300.0, "ShowVote") vote" that is set in the beginning comes up. I wanna do so that the time set_task(300.0) gets reseted to 300 again, so when you say "/ShowVote" it is gonna take 15 minutes to the next one. Please help me if you have any pointers :)

Code:

public plugin_init()
{
    register_concmd("say /showvote", "ShowVote", ADMINVOTE, ");
}

public ShowVote(id, level, cid)
{
    if (!cmd_access(id, level, cid, 0))
        return PLUGIN_HANDLED;

    if(voteStarted)
        return PLUGIN_HANDLED;

    new len = format(menu, 511, "Choose that you want^n");
    for(new i = 0; i < menuNumber; i++)
    {
        if(minPlayers[i] <= get_playersnum())
        {
            keys |= (1<<i);
            len += format(menu[len], 511-len, "%d. %s^n", i+1, menuBody[i]);
            #if defined DEBUG
            server_print("Added %s to menu", menuBody[i]);
            #endif
        }
    }

    len += format(menu[len], 511-len, "^n0. None");
    keys |= (1<<9);

    show_menu(0, keys, menu, 15, "Vote_menu");
    voteStarted = true;

    set_task(25.0,"CheckVotes");
    set_task(300.0, "ShowVote");

    return PLUGIN_CONTINUE;
}



All times are GMT -4. The time now is 01:53.

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