AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] edit some bugs in vote rounds plugin (https://forums.alliedmods.net/showthread.php?t=189295)

samer 123 07-05-2012 14:08

[REQ] edit some bugs in vote rounds plugin
 
Hi..

i founded plugin that make vote for rounds limit but its have some bugs like:

the first who is vote like he is the only one from other players

and i need it with hud message in green color when he say %i rounds remening

and i need the rounds for vote are 6 , 9 , 11 , 13 , 15

and if you can make it in English language :D

thanks


PHP Code:

#include <amxmodx>

new g_vTwog_vThreeg_vFourg_vFiveg_vSix
new roundroundlimit;
new 
nextmap[50];

new 
boolvoted false;

new 
vox_sounds[][] = 
{
    
"one",
    
"two",
    
"three",
    
"four",
    
"five",
    
"six",
    
"seven",
    
"eight",
    
"nine",
    
"ten",
    
"eleven",
    
"twelve",
    
"thirteen",
    
"fourteen"
    
"fifteen",
    
"sixteen",
    
"seventeen",
    
"eighteen",
    
"nineteen",
    
"twenty",
    
"twentyfive",
    
"thirty",
    
"fourty",
    
"remaining",
    
"round"
}

public 
plugin_init() 
{
    
register_plugin("New Map Timelimit""0.1""[email protected]")

    
set_task(15.0"ShowTimeLimitMenu"12785)
    
    
register_logevent("Event_RoundStart"2"1=Round_Start");
    
    
register_clcmd("say timeleft""Cmd_TimeLeft"); 
}

public 
plugin_precache()
{
    new 
vox[33];
    
    for(new 
0sizeof(vox_sounds); i++)
    {
        
formatex(voxcharsmax(vox), "vox/%s.wav"vox_sounds[i]);
        
precache_sound(vox);
    }    
}

public 
Event_RoundStart()
{
    
/*new MapName[50];
    get_cvar_string("amx_nextmap", MapName, charsmax(MapName));*/
    
    
round++;
    
    if(
round == roundlimit)
    {
        
set_hudmessage(255255255, -1.00.0506.0240.00.10.13);
        
show_hudmessage(0"Rounds over, now switching to %s"nextmap);
        
        
set_task(10.0"changelevel");
        
        return 
PLUGIN_HANDLED;
    }
    
    if(
voted)
        
Cmd_TimeLeft()
    
    return 
PLUGIN_HANDLED;
}

public 
changelevel()
    
server_cmd("changelevel %s"nextmap);

public 
Cmd_TimeLeft()
{    
    if(
voted)
    {
        
client_print(0print_chat"Rounds remaining: %s rounds"roundlimit round);
        
Show_Rounds();
    }
}

public 
Show_Rounds()
{
    if(!
voted)
        return 
PLUGIN_HANDLED;
        
    switch(
roundlimit round)
    {
        case 
1client_cmd(0"spk ^"vox/one round remaining^"");
        case 
2client_cmd(0"spk ^"vox/two round remaining^"");
        case 
3client_cmd(0"spk ^"vox/three round remaining^"");
        case 
4client_cmd(0"spk ^"vox/four round remaining^"");
        case 
5client_cmd(0"spk ^"vox/five round remaining^"");
        case 
6client_cmd(0"spk ^"vox/six round remaining^"");
        case 
7client_cmd(0"spk ^"vox/seven round remaining^"");
        case 
8client_cmd(0"spk ^"vox/eight round remaining^"");
        case 
9client_cmd(0"spk ^"vox/nine round remaining^"");
        case 
10client_cmd(0"spk ^"vox/ten round remaining^"");
        case 
11client_cmd(0"spk ^"vox/eleven round remaining^"");
        case 
12client_cmd(0"spk ^"vox/twelve round remaining^"");
        case 
13client_cmd(0"spk ^"vox/thirteen round remaining^"");
        case 
14client_cmd(0"spk ^"vox/fourteen round remaining^"");
        case 
15client_cmd(0"spk ^"vox/fifteen round remaining^"");
        case 
16client_cmd(0"spk ^"vox/sixteen round remaining^"");
        case 
17client_cmd(0"spk ^"vox/seventeen round remaining^"");
        case 
18client_cmd(0"spk ^"vox/eighteen round remaining^"");
        case 
19client_cmd(0"spk ^"vox/nineteen round remaining^"");
        case 
20client_cmd(0"spk ^"vox/twenty round remaining^"");
        case 
21client_cmd(0"spk ^"vox/twenty one round remaining^"");
        case 
22client_cmd(0"spk ^"vox/twenty two round remaining^"");
        case 
23client_cmd(0"spk ^"vox/twenty three round remaining^"");
        case 
24client_cmd(0"spk ^"vox/twenty four round remaining^"");
        case 
25client_cmd(0"spk ^"vox/twentyfive round remaining^"");
        case 
26client_cmd(0"spk ^"vox/twenty six round remaining^"");
        case 
27client_cmd(0"spk ^"vox/twenty seven round remaining^"");
        case 
28client_cmd(0"spk ^"vox/twenty eight round remaining^"");
        case 
29client_cmd(0"spk ^"vox/twenty nine round remaining^"");
        case 
30client_cmd(0"spk ^"vox/thirty round remaining^"");
        case 
31client_cmd(0"spk ^"vox/thirty one round remaining^"");
        case 
32client_cmd(0"spk ^"vox/thirty two round remaining^"");
        case 
33client_cmd(0"spk ^"vox/thirty three round remaining^"");
        case 
34client_cmd(0"spk ^"vox/thirty four round remaining^"");
        case 
35client_cmd(0"spk ^"vox/thirty five round remaining^"");
        case 
36client_cmd(0"spk ^"vox/thirty six round remaining^"");
        case 
37client_cmd(0"spk ^"vox/thirty seven round remaining^"");
        case 
38client_cmd(0"spk ^"vox/thirty eight round remaining^"");
        case 
39client_cmd(0"spk ^"vox/thirty nine round remaining^"");
        case 
40client_cmd(0"spk ^"vox/fourty round remaining^"");
    
    }
    
    
get_cvar_string("amx_nextmap"nextmapcharsmax(nextmap));
    
    
set_hudmessage(255255255, -1.00.0506.0240.00.10.13);
    
show_hudmessage(0"%i rounds remaining^n Nextmap: %s"roundlimit roundnextmap);
    
    return 
PLUGIN_HANDLED;
}

public 
ShowTimeLimitMenu()
{
    new 
menu menu_create("Kolko minuti iskate da byde timelimita ?""menu_handler")
    new 
cmenu menu_makecallback("callback_menu")

    
menu_additem(menu"10 rounds""1"0cmenu)
    
menu_additem(menu"15 rounds""2"0cmenu)
    
menu_additem(menu"20 rounds""3"0cmenu)
    
menu_additem(menu"30 rounds""4"0cmenu)
    
menu_additem(menu"40 rounds""5"0cmenu)
        
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)

    new 
Players[32
    new 
playerCountiid 
    get_players
(PlayersplayerCount"c"

    for (
i=0i<playerCounti++) 
    {
        
id Players[i]

        
menu_display(idmenu0)
    }

    
set_task(15.0"VoteCount")

    return 
PLUGIN_HANDLED
}

public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}

    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)

    new 
