Thread: CSDM spawn vote
View Single Post
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 09-23-2009 , 15:10   Re: CSDM spawn vote
Reply With Quote #2

PHP Code:
public plugin_init
{
    
register_menucmd(register_menuid("VoteMenu"), 1023"CountVotes")
}
new 
ga_Choice[3]
new 
bool:voting false


public client_putinserver(id)
{

    new 
g_iPlayers[32]
    new 
g_iNum;
    
get_players(g_iPlayersg_iNum"ch");
    
    if(
g_iNum >= && !voting)
    {
        
InitVote()
    }
}

public 
InitVote()
{
    
voting true
    
static menuBody[512]
    
format(menuBody,511,"\rRandom Spawn?^n1. Yes^n2. No");
    
ga_Choice[1] = 0
    ga_Choice
[2] = 0
    show_menu
0, (1<<1)|(1<<2), menuBody14"VoteMenu" )
    
set_task(15.0,"showResult");
}

public 
CountVotes(key)
{
    ++
ga_Choice[key]
}

public 
showResult()
{
    new 
TotalVotes ga_Choice[1] + ga_Choice[2]
    new 
Float:result = (float(ga_Choice[1]) / float(TotalVotes))
    if( 
result >= 5.0)
    {
        
//trun on
    
}
    else
    {
        
//turn off
    
}

__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!

Last edited by biscuit628; 09-23-2009 at 15:25.
biscuit628 is offline