Raised This Month: $51 Target: $400
 12% 

Knife round vote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
niiii
Member
Join Date: Sep 2013
Old 11-02-2013 , 13:42   Knife round vote
Reply With Quote #1

Hi, i have installed this plugin on my server which allows vip players to use command /voteknife that starts knife round if players voted for. Id like to modify this plugin that you can you /voteknife command only 1 per map... thanks

Code:
/****************************************************************************** 
 *  
 *                     Knife Mod Vote 
 *                                 - Shooting King 
 *  
 *             Cvars: 
 *                     - amx_sk_kvote_rounds - After how many rounds can the voting be started. Default: 10 
 *  
 *             Cmds: 
 *                     - say /voteknife - Start Vote. 
 *  
 * ***************************************************************************/ 
  
#include <amxmodx> 

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

#define VOTE_LEVEL    ADMIN_LEVEL_H

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

new pcvar_rounds; 

new bool:bKnifeRound = false; 
new bool:bKnifeOnly = false; 

public plugin_init() 
{ 
    register_plugin( PLUGIN, VERSION, AUTHOR ); 
     
    register_clcmd( "say /voteknife", "StartVote" ); 
    register_event( "HLTV", "Event_NewRound", "a", "1=0", "2=0" ); 
    register_event( "CurWeapon", "Event_Weapon", "be", "1=1" ); 
     
    pcvar_rounds = register_cvar( "amx_sk_kvote_rounds", "10" ); 
} 

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; 
    g_VoteRounds--; 
     
    if( bKnifeRound ) 
    { 
        bKnifeOnly = true; 
        bKnifeRound = false; 
    } 
} 

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

public StartVote( id ) 
{ 
    if( !(get_user_flags(id) & VOTE_LEVEL) ) 
    { 
        client_print( id, print_chat, "Musis byt VIP." ); 
        return PLUGIN_HANDLED; 
    } 
     
    if( g_Voting ) 
    { 
        client_print( id, print_chat, "Hlasovanie prave prebieha." ); 
        return PLUGIN_HANDLED; 
    } 
         
    if( g_VoteRounds > 0 ) 
    { 
        client_print( id, print_chat, "Musis pockat %d kolo.", g_VoteRounds ); 
        return PLUGIN_HANDLED; 
    } 
     
    g_VoteRounds = get_pcvar_num( pcvar_rounds );     
         
    new szPlayers[32], szName[32], iNum, iPlayer; 
    get_user_name( id, szName, charsmax(szName)); 
    client_print( 0, print_chat, "%s spustil hlasovanie.", szName ); 
     
    g_Votes[0] = g_Votes[1] = 0; 
    g_VoteMenu = menu_create( "\rChcete dalsie kolo na noze?", "menu_handler" ); 
     
    menu_additem( g_VoteMenu, "Ano", "", 0 ); 
    menu_additem( g_VoteMenu, "Nie", "", 0 ); 
     
    get_players( szPlayers, iNum ); 

    for( new i; i < iNum; i++ ) 
    { 
        iPlayer = szPlayers[i]; 
        menu_display( iPlayer, g_VoteMenu, 0 ); 
        g_Voting++; 
    } 

    set_task(10.0, "EndVote" ); 
    g_VoteTimes--; 
    return PLUGIN_HANDLED; 
} 
  
public menu_handler( id, menu, item ) 
{ 
    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(0, print_chat, "Dalsie kolo bude na noze." ); 
        bKnifeRound = true;  
    }         
    else  
    { 
        client_print(0, print_chat, "Hlasovanie neuspesne." ); 
    } 

    menu_destroy( g_VoteMenu ); 
    for( new i; i < 33; i++ ) 
    { 
        g_Voted[i][0] = 0; 
        g_Voted[i][1] = 0; 
    } 
    g_Voting = 0; 
} 

stock FixAmmoHud(id) 
{ 
    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), { 0, 0, 0 }, id);  
    write_byte(1); 
    write_byte(29); 
    write_byte(-1); 
    message_end(); 
}

Last edited by niiii; 11-02-2013 at 13:43.
niiii is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 11-02-2013 , 17:26   Re: Knife round vote
Reply With Quote #2

this section is not for requesting.
akcaliberg is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 11-03-2013 , 02:48   Re: Knife round vote
Reply With Quote #3

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:27   Re: Knife round vote
Reply With Quote #4

Quote:
Originally Posted by akcaliberg View Post
this section is not for requesting.
Im looking for a help... even this forums name is Scripting help...
niiii is offline
niiii
Member
Join Date: Sep 2013
Old 11-03-2013 , 06:29   Re: Knife round vote
Reply With Quote #5

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
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-04-2013 , 08:51   Re: Knife round vote
Reply With Quote #6

Quote:
Originally Posted by niiii View Post
Im looking for a help... even this forums name is Scripting help...
This section is for people who have tried it themselves but are having problems.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 10:20.


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