PHP Code:
public autovote_start()
{
// vote in progress
if(autovotes[0] || autovotes[1] || autovotes[2] || task_exists(TASK_AUTOVOTE_RESULT)) return 0;
// if autovote_mode < 0, we haven't actually checked it yet
if(autovote_mode < 0)
{
new info[6];
get_localinfo("gg_av_iter",info,5);
new iter = str_to_num(info);
new rotation[32];
get_pcvar_string(gg_autovote_mode,rotation,31);
new amount = str_count(rotation,',')+1;
if(iter <= 0 || iter > amount)
{
iter = 1;
set_localinfo("gg_av_iter","1");
}
// no rotation, just use the given value
if(amount <= 1)
{
if(iter != 1) set_localinfo("gg_av_iter","1");
autovote_mode = str_to_num(rotation);
}
else
{
for(new i=1;i<=amount;i++)
{
if(contain(rotation,",") != -1)
{
strtok(rotation,info,5,rotation,31,',');
if(i == iter) // this is the one we're looking for
{
autovote_mode = str_to_num(info);
break;
}
}
else // we've stripped away everything else and are left with the last one, so use it
{
autovote_mode = str_to_num(rotation);
break;
}
}
iter++;
if(iter > amount) iter = 1;
num_to_str(iter,info,5);
set_localinfo("gg_av_iter",info);
}
}
// turns out it's disabled
if(autovote_mode < 0) return 0;
new Float:autovote_time = get_pcvar_float(gg_autovote_time);
new i;
for(i=1;i<=maxPlayers;i++)
{
if(!is_user_connected(i)) continue;
switch(autovote_mode)
{
case 1:
{
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES",i,"NO",i,"CANCEL");
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
}
case 2:
{
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES_TEAMPLAY",i,"YES_REGULAR",i,"CANCEL");
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
}
default:
{
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n3. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES_TEAMPLAY",i,"YES_REGULAR",i,"NO",i,"CANCEL");
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
}
}
}
gungame_print(0,0,1,"%L",LANG_PLAYER_C,"VOTING_STARTED");
set_task(autovote_time,"autovote_result",TASK_AUTOVOTE_RESULT);
return 1;
}