Raised This Month: $ Target: $400
 0% 

Knife round vote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 11-03-2013 , 02:48   Re: Knife round vote
Reply With Quote #1

PHP Code:
/******************************************************************************
 * 
 *                     Knife Mod Vote
 *                                 - Shooting King
 *  
 *             Cmds:
 *                     - say /voteknife - Start Vote.
 * 
 * ***************************************************************************/
 
#include <amxmodx>

#define PLUGIN        "Knife Mod Vote"
#define VERSION        "1.2"
#define AUTHOR        "Shooting King"

#define VOTE_LEVEL    ADMIN_LEVEL_H

new g_VoteMenu;
new 
g_Voting;
new 
g_Votes[2];
new 
g_Voted[33][2];

new 
bool:g_VotedForMap;
new 
bool:bKnifeRound false;
new 
bool:bKnifeOnly false;

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd"say /voteknife""StartVote" );
    
register_event"HLTV""Event_NewRound""a""1=0""2=0" );
    
register_event"CurWeapon""Event_Weapon""be""1=1" );
}

public 
client_disconnect(id)
{
    if( 
g_Voted[id][0] )
    {
        
g_Votes[g_Voted[id][1]]--; // Do not count his Vote.
    
}
}

public 
Event_NewRound()
{
    
bKnifeOnly false;
    
    if( 
bKnifeRound )
    {
        
bKnifeOnly true;
        
bKnifeRound false;
    }
}

public 
Event_Weapon(id)
{
    if( 
bKnifeOnly && (read_data(2) != CSW_KNIFE))
    {
        
engclient_cmdid"weapon_knife" );
        
//if(!is_user_bot(id))
        
FixAmmoHud(id);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
StartVoteid )
{
    if( !(
get_user_flags(id) & VOTE_LEVEL) )
    {
        
client_printidprint_chat"You dont have access to this command." );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
g_Voting )
    {
        
client_printidprint_chat"Voting is already going on." );
        return 
PLUGIN_HANDLED;
    }
        
    if( 
g_VotedForMap )
    {
        
client_printidprint_chat"Voting for this Map is Done." );
        return 
PLUGIN_HANDLED;
    }
    
    
g_VotedForMap true;
        
    new 
szPlayers[32], szName[32], iNumiPlayer;
    
get_user_nameidszNamecharsmax(szName));
    
client_print0print_chat"%s started the vote."szName );
    
    
g_Votes[0] = g_Votes[1] = 0;
    
g_VoteMenu menu_create"\rKnife Round ?? :""menu_handler" );
    
    
menu_additemg_VoteMenu"Yes""");
    
menu_additemg_VoteMenu"No""");
    
    
get_playersszPlayersiNum );

    for( new 
iiNumi++ )
    {
        
iPlayer szPlayers[i];
        
menu_displayiPlayerg_VoteMenu);
        
g_Voting++;
    }

    
set_task(10.0"EndVote" );
    return 
PLUGIN_HANDLED;
}
 
public 
menu_handleridmenuitem )
{
    if( 
item == MENU_EXIT || !g_Voting )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
g_Voted[id][0] = 1;
    
g_Voted[id][1] = item;
    
g_Votes[item]++;
    return 
PLUGIN_HANDLED;
}

public 
EndVote()
{    
    if( 
g_Votes[0] > g_Votes[1] )
    {
        
client_print(0print_chat"Next Round will be a Knife Round." );
        
bKnifeRound true
    }        
    else 
    {
        
client_print(0print_chat"Voting Failed." );
    }

    
menu_destroyg_VoteMenu );
    for( new 
i33i++ )
    {
        
g_Voted[i][0] = 0;
        
g_Voted[i][1] = 0;
    }
    
g_Voting 0;
}

stock FixAmmoHud(id)
{
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("CurWeapon"), { 00}, id); 
    
write_byte(1);
    
write_byte(29);
    
write_byte(-1);
    
message_end();

Translate it if you want. I am poor in Slovak.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 11-03-2013 at 02:49.
Shooting King is offline
niiii
Member
Join Date: Sep 2013
Old 11-03-2013 , 06:29   Re: Knife round vote
Reply With Quote #2

