Raised This Month: $ Target: $400
 0% 

Counting mins and secs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MindeLT
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 12-23-2011 , 07:21   Counting mins and secs
Reply With Quote #1

Sup,

i used basetriggers plugin to count minutes and seconds left, however it show's me 0-0(using translation). Code used from basetrigers and rtv.

Thx

PHP Code:
new rtv_timeleft;

public 
OnConfigsExecuted()
{    
    
rtv_timeleft GetConVarInt(g_Cvar_InitialDelay);
    
CreateTimer(1.0RTV_Timer_timeleft_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE);
}
public 
Action:RTV_Timer_timeleft(Handle:timer)
{    
    if (
g_RTVAllowed)
        return 
Plugin_Stop;
    else
        
rtv_timeleft--;
            return 
Plugin_Continue;
}
AttemptRTV(client)
{
    if (!
g_RTVAllowed  || (GetConVarInt(g_Cvar_RTVPostVoteAction) == && HasEndOfMapVoteFinished()))
    {
        new 
mins rtv_timeleft 60;
        new 
secs rtv_timeleft 60;
        
        
ReplyToCommand(client"[SM] %t""RTV Not Allowed"minssecs);
        return;
    }

__________________

Last edited by MindeLT; 12-23-2011 at 07:23.
MindeLT is offline
Send a message via Skype™ to MindeLT
Scone
Senior Member
Join Date: Apr 2010
Location: England
Old 12-23-2011 , 12:47   Re: Counting mins and secs
Reply With Quote #2

There's no need to use timers like that, you could simply do this:

PHP Code:
new rtv_timeallowed;

public 
OnConfigsExecuted()
{    
    
rtv_timeallowed GetTime() + GetConVarInt(g_Cvar_InitialDelay);
}

AttemptRTV(client)
{
    if (
GetTime() < rtv_timeallowed  || (GetConVarInt(g_Cvar_RTVPostVoteAction) == && HasEndOfMapVoteFinished()))
    {
        new 
rtv_timeleft rtv_timeallowed GetTime();
        new 
mins rtv_timeleft 60;
        new 
secs rtv_timeleft 60;
        
        
ReplyToCommand(client"[SM] %t""RTV Not Allowed"minssecs);
    }

__________________
Scone is offline
MindeLT
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 12-23-2011 , 15:16   Re: Counting mins and secs
Reply With Quote #3

Wow, thx. It's much simplier than i did. Haven't though about it
__________________
MindeLT is offline
Send a message via Skype™ to MindeLT
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 04:48.


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