| 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_vTwo, g_vThree, g_vFour, g_vFive, g_vSix
new round, roundlimit;
new nextmap[50];
new bool: voted = 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 i = 0; i < sizeof(vox_sounds); i++)
{
formatex(vox, charsmax(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(255, 255, 255, -1.0, 0.05, 0, 6.0, 240.0, 0.1, 0.1, 3);
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(0, print_chat, "Rounds remaining: %s rounds", roundlimit - round);
Show_Rounds();
}
}
public Show_Rounds()
{
if(!voted)
return PLUGIN_HANDLED;
switch(roundlimit - round)
{
case 1: client_cmd(0, "spk ^"vox/one round remaining^"");
case 2: client_cmd(0, "spk ^"vox/two round remaining^"");
case 3: client_cmd(0, "spk ^"vox/three round remaining^"");
case 4: client_cmd(0, "spk ^"vox/four round remaining^"");
case 5: client_cmd(0, "spk ^"vox/five round remaining^"");
case 6: client_cmd(0, "spk ^"vox/six round remaining^"");
case 7: client_cmd(0, "spk ^"vox/seven round remaining^"");
case 8: client_cmd(0, "spk ^"vox/eight round remaining^"");
case 9: client_cmd(0, "spk ^"vox/nine round remaining^"");
case 10: client_cmd(0, "spk ^"vox/ten round remaining^"");
case 11: client_cmd(0, "spk ^"vox/eleven round remaining^"");
case 12: client_cmd(0, "spk ^"vox/twelve round remaining^"");
case 13: client_cmd(0, "spk ^"vox/thirteen round remaining^"");
case 14: client_cmd(0, "spk ^"vox/fourteen round remaining^"");
case 15: client_cmd(0, "spk ^"vox/fifteen round remaining^"");
case 16: client_cmd(0, "spk ^"vox/sixteen round remaining^"");
case 17: client_cmd(0, "spk ^"vox/seventeen round remaining^"");
case 18: client_cmd(0, "spk ^"vox/eighteen round remaining^"");
case 19: client_cmd(0, "spk ^"vox/nineteen round remaining^"");
case 20: client_cmd(0, "spk ^"vox/twenty round remaining^"");
case 21: client_cmd(0, "spk ^"vox/twenty one round remaining^"");
case 22: client_cmd(0, "spk ^"vox/twenty two round remaining^"");
case 23: client_cmd(0, "spk ^"vox/twenty three round remaining^"");
case 24: client_cmd(0, "spk ^"vox/twenty four round remaining^"");
case 25: client_cmd(0, "spk ^"vox/twentyfive round remaining^"");
case 26: client_cmd(0, "spk ^"vox/twenty six round remaining^"");
case 27: client_cmd(0, "spk ^"vox/twenty seven round remaining^"");
case 28: client_cmd(0, "spk ^"vox/twenty eight round remaining^"");
case 29: client_cmd(0, "spk ^"vox/twenty nine round remaining^"");
case 30: client_cmd(0, "spk ^"vox/thirty round remaining^"");
case 31: client_cmd(0, "spk ^"vox/thirty one round remaining^"");
case 32: client_cmd(0, "spk ^"vox/thirty two round remaining^"");
case 33: client_cmd(0, "spk ^"vox/thirty three round remaining^"");
case 34: client_cmd(0, "spk ^"vox/thirty four round remaining^"");
case 35: client_cmd(0, "spk ^"vox/thirty five round remaining^"");
case 36: client_cmd(0, "spk ^"vox/thirty six round remaining^"");
case 37: client_cmd(0, "spk ^"vox/thirty seven round remaining^"");
case 38: client_cmd(0, "spk ^"vox/thirty eight round remaining^"");
case 39: client_cmd(0, "spk ^"vox/thirty nine round remaining^"");
case 40: client_cmd(0, "spk ^"vox/fourty round remaining^"");
}
get_cvar_string("amx_nextmap", nextmap, charsmax(nextmap));
set_hudmessage(255, 255, 255, -1.0, 0.05, 0, 6.0, 240.0, 0.1, 0.1, 3);
show_hudmessage(0, "%i rounds remaining^n Nextmap: %s", roundlimit - round, nextmap);
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", 0, cmenu)
menu_additem(menu, "15 rounds", "2", 0, cmenu)
menu_additem(menu, "20 rounds", "3", 0, cmenu)
menu_additem(menu, "30 rounds", "4", 0, cmenu)
menu_additem(menu, "40 rounds", "5", 0, cmenu)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
new Players[32]
new playerCount, i, id
get_players(Players, playerCount, "c")
for (i=0; i<playerCount; i++)
{
id = Players[i]
menu_display(id, menu, 0)
}
set_task(15.0, "VoteCount")
return PLUGIN_HANDLED
}
public menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
new name[32]
get_user_name(id, name, 32)
switch(key)
{
case 1:
{
g_vTwo++;
client_print(0, print_chat, "[AMXX]* %s glasuva za 10 minuti prodyljenie", name);
}
case 2:
{
g_vThree++;
client_print(0, print_chat, "[AMXX]* %s glasuva za 15 minuti prodyljenie", name);
}
case 3:
{
g_vFour++;
client_print(0, print_chat, "[AMXX]* %s glasuva za 20 minuti prodyljenie", name);
}
case 4:
{
g_vFive++;
client_print(0, print_chat, "[AMXX]* %s glasuva za 30 minuti prodyljenie", name);
}
case 5:
{
g_vSix++;
client_print(0, print_chat, "[AMXX]* %s glasuva za 40 minuti prodyljenie", name);
}
default: { }
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public callback_menu(id, menu, item)
{
new Data[4];
new Access, Callback;
menu_item_getinfo(menu, item, Access, Data, sizeof 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 1: roundlimit = 10;
case 2: roundlimit = 15;
case 3: roundlimit = 20;
case 4: roundlimit = 30;
case 5: roundlimit = 40;
}
client_print(0, print_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
}
|