Raised This Month: $ Target: $400
 0% 

set_task???


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
16bit
Junior Member
Join Date: May 2016
Old 06-22-2016 , 11:07   set_task???
Reply With Quote #1

Guys, i have simple plugin- this plugin open special menu of server.
How make- if you die or you in spectrators- then open menu avtomaticaly one on the time, or you die and at this moment opened menu

It's my try, but it's when player alive- opened menu when raund has start

PHP Code:
public round_start(id)
        {
        
set_task(8.0"func_menu"id)
        } 
Pleaase guy's tell me advice=))
Thanks a lot for u attention)
16bit is offline
16bit
Junior Member
Join Date: May 2016
Old 06-22-2016 , 11:34   Re: set_task???
Reply With Quote #2

Quote:
Originally Posted by 16bit View Post
Guys, i have simple plugin- this plugin open special menu of server.
How make- if you die or you in spectrators- then open menu avtomaticaly one on the time, or you die and at this moment opened menu

It's my try, but it's when player alive- opened menu when raund has start

PHP Code:
public round_start(id)
        {
        
set_task(8.0"func_menu"id)
        } 
Pleaase guy's tell me advice=))
Thanks a lot for u attention)

I know about public client_death , but he don't make open enother function, except killer, victim, wpnindex, hitplace, TK
16bit is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 06-22-2016 , 12:37   Re: set_task???
Reply With Quote #3

your method is wrong
check players is not alive using get_players and (looping through all players then assign ID)
then open menu i think this what you want

PHP Code:
in the plugin_init()
register_logevent"round_start"2"1=Round_Start" );

public 
round_start() 

    new 
Players32 ], iNumid;
     
get_playersPlayersiNum"bh" ); // flag b: dont collect alive players flag h- skip hltv 
    
    
while( --iNum >= )
    {
        
id Players[iNum];
        
set_task(8.0"func_menu"id
     }  

__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
16bit
Junior Member
Join Date: May 2016
Old 06-22-2016 , 12:48   Re: set_task???
Reply With Quote #4

Quote:
Originally Posted by indraraj striker View Post
your method is wrong
check players is not alive using get_players and (looping through all players then assign ID)
then open menu i think this what you want

PHP Code:
in the plugin_init()
register_logevent"round_start"2"1=Round_Start" );

public 
round_start() 

    new 
Players32 ], iNumid;
     
get_playersPlayersiNum"bh" ); // flag b: dont collect alive players flag h- skip hltv 
    
    
while( --iNum >= )
    {
        
id Players[iNum];
        
set_task(8.0"func_menu"id
     }  


TTTHhaaaaaankkkkkkks man))
You awesome)
16bit is offline
16bit
Junior Member
Join Date: May 2016
Old 06-22-2016 , 13:01   Re: set_task???
Reply With Quote #5

Quote:
Originally Posted by indraraj striker View Post
your method is wrong
check players is not alive using get_players and (looping through all players then assign ID)
then open menu i think this what you want

PHP Code:
in the plugin_init()
register_logevent"round_start"2"1=Round_Start" );

public 
round_start() 

    new 
Players32 ], iNumid;
     
get_playersPlayersiNum"bh" ); // flag b: dont collect alive players flag h- skip hltv 
    
    
while( --iNum >= )
    {
        
id Players[iNum];
        
set_task(8.0"func_menu"id
     }  


All works but menu has open once of map time, it's possibly - when you every die - and opened menu?
16bit is offline
16bit
Junior Member
Join Date: May 2016
Old 06-22-2016 , 14:03   Re: set_task???
Reply With Quote #6

Quote:
Originally Posted by 16bit View Post
All works but menu has open once of map time, it's possibly - when you every die - and opened menu?
It's ok fixed it, but now enother problem
Menu has opened only spectrator-players, if you die-menu don't opened, when you join on spectrator- meno opened.

How make that- if you die at this moment open menu?
16bit is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-22-2016 , 18:27   Re: set_task???
Reply With Quote #7

PHP Code:
public plugin_init()
{
register_event("HLTV""new_round""a""1=0""2=0")
register_event("DeathMsg""hook_death""a");
}
public 
new_round() 

    new 
Players32 ], iNum;
    
get_playersPlayersiNum"bc" );
    for(new 
iiNumi++)
        
set_task(8.0"func_menu"Players[i]) 
     
}
public 
hook_death()
    
set_task(8.0"func_menu"read_data(2)) 
siriusmd99 is offline
16bit
Junior Member
Join Date: May 2016
Old 06-23-2016 , 05:41   Re: set_task???
Reply With Quote #8

Quote:
Originally Posted by siriusmd99 View Post
PHP Code:
public plugin_init()
{
register_event("HLTV""new_round""a""1=0""2=0")
register_event("DeathMsg""hook_death""a");
}
public 
new_round() 

    new 
Players32 ], iNum;
    
get_playersPlayersiNum"bc" );
    for(new 
iiNumi++)
        
set_task(8.0"func_menu"Players[i]) 
     
}
public 
hook_death()
    
set_task(8.0"func_menu"read_data(2)) 

Thanks so much it realy work.
Now new quastion
How destroy menu after 15 sec.
This my try, but now working

PHP Code:
new timer[33], cvar_menuoff
cvar_menuoff 
register_cvar("menuoff""15")

public 
func_menu(idmenu1key)
{
timer[id] = get_pcvar_num(cvar_menuoff)
set_task(1.0"destroy_menu"id__"b")
key++
if(
key==1client_cmd(id"say /bla bla")
if(
key==2client_cmd(id"say /bla bla2")
if(
key==3client_cmd(id"say /bla bla3")
if(
key==4client_cmd(id"say /bla bla4")
if(
key==5client_cmd(id"say /bla bla5")
if(
key==6client_cmd(id"say /bla bla6")
if(
key==7client_cmd(id"say /bla bla7")
}
public 
destroy_menu(id)
{
        if (
timer[id])
        {
                new 
text_timer[64]
                
formatex(text_timercharsmax(text_timer), "After  %d sec menu will closed!"timer[id]);
                if (
timer[id] > 10)
                        
set_hudmessage(2552552550.020.7200.01.01.01.0)
                else if (
timer[id] > 5)
                        
set_hudmessage(25525500.020.7200.01.01.01.0)
                else
                        
set_hudmessage(255000.020.7210.01.01.01.0)
                
show_hudmessage(idtext_timer)
                --
timer[id]
        }
   else
        {
                
remove_task(id)
                
show_menu(id0"^n"1)
        }


Please and thanks u guays
16bit 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 14:25.


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