Raised This Month: $51 Target: $400
 12% 

JailBreak VoteDayMenu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
karolek0901
Junior Member
Join Date: May 2010
Old 04-08-2011 , 20:51   JailBreak VoteDayMenu
Reply With Quote #1

Hello
I need someone to chack this plugin code and fix

Code:
/*
*
*    JailBreak VoteDayMenu by Drekes
*    
*
*    Description:
*        Day vote menu for ct's 
*        teams see voted options + countdown.
*        Day is displayed in top right corner    (Day Number || "Day Name")
*        Cvar for countdown timer.
*
*        Examples here:
*            - http://img690.**************/f/jailunforgiven0000.png/
*            - http://img836.**************/i/jailunforgiven0004.png/
*
*    Cvars:
*    
*    
*    Commands:
* 
*
*    Credits:
* 
*
*    Changelog:
*        v1.0.0: Created plugin
*
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#pragma semicolon     1
#define VERSION        "1.0.0"

#define MAX_DAYS     9
#define TASK_TIMER    54512132



enum
{
    FreeDay,
    CageDay,
    NightCrawlerDay,
    ZombieDay,
    RiotDay,
    PresidentDay,
    UspNinjaDay,
    DodgeballDay,
    OtherDay
};
    
new const g_szDayNames[MAX_DAYS][] = 
{
    "Free Day",
    "Cage Day",
    "NightCrawler Day",
    "Zombie Day",
    "Riot Day",
    "President Day",
    "USP Ninja Day",
    "Dodgeball Day",
    "Other Day"
};
/*
new const g_iDayDelays[MAX_DAYS][] = 
{
    0,    // Free day
    0,    // Cage Day
    3,    // NightCrawler Day
    2,    // Zombie Day
    5,    // Riot Day
    0,    // President Day
    3,    // USP Ninja Day
    0,    // DodgeBall Day
    0,    // Other Day
};
*/

new g_iTimer,
    g_iCurrentRound,
    g_iCurrentVoters,
    // g_iDelays[MAX_DAYS] = g_iDayDelays[MAX_DAYS],
    g_iVotes[MAX_DAYS],
    g_iCurrentDay;
    
public plugin_init()
{
    register_plugin("Jailbreak Days Votemenu", VERSION, "Drekes");
    
    register_logevent("LogEventRoundStart", 2, "1=Round_Start");
}


public LogEventRoundStart()
{
    g_iCurrentRound++;
    CreateVoteMenu();
}

CreateVoteMenu()
{
    new iVoteMenu,
        szVoteMenu[128],
        szI[3];
    
    if(!task_exists(TASK_TIMER))
    {
        g_iTimer = 15;
        set_task(1.0, "TaskTimer", TASK_TIMER, .flags = "b");
    }
    
    formatex(szVoteMenu, charsmax(szVoteMenu), "\y[CT MENU]\w What day do you prefer ? [%i]", g_iTimer);
    iVoteMenu = menu_create(szVoteMenu, "HandleVoteMenu");
    
    for(new i = 0; i < MAX_DAYS; i++)
    {
        formatex(szVoteMenu, charsmax(szVoteMenu), "%s [Votes: %i]", g_szDayNames[i], g_iVotes[i]);
        num_to_str(i + 1, szI, charsmax(szI));
        menu_additem(iVoteMenu, szVoteMenu, szI);
    }
    
    // menu_setprop(iVoteMenu, MPROP_PERPAGE, 0);
    menu_setprop(iVoteMenu, MPROP_NUMBER_COLOR, "\w");
    menu_setprop(iVoteMenu, MPROP_EXIT, MEXIT_NEVER);
    
    new iPlayers[32],
        iNum,
        iPlayer;
        
    get_players(iPlayers, iNum);
    for(new j = 0; j < iNum; j++)
    {
        iPlayer = iPlayers[j];
        
        menu_display(iPlayer, iVoteMenu);
        g_iCurrentVoters++;
    }
}


public HandleVoteMenu(id, iMenuId, iItem)
{
    if(!is_user_connected(id) || cs_get_user_team(id) != CS_TEAM_CT)
    {    
        // menu_destroy(iMenuId);
        CreateVoteMenu();
        
        return PLUGIN_HANDLED;
    }

    new iAccess, iCallback, szData[3];
    menu_item_getinfo(iMenuId, iItem, iAccess, szData, 2, _, _, iCallback);
    g_iVotes[str_to_num(szData)]++;
    
    return PLUGIN_HANDLED;
}


