Raised This Month: $ Target: $400
 0% 

Help with vote plugin!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EzzEt
Junior Member
Join Date: Jun 2008
Location: Sweden
Old 01-28-2009 , 13:44   Help with vote plugin!
Reply With Quote #1

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;
}

Last edited by EzzEt; 01-29-2009 at 15:37.
EzzEt is offline
Reply



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 01:53.


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