key str_to_num(data)

    new 
name[32]
    
get_user_name(idname32)

    switch(
key
    {
        case 
1
        {
            
g_vTwo++;
            
client_print(0print_chat"[AMXX]* %s glasuva za 10 minuti prodyljenie"name);
        }
        case 
2
        {
            
g_vThree++;
            
client_print(0print_chat"[AMXX]* %s glasuva za 15 minuti prodyljenie"name);
        }
        case 
3
        {
            
g_vFour++;
            
client_print(0print_chat"[AMXX]* %s glasuva za 20 minuti prodyljenie"name);
        }
        case 
4
        {
            
g_vFive++;
            
client_print(0print_chat"[AMXX]* %s glasuva za 30 minuti prodyljenie"name);
        }
        case 
5
        {
            
g_vSix++;
            
client_print(0print_chat"[AMXX]* %s glasuva za 40 minuti prodyljenie"name);
        }
        default: { }
    }

    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
callback_menu(idmenuitem)
{
    new 
Data[4];
    new 
AccessCallback;
    
menu_item_getinfo(menuitemAccessDatasizeof Data 1__Callback)
    
    return 
PLUGIN_CONTINUE
}

public 
VoteCount()
{
    if( 
g_vTwo g_vThree 
        
roundlimit 10;
        
    else if(
g_vThree g_vFour
        
roundlimit 15;
      
    else if(
g_vFour g_vFive)
        
roundlimit 20;
        
    else if(
g_vFive g_vSix)
        
roundlimit 30;
        
    else if(
g_vFive g_vSix)
        
roundlimit 40;
    
    else
        switch(
random(5))
        {
            case 
1roundlimit 10;
            case 
2roundlimit 15;
            case 
3roundlimit 20;
            case 
4roundlimit 30;
            case 
5roundlimit 40;
        }
    
    
    
client_print(0print_chat"%i rounds will be played"roundlimit);
    
    
g_vTwo 0;
    
g_vThree 0;
    
g_vFour 0;
    
g_vFive 0;
    
g_vSix 0;
    
    
round 0;

    
voted true;
    
    return 
PLUGIN_HANDLED




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

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