Raised This Month: $ Target: $400
 0% 

[help] votemaps


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-12-2014 , 19:36   Re: [help] votemaps
Reply With Quote #3

Not tested ._. I hope it helps you

PHP Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

#define MAX_MAPS 3

new bool:Voted33 ];
new 
g_szRoundVotemapTimer
new g_szKind[MAX_MAPS]
new 
g_maps[MAX_MAPS][30]
new 
rounds

new const Change[][] =
{
    
"jb_funny_live",
    
"jail_crewkule",
    
"jb_flyhigh",
    
"jail_pyramid",
    
"jail_crewkule2",
    
"jail_aj_bananamuffin_nd",
    
"jail_rehab_b2",
    
"jail_xmf",
    
"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" )
    
rounds register_cvar("amx_roundstovote""3")
}


public 
NewRound()
{
    
g_szRoundVotemap++;
    
ColorChat0"there will be votemap in: %i Rounds"g_szRoundVotemap);
    
    if(
g_szRoundVotemap >= get_pcvar_num(rounds))
        
set_task1.0"ActionSpecial" );
}

public 
ActionSpecial()
{
    for( new 
0<= MAX_MAPSi++ ) //select X maps
    
{
        
g_szKind[i] = 0
        format
(g_maps[i], 29"%s"Change[random_num(0sizeof(Change))])
    }
    
    for( new 
1<= get_maxplayers(); i++ ) //show menu
    
{
        if(
is_user_connected(i))
        {
            
Voted[i] = false;
            
ChangeMaps(i)
        }
    }
    
    
Timer 17
    
    client_cmd
(0"spk ^"get red(e80ninety(s45to check(e20) use bay(s18mass(e42cap(s50)^"")  
    
set_task17.0"checkvotesd",1700 );  
    
countdown2();
}

public 
ChangeMaps(client)
{
    static 
szMap[128];               
    new 
st];
    
formatex(szMapcharsmax(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");

    for( new 
0MAX_MAPSk++ ) // show selected maps + votes
    
{
        
num_to_strkst);
        
formatexszMapcharsmaxszMap ), "\w%s \d[\y%i Votes\d]"g_maps[k] , g_szKind[k]);
        
menu_additemmenuszMapst );
    }

    
menu_setpropmenuMPROP_EXITMEXIT_NEVER );
    
menu_display(client,menu);
}

public 
checkvotesd()
{      
    new 
Winner 0;
    for( new 
1sizeof g_mapsi++ ) // select maps with more votes
    
{
        if( 
g_szKindWinner ] < g_szKind] )
            
Winner i;
    }

    
ColorChat0"%s ^4won ^1the vote with ^3%i ^1"g_mapsWinner ], g_szKindWinner ] );
    new 
map[30]
    
format(map29"%s"g_maps[Winner])
    
set_task(5.0"changemap_"_map30// change map in 5 seconds from vote end
}

public 
changemap_(param[])
    
server_cmd("changelevel %s"param)

public 
handlerddddclientmenuitem )
{
    if( 
Votedclient ] == true )
    {
        
ChangeMapsclient);
        return
    }
    
    new 
szName32 ];
    
get_user_nameclientszName32 );

    
ColorChat0"^3%s^1 has^4 voted ^1for^4 %s"szNameg_mapsitem ] )
    
g_szKinditem ]++;
    
    
Votedclient ] = true;
    
ChangeMaps(client);
    return
}

public 
countdown2()
{
    if(
Timer <= 0)
        
remove_task(2000)
    else
    {
        
Timer--
        
set_task(1.0,"countdown2");
        for( new 
1<= get_maxplayers(); i++ )
            if(
is_user_connected) )
                
ChangeMaps(i)
    }
}

stock ColorChat(const id, const string[], {FloatSqlResul,_}:...)
{
    new 
msg[191], players[32], count 1
    
static len
    len 
formatex(msgcharsmax(msg), "^1[^3 AMXX^1] ")
    
vformat(msg[len], charsmax(msg) - lenstring3)
    if(
id)    players[0] = id
    
else    get_players(players,count,"ch")
    
    for (new 
0counti++)
    {
        if(
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"),_players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }
    return

NikKOo31 is offline
 



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 05:55.


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