Raised This Month: $ Target: $400
 0% 

[REQ] plugin Vote CT/TER


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-16-2020 , 10:26   [REQ] plugin Vote CT/TER
Reply With Quote #1

I wanted a plugin for team voting

One Sample:
PHP Code:
Vote CT or TER
1. Counter
-Terrorist (vote3)  <---- amx_swap
2. Terrorist 
(vote4)  <---- sv_restart 1 

Last edited by alferd; 02-16-2020 at 10:28.
alferd is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-17-2020 , 04:48   Re: [REQ] plugin Vote CT/TER
Reply With Quote #2

and when should this vote happen?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-17-2020 , 06:08   Re: [REQ] plugin Vote CT/TER
Reply With Quote #3

When (TER / CT) wins a round
alferd is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-17-2020 , 06:38   Re: [REQ] plugin Vote CT/TER
Reply With Quote #4

Untested.

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Vote Teams"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define TASKID 546138

new szTextMsg;
new 
iCtVote;
new 
iTerVote;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
szTextMsg get_user_msgid("TextMsg");
    
register_message(szTextMsg"msgTextMsg");
}

public 
client_disconnect(id)
{
    if(
task_exists(TASKID))
    {
        new 
iPlayers[32], iNum;
        
get_players(iPlayersiNum);
        
        if(
iNum == 0)
        {
            
remove_task(TASKID);
        }
    }
}
    

public 
msgTextMsg()
{
    if(!
task_exists(TASKID))
    {
        static 
szMsg[22];
        
get_msg_arg_string(2szMsgcharsmax(szMsg));
    
        if(
equal(szMsg"#Terrorists_Win"))
        {
            
StartVote();
        }
    
        else if(
equal(szMsg"#CTs_Win"))
        {
            
StartVote();
        }
    }
    else
    {
        
remove_task(TASKID);
    }
}

public 
StartVote()
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum);
    
    new 
menu menu_create("Vote CT or TER""HandleVote");
    
    
menu_additem(menu"Counter-Terrorist");
    
menu_additem(menu"Terrorist");
    
    for(new 
iiNumi++)
    {
        
menu_display(iPlayers[i], menu);
    }
    
set_task(15.0"EndVote"TASKID);
}

public 
HandleVote(idmenuitem)
{
    switch(
item)
    {
        case 
0iCtVote++;
        case 
1iTerVote++;
    }
    
menu_destroy(menu)
}

public 
EndVote()
{
    if(
iCtVote iTerVote)
    {
        
server_cmd("amx_swap");
    }
    
    else 
    {
        
server_cmd("sv_restart 1");
    }
    
client_print(0print_chat"CT votes: %i | TER Votes: %i"iCtVoteiTerVote);

__________________

Last edited by Napoleon_be; 02-17-2020 at 06:41.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 02-17-2020 , 08:11   Re: [REQ] plugin Vote CT/TER
Reply With Quote #5

Thankful
alferd is offline
Reply



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 16:21.


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