public TaskEndVote()
{
    new iTopVotes[3],
        iVoteIds[3],
        iVotes,
        j;
    
    for(new i = 0; i < MAX_DAYS; i++)
    {    
        if(g_iVotes[i])
        {
            if(iVotes < 3)
            {
                iTopVotes[iVotes] = g_iVotes[i];
                iVoteIds[iVotes] = i;
                
                iVotes++;
            }
            
            else
            {
                for(j = 0; j < 3; i++)
                {
                    if(g_iVotes[j] < g_iVotes[i])
                    {
                        iTopVotes[j] = g_iVotes[i];
                        iVoteIds[j] = i;
                    
                        break;
                    }
                }
            }
        }
    }

    switch(iVotes)
    {
        case 0:
        {    
            g_iCurrentDay = random(MAX_DAYS);
            client_print(0, print_chat, "Nobody voted. Today has been randomly selected to %s", g_szDayNames[g_iCurrentDay]);
        }
    
        case 1:
        {
            g_iCurrentDay = iVoteIds[0];
            client_print(0, print_chat, "Today is gonna be a %s", g_szDayNames[g_iCurrentDay]);
        }
        
        case 2:
        {
            if(iTopVotes[0] == iTopVotes[1])
            {
                g_iCurrentDay = iTopVotes[random(1)];
                client_print(0, print_chat, "Vote has tied. Today has been randomly selected to %s", g_szDayNames[g_iCurrentDay]);
            }
            
            else if(iTopVotes[0] > iTopVotes[1])
            {
                g_iCurrentDay = iVoteIds[0];
                client_print(0, print_chat, "Today is gonna be a %s", g_szDayNames[g_iCurrentDay]);
            }
            
            else
            {
                g_iCurrentDay = iVoteIds[1];
                client_print(0, print_chat, "Today is gonna be a %s", g_szDayNames[g_iCurrentDay]);
            }
        }
        
        case 3:
        {
            g_iCurrentDay = iTopVotes[random(2)];
            client_print(0, print_chat, "Vote has tied. Today has randomly selected to %s", g_szDayNames[g_iCurrentDay]);
        }
    }
    
    // menu_destroy(g_iVoteMenu);
    remove_task(TASK_TIMER);

    return PLUGIN_HANDLED;
}

    
public TaskTimer()
{
    g_iTimer--;
    
    CreateVoteMenu();
}
Thanx for fixing this code because when i complicate and turn on in the serwer is no working and i don't know what is wrong with this cod

Last edited by karolek0901; 04-08-2011 at 21:18.
karolek0901 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-08-2011 , 21:15   Re: JailBreak VoteDayMenu
Reply With Quote #2

Where did you get this plugin?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
karolek0901
Junior Member
Join Date: May 2010
Old 04-08-2011 , 21:19   Re: JailBreak VoteDayMenu
Reply With Quote #3

i find in google i don't know where Can you help me repair this plugin

tis is logs for the serwer when i turn on this plugin
Code:
L 04/09/2011 - 01:04:59: [AMXX] Run time error 10 (plugin "daysmenu.amxx") (native "menu_display") - debug not enabled!
L 04/09/2011 - 01:04:59: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 04/09/2011 - 01:05:00: Plugin called menu_display when item=MENU_EXIT

Last edited by karolek0901; 04-08-2011 at 21:21.
karolek0901 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-08-2011 , 22:18   Re: JailBreak VoteDayMenu
Reply With Quote #4

It is not a complete plugin, I was having trouble understanding the vote menu handler, and sent it to wrecked. After i understood it, i rewrote the handler.

This doesn't make sense.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
karolek0901
Junior Member
Join Date: May 2010
Old 04-08-2011 , 22:48   Re: JailBreak VoteDayMenu
Reply With Quote #5

can you fix this for me
karolek0901 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-09-2011 , 00:50   Re: JailBreak VoteDayMenu
Reply With Quote #6

No, this is the one i'm selling
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
karolek0901
Junior Member
Join Date: May 2010
Old 04-09-2011 , 09:28   Re: JailBreak VoteDayMenu
Reply With Quote #7

so i must ask in different forum to help me
karolek0901 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-09-2011 , 14:08   Re: JailBreak VoteDayMenu
Reply With Quote #8

That piece of code isn't gonna help you, this is about 1/3 of the plugin + it's bugged.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
ErrorStereotype
Senior Member
Join Date: Feb 2011
Location: Bosnia and Herzegovina
Old 04-15-2011 , 19:24   Re: JailBreak VoteDayMenu
Reply With Quote #9

heheh drekes dont be sure its on the sm clan jailbreak
ErrorStereotype is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-15-2011 , 23:07   Re: JailBreak VoteDayMenu
Reply With Quote #10

That's not mine, maybe it looks alike.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 11:10.


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