Quote:
Originally Posted by Shooting King View Post
PHP Code:
/******************************************************************************
 * 
 *                     Knife Mod Vote
 *                                 - Shooting King
 *  
 *             Cmds:
 *                     - say /voteknife - Start Vote.
 * 
 * ***************************************************************************/
 
#include <amxmodx>

#define PLUGIN        "Knife Mod Vote"
#define VERSION        "1.2"
#define AUTHOR        "Shooting King"

#define VOTE_LEVEL    ADMIN_LEVEL_H

new g_VoteMenu;
new 
g_Voting;
new 
g_Votes[2];
new 
g_Voted[33][2];

new 
bool:g_VotedForMap;
new 
bool:bKnifeRound false;
new 
bool:bKnifeOnly false;

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd"say /voteknife""StartVote" );
    
register_event"HLTV""Event_NewRound""a""1=0""2=0" );
    
register_event"CurWeapon""Event_Weapon""be""1=1" );
}

public 
client_disconnect(id)
{
    if( 
g_Voted[id][0] )
    {
        
g_Votes[g_Voted[id][1]]--; // Do not count his Vote.
    
}
}

public 
Event_NewRound()
{
    
bKnifeOnly false;
    
    if( 
bKnifeRound )
    {
        
bKnifeOnly true;
        
bKnifeRound false;
    }
}

public 
Event_Weapon(id)
{
    if( 
bKnifeOnly && (read_data(2) != CSW_KNIFE))
    {
        
engclient_cmdid"weapon_knife" );
        
//if(!is_user_bot(id))
        
FixAmmoHud(id);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
StartVoteid )
{
    if( !(
get_user_flags(id) & VOTE_LEVEL) )
    {
        
client_printidprint_chat"You dont have access to this command." );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
g_Voting )
    {
        
client_printidprint_chat"Voting is already going on." );
        return 
PLUGIN_HANDLED;
    }
        
    if( 
g_VotedForMap )
    {
        
client_printidprint_chat"Voting for this Map is Done." );
        return 
PLUGIN_HANDLED;
    }
    
    
g_VotedForMap true;
        
    new 
szPlayers[32], szName[32], iNumiPlayer;
    
get_user_nameidszNamecharsmax(szName));
    
client_print0print_chat"%s started the vote."szName );
    
    
g_Votes[0] = g_Votes[1] = 0;
    
g_VoteMenu menu_create"\rKnife Round ?? :""menu_handler" );
    
    
menu_additemg_VoteMenu"Yes""");
    
menu_additemg_VoteMenu"No""");
    
    
get_playersszPlayersiNum );

    for( new 
iiNumi++ )
    {
        
iPlayer szPlayers[i];
        
menu_displayiPlayerg_VoteMenu);
        
g_Voting++;
    }

    
set_task(10.0"EndVote" );
    return 
PLUGIN_HANDLED;
}
 
public 
menu_handleridmenuitem )
{
    if( 
item == MENU_EXIT || !g_Voting )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
g_Voted[id][0] = 1;
    
g_Voted[id][1] = item;
    
g_Votes[item]++;
    return 
PLUGIN_HANDLED;
}

public 
EndVote()
{    
    if( 
g_Votes[0] > g_Votes[1] )
    {
        
client_print(0print_chat"Next Round will be a Knife Round." );
        
bKnifeRound true
    }        
    else 
    {
        
client_print(0print_chat"Voting Failed." );
    }

    
menu_destroyg_VoteMenu );
    for( new 
i33i++ )
    {
        
g_Voted[i][0] = 0;
        
g_Voted[i][1] = 0;
    }
    
g_Voting 0;
}

stock FixAmmoHud(id)
{
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("CurWeapon"), { 00}, id); 
    
write_byte(1);
    
write_byte(29);
    
write_byte(-1);
    
message_end();

Translate it if you want. I am poor in Slovak.
thank you, all of those people should be like you
niiii 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 23:21.


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