Raised This Month: $ Target: $400
 0% 

Cumulative Timer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-14-2022 , 15:20   Re: Cumulative Timer
Reply With Quote #2

Quote:
Originally Posted by alasfourom View Post
Hello guys

How is it possible to prolong timer if something is checked

For example, I'm trying to make a plugin if you killed someone, you will have some abilities and after a period of time, it will be turning off.

After killing someone you will have like 10 seconds of these abilities then it will go back to normal.

What I want to do is, if I killed more players, the time to rest to normal will be increase, like killing 3 players simultaneously will give you 10 + 10 + 10 seconds before resetting.

This is a script example - For Left 4 Dead 2:

PHP Code:
public void Event_InfectedDeath (Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId (event.GetInt("userid")); if (IsClient (victim))
    {
        
int team GetClientTeam (victim); if (team == TEAM_INFECTED)
        {
            
int attacker GetClientOfUserId (event.GetInt("attacker"));
            
            if (
IsValidClient (attackerTEAM_SURVIVOR)) if (!IsFakeClient (attacker))
            
            
/*I'm doing some long stuff here, didnt want to bother*/
            /*bluh bluh bluh*/
            /*bluh bluh bluh*/

            /*I created timer to stop the abilities after 10 seconds*/
            
CreateTimer (GetConVarFloat(10.0), StopTimerattacker);
        }
    }
    return;

Hello. I would do the following:

1. Because I want to let him know how much time is left at real time, I would make a 0.1 repeat timer to count down his time. Then the time left is a variable ( either set expiration by GetGameTime() or just make a time left var to 10 and decrease by 0.1 each time the timer arrives )

This allows you to both increment it whenever you like, and let the client track it.

Note that with the best way in L4D2 ( which I know you use ) you need to send an empty message or wait a bit, otherwise you will have bugs if you spam those hints ( PrintHintText )
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
 



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 00:58.


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