AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect passed time (https://forums.alliedmods.net/showthread.php?t=221450)

Artick.. 07-22-2013 08:06

Detect passed time
 
Sorry for the title but I dind't find a good one.
1.How can I detect passed time from a vote ? I have a vote plugin. Let's say that I start a vote. How ca I verify the time passed and block a new vote for x minutes. This is: Now you start the vote,you can start it again after 20 minutes.
2.How can I make a menu/public to execute after a certain time ?

Black Rose 07-22-2013 10:42

Re: Detect passed time
 
1. Add this as a global variable:
Code:
new g_nextVote;
Add this at the start of a new vote.
Code:
if ( get_systime() < g_nextVote )      return;
Add this at the end of a new vote:
Code:
g_nextVote = get_systime() + 20 * 60; // 20 minutes á 60 seconds

2. Please explain further, I don't understand.

akcaliberg 07-22-2013 10:49

Re: Detect passed time
 
1.

Code:
new gLastVoteTime; public VoteFunc(id) {     if(( get_systime() - gLastVoteTime ) < 1200) {         client_print(id,print_chat,"You must wait 20 minutes to start a new vote.")         return PLUGIN_HANDLED     }     // Vote functions         gLastVoteTime = get_systime(); }

2. certain time?

every X o'clock ?
every X minutes passed after the last vote ?

Artick.. 07-23-2013 10:01

Re: Detect passed time
 
2.Let's say that I have a menu. I want the menu to aotomatically appear in 3 rd round.

wickedd 07-23-2013 10:16

Re: Detect passed time
 
PHP Code:

new count

public new_round( )
{
    
count++
}

public 
round_start( )
{    
    if( 
count == 3)
    {
        
// Your code here
    
}



Shooting King 07-23-2013 10:16

Re: Detect passed time
 
Use HLTV message to count round and if count == 3, show menu.


All times are GMT -4. The time now is 06:22.

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