Raised This Month: $ Target: $400
 0% 

New map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LostSkill
Senior Member
Join Date: Jun 2008
Location: Monuhuelo Island
Old 11-16-2010 , 13:32   New map
Reply With Quote #1

How i could make vote when new map start's. After one minute players get vote : Do u whana HS mode? and if yes its turn on cvar aim_prac 1 if no then 0
__________________
MY ENGLISH IS BAD.....
LostSkill is offline
Send a message via MSN to LostSkill
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-16-2010 , 20:36   Re: New map
Reply With Quote #2

set a task in plugin_ini() to the function that puts up the vote. If the result is yes then set the cvar to 1 else 0.
__________________
fysiks is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 11-16-2010 , 21:21   Re: New map
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
set a task in plugin_ini() to the function that puts up the vote. If the result is yes then set the cvar to 1 else 0.
"LostSkill: can u please show example?"
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-16-2010 , 23:54   Re: New map
Reply With Quote #4

PHP Code:
public plugin_init()
{
    
// ...
    
set_task(60.0"start_vote_function")
}

public 
start_vote_function()
{
    
// start vote / show menu here.  See link.

http://forums.alliedmods.net/showthread.php?t=46364

If your "Yes" option wins use set_cvar_num("aim_prac", 1).

Quote:
Originally Posted by GXLZPGX View Post
"LostSkill: can u please show example?"
Where was this? Just curious.
__________________
fysiks is offline
LostSkill
Senior Member
Join Date: Jun 2008
Location: Monuhuelo Island
Old 11-17-2010 , 04:28   Re: New map
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <fun>

new gVoteMenu;
new 
gVotes[2];
new 
gVoting;

public 
plugin_init() 

    
register_plugin("Vote Hs mode","1.0","James Romeril")
    
register_concmd("aim_prac""aim_prac"ADMIN_LEVEL_A"aim_prac <on|off> or <1|0>")
    
set_task(60.0"hs_mode"


public 
aim_prac(id)
{
    if (
id && !((get_user_flags(id) & ADMIN_LEVEL_A)))
    {
        
client_print(idprint_console"[AMXX] You do not have access to this command")
        return 
PLUGIN_CONTINUE
    
}
    new 
arg[8]
    
read_argv(1arg7)

    if((
equali(arg"on"))||(equali(arg"1")))
    {
        
set_user_hitzones(,02)
        
client_print(idprint_console"[AMXX] ENABLED Headshot only mode")
        
client_print(0print_chat"[AMXX] ENABLED Headshot only mode")
    }
    else
    {
        
set_user_hitzones(00255)
        
client_print(idprint_console"[AMXX] DISABLED Headshot only mode")
        
client_print(0print_chat"[AMXX] DISABLED Headshot only mode")
    }
    return 
PLUGIN_HANDLED
}

public 
hs_mode(id

    
gVoteMenu menu_create("\rIjunkti HS moda?""menu_handler");

    
menu_additem(gVoteMenu"Taip""0"0);
    
menu_additem(gVoteMenu"Ne""1"0); 
    
    new 
players[32], pnumtempid;
    
    
get_players(playerspnum);
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i];

        
menu_display(tempidgVoteMenu0);

        
gVoting++;
    }

    
set_task(15.0"EndVote");

    return 
PLUGIN_HANDLED;


public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT || !gVoting )
    {
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
voteid str_to_num(data);

    
gVotes[voteid]++;

    return 
PLUGIN_HANDLED;
}

public 
EndVote()
{
    if( 
gVotes[0] > gVotes[1] )
    
client_print(0print_chat"Uz TAIP balsavo (%d) dabar bus ijunktas hs mode"gVotes[0] );
    
set_cvar_num("aim_prac"1)
    else if( 
gVotes[0] < gVotes[1] )
    
client_print(0print_chat"Uz NE balsavo (%d) todel HS mode nebus ijunktas"gVotes[1] );
    
set_cvar_num("aim_prac"0)
    else
    
client_print(0print_chat"Buvo lygiosios %d todel nebus ijunktas HS mode."gVotes[0] );
    
set_cvar_num("aim_prac"0);
    
    
menu_destroy(gVoteMenu);

    
gVoting 0;

After this:
PHP Code:
set_cvar_num("aim_prac"1
I lose identification on this line and compile fails :\
PHP Code:
else if( gVotes[0] < gVotes[1] ) 
__________________
MY ENGLISH IS BAD.....

Last edited by LostSkill; 11-17-2010 at 05:40.
LostSkill is offline
Send a message via MSN to LostSkill
ARES[ro]
Senior Member
Join Date: Apr 2010
Old 11-16-2010 , 23:56   Re: New map
Reply With Quote #6

Quote:
Originally Posted by GXLZPGX View Post
"LostSkill: can u please show example?"
Impersonator! Watch out trying steal your identity!
Nib,its not fooling me...
__________________
okay
ARES[ro] is offline
ARES[ro]
Senior Member
Join Date: Apr 2010
Old 11-17-2010 , 09:24   Re: New map
Reply With Quote #7

PHP Code:
if( gVotes[0] > gVotes[1] ) 
{
    
client_print(0print_chat"Uz TAIP balsavo (%d) dabar bus ijunktas hs mode"gVotes[0] ); 
    
set_cvar_num("aim_prac"1
}
else if( 
gVotes[0] < gVotes[1] ) 
{
    
client_print(0print_chat"Uz NE balsavo (%d) todel HS mode nebus ijunktas"gVotes[1] ); 
    
set_cvar_num("aim_prac"0
}
else 
{
    
client_print(0print_chat"Buvo lygiosios %d todel nebus ijunktas HS mode."gVotes[0] ); 
    
set_cvar_num("aim_prac"0);

NOTE: When theres more then one instructions use brackets... Without brackets it will only take in count the first line.In your case it failed to compile.
__________________
okay
ARES[ro] 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 11:25.


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