[help] votemaps
It will be built on the server time [mod]
timeleft.amxx?
And how can I do: new const Change
To 1?
Without 3 new const = all maps in new const 1 and shares will randomly
At the end votemap it sets the nextmap server and deliver the next Round.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx > #include < cstrike > #include < hamsandwich >
new bool:Voted[ 33 ];
new g_szRoundVotemap;
new g_szKind[ 4 ], Timer, EndVote = 0;
new const Change[][] = { "jb_funny_live", "jail_crewkule", "jb_flyhigh", "jail_pyramid" } new const Change2[][] = { "jail_crewkule2", "jail_aj_bananamuffin_nd", "jail_rehab_b2", "jail_xmf" } new const Change3[][] = { "jail_armageddon", "jail_renner_b6", "jail_rats" } public plugin_init() { register_plugin("Simple VoteMap", "1.0", "AMXX")
register_event( "HLTV", "NewRound", "a", "1=0", "2=0" ) }
public NewRound() { g_szRoundVotemap++;
ColorChat( 0, "there will be votemap in: %i Rounds", 3 - g_szRoundVotemap);
if(g_szRoundVotemap == 3) set_task( 1.0, "ActionSpecial" ); } public ActionSpecial() {
for( new i = 1; i <= get_maxplayers(); i++ ){
Voted[ i ] = false; show_menu( i, 0, "^n", 1 ); }
g_szKind[ 0 ] = 0 g_szKind[ 1 ] = 0 g_szKind[ 2 ] = 0 g_szKind[ 3 ] = 0 switch(random_num(0,3) ){
case 0:EndVote = 1 case 1:EndVote = 2 case 2:EndVote = 3 case 3:EndVote = 4 }
for( new i, j = get_maxplayers(); i <= j; i++ ){
if( !is_user_alive( i ) || !is_user_connected( i ) ) continue;
Timer = 17 ChangeMaps(i) }
client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"") set_task( 17.0, "checkvotesd",1700 ); countdown2();
return 1; }
public ChangeMaps(client) {
static szMap[128]; new st[ 3 ]; formatex(szMap, charsmax(szMap), "\r[AMXX]\w Choose Map:^n\r// \wStatus: %s^n\r// \wTime to choose: \y%i",Voted[client] ? "\yVoted" : "\rNot Voted", Timer); new menu = menu_create(szMap, "handlerdddd"); switch(EndVote) { case 1: { for( new k; k < sizeof Change; k++ ) { num_to_str( k, st, 2 ); formatex( szMap, charsmax( szMap ), "\w%s \d[\y%i Votes\d]", Change[ k ], g_szKind[ k ]); menu_additem( menu, szMap, st ); } } case 2: { for( new k; k < sizeof Change2; k++ ) { num_to_str( k, st, 2 ); formatex( szMap, charsmax( szMap ), "\w%s \d[\y%i Votes\d]", Change2[ k ], g_szKind[ k ]); menu_additem( menu, szMap,st ); } } case 3: { for( new k; k < sizeof Change3; k++ ) { num_to_str( k, st, 3 ); formatex( szMap, charsmax( szMap ), "\w%s \d[\y%i Votes\d]", Change3[ k ], g_szKind[ k ]); menu_additem( menu, szMap,st ); }
}
} menu_setprop( menu, MPROP_EXIT, MEXIT_NEVER ); menu_display(client,menu);
}
public checkvotesd() { new Winner = 0; switch(EndVote) { case 1: { for( new i = 0; i < sizeof Change; i++ ) { if( g_szKind[ Winner ] < g_szKind[ i ] ) { Winner = i; } } } case 2: { for( new i = 0; i < sizeof Change2; i++ ) { if( g_szKind[ Winner ] < g_szKind[ i ] ) { Winner = i; } } } case 3: { for( new i = 0; i < sizeof Change3; i++ ) { if( g_szKind[ Winner ] < g_szKind[ i ] ) { Winner = i; } } }
} for( new i = 1; i <= get_maxplayers(); i++ ) { Voted[ i ] = false; show_menu( i, 0, "^n", 1 ); } switch(EndVote) { case 1: { ColorChat( 0, "%s ^4won ^1the vote with ^3%i ^1", Change[ Winner ], g_szKind[ Winner ] ); for( new i = 0; i < sizeof Change; i++ ) { g_szKind[ i ] = 0 } } case 2: { ColorChat( 0, "%s ^3won ^1the vote with ^3%i ^1", Change2[ Winner ], g_szKind[ Winner ] ); for( new i = 0; i < sizeof Change2; i++ ) { g_szKind[ i ] = 0 } } case 3: { ColorChat( 0, "%s ^3won ^1the vote with ^3%i ^1", Change3[ Winner ], g_szKind[ Winner ] ); for( new i = 0; i < sizeof Change3; i++ ) { g_szKind[ i ] = 0 }
} } }
public handlerdddd( client, menu, item ) { if( Voted[ client ] == true ) { ChangeMaps( client);
return 1; }
new szName[ 32 ];
get_user_name( client, szName, 32 ); switch(EndVote) { case 1: { ColorChat( 0, "^3%s^1 has^4 voted ^1for^4 %s", szName, Change[ item ] )
} case 2: { ColorChat( 0, "^3%s^1 has^4 voted ^1for^4 %s", szName, Change2[ item ] ) } } g_szKind[ item ]++;
Voted[ client ] = true;
ChangeMaps(client);
return 1; }
public countdown2() { if(Timer <= 0) { remove_task(2000) } else { Timer-- set_task(1.0,"countdown2"); for( new i = 1; i <= get_maxplayers(); i++ ) { if( !is_user_alive( i ) || !is_user_connected( i ) ) continue; show_menu( i, 0, "^n", 1 ); ChangeMaps(i) }
} return PLUGIN_HANDLED }
stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) { new msg[191], players[32], count = 1
static len len = formatex(msg, charsmax(msg), "^1[^3 AMXX^1] ") vformat(msg[len], charsmax(msg) - len, string, 3)
if(id) players[0] = id else get_players(players,count,"ch")
for (new i = 0; i < count; i++) { if(is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]) write_byte(players[i]) write_string(msg) message_end() } }
return 1; }
|