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

How To Start a Time when Round Start?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 02-10-2010 , 10:53   How To Start a Time when Round Start?
Reply With Quote #1

hi there i want to know how i could start to count in segs when the round start and every time round start reset that count
liryck is offline
Send a message via MSN to liryck
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-10-2010 , 11:08   Re: How To Start a Time when Round Start?
Reply With Quote #2

You have a tutorial in the tutorial section to know how to hook such event. Please check it. (made by VEN)
__________________
Arkshine is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 02-10-2010 , 12:55   Re: How To Start a Time when Round Start?
Reply With Quote #3

yes i check and i already know when the round start but what i dont know is how to count or get a timer.

to execute a function x seconds latter of the new round
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-10-2010 , 13:12   Re: How To Start a Time when Round Start?
Reply With Quote #4

PHP Code:
// ...

#define TASK_ID 1996

public fwd_Spawn(id)
{
    
// ...
    
    
set_task30.0"cmd_Command"TASK_ID___)
    
    
/* Parameters:
    
    1) Time in seconds to execute the command (float)
    2) Function name to execute
    3) Task ID
    4) Parameters to pass with the function
    5) Len
    6) Flags
    7) Repeat?
    
    Use _'s to not pass a value for that parameter
    */

    // Most commonly used like this
    
set_task13.0"cmd_IndexExample"id // 3rd param is the index
}

public 
cmd_Command() // MUST BE A PUBLIC FUNCTION
{
    
// ...
}

public 
cmd_IndexExample(plr// You can pass any index, it'll be the same player
{
   
// ...

set_task
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 02-11-2010 at 01:09.
wrecked_ is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 02-10-2010 , 14:03   Re: How To Start a Time when Round Start?
Reply With Quote #5

uhmm no lets see.

i have two function in one of them i have this condition

PHP Code:
if(is_user_alive(id) && id != && g_round_started == && get_gametime() >= timeround pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); 
so obviously if player is alive cant use the command. but i want that the player can use the commands some secs latter of the new round staying alive

i have this other

PHP Code:
public logevent_round_start()
{
    
g_round_started 1
    client_print
(0,print_chat,"%d New Round Starting",g_round_started)
    
timeround get_gametime()+15
    set_task
(20.0,"round_start_dmg")

when the new round comes in the set_task i put that in 15 segs another funtion reset me the dmg of the last round so im trying to get a time in a variable.
in the IF im saying that if the current gametime is <= timeround. im assuming that the time is in secs but really dont know
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-10-2010 , 15:31   Re: How To Start a Time when Round Start?
Reply With Quote #6

Quote:
Originally Posted by liryck View Post
i want that the player can use the commands some secs latter of the new round staying alive
Make a bool and set a task to reset the bool after a set amount of time via set_task. Do it in the round start function so you can complete whatever you're attempting to do.

Be a little more clear next time.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 02-11-2010 , 00:39   Re: How To Start a Time when Round Start?
Reply With Quote #7

ty that works great, xd was simple. now im trying that the damage done by the player show it automatically when the rounds ends. what i got is that there is no dmg. But if i use the command .dmg i got the damage of last round normaly

PHP Code:
public pug_status(id)
{
       if(
PUG_STATUS_LIVE && allowdmg == true)
       {
           
cmd_dmg(id)
       }

PHP Code:
public logevent_round_end()
{
    
allowdmg true
    set_task
(8.0,"pug_status")
    
set_task(20.0,"allowdmgreset")
    
set_task(20.0,"round_start")
    
set_task(20.0,"round_start_failed")
    

PHP Code:
public cmd_dmg(id)
{
    
    if(
is_user_alive(id) && id != && allowdmg == false pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); 
    else
    {
        static 
Players[32], name[32], RPlayers[32]
        new 
playerCountiplayer,rplayer
        get_players
(PlayersplayerCount"ch")
        
get_players(RPlayersplayerCount"ch")

        new 
tmp_hitstmp_dmgchecktmp_rhitstmp_rdmg
        
for (i=0i<playerCounti++)
        {
            
player Players[i]
            
rplayer RPlayers[i]
            
            
tmp_hits pug_hits[id][player]
            
tmp_rhits pug_hits[rplayer][id]

            if( 
tmp_hits || tmp_rhits )
            {
                
check 1
                tmp_dmg 
pug_dmg[id][player]
                
tmp_rdmg pug_dmg[rplayer][id]
                
                if(
player == idclient_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG_SELF",tmp_hits,tmp_dmg)
                else
                {
                    
get_user_name(player,name31)
                    
client_print(id,print_chat,"%s %L","-->",id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsname)
                    
                    if(
PUG_STATUS_DEAD && allowdmg == true)
                    {
                        
get_user_name(player,name31)
                        
client_print(id,print_chat,"%s %L","-->",id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsname)
                    }
                }
            }
          }
        
tmp_hits pug_hits[id][0]
        
tmp_rhits pug_hits[0][id]
        
        if(
tmp_hits || tmp_rhits)
        {
            
tmp_rdmg pug_dmg[0][id]
            
tmp_dmg pug_dmg[id][0]
            
client_print(id,print_chat,"%s %L","-->",id,"PUG_AUX_DMG","WorldSpawn",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhits)
        }
        else if(!
checkclient_print(id,print_chat,"%s %L","-->",id,"PUG_AUX_NODMG")
    }
    return 
PLUGIN_HANDLED 
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-11-2010 , 00:51   Re: How To Start a Time when Round Start?
Reply With Quote #8

You need to call the pug_status function with a for loop and pass the id param in the set_task. At the moment you're calling a function that doesn't specify what player you're trying to execute it on. I told you how to use the set_task function and its params above, just use that in a for loop and set it for every player with the index as the 3rd or 4th param in set_task.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 02-11-2010 at 00:58.
wrecked_ is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 02-11-2010 , 13:15   Re: How To Start a Time when Round Start?
Reply With Quote #9

im know that're u trying to help me but english is not main main lang and at the scripting part im still a newbie.

if u could help me a little more
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-11-2010 , 13:23   Re: How To Start a Time when Round Start?
Reply With Quote #10

PHP Code:
public logevent_round_end()
{
    
allowdmg true
    set_task
(8.0,"pug_status")
    
set_task(20.0,"allowdmgreset")
    
set_task(20.0,"round_start")
    
set_task(20.0,"round_start_failed")
    


PHP Code:
public logevent_round_end()
{
    new 
iPlayers[32]
    new 
iNum
    
new tempid

    get_players
iPlayersiNum )
    for( new 
iiNumi++ )
    {
        
tempid iPlayers[i]
        
allowdmg true
        set_task
(8.0,"pug_status",tempid)
        
set_task(20.0,"allowdmgreset")
        
set_task(20.0,"round_start")
        
set_task(20.0,"round_start_failed")
    }

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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:35.


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