AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Set a timer/countdown (https://forums.alliedmods.net/showthread.php?t=272482)

KuvZz 10-01-2015 11:47

[Help] Set a timer/countdown
 
Hi guys, I would to know how to set a timer/countdown (this aren't the correct words lol)
I mean, for expample:
PHP Code:

set_user_gravity(id400)
//after 5 seconds
set_user_gravity(id800


OciXCrom 10-01-2015 12:25

Re: [Help] Set a timer/countdown
 
PHP Code:

set_user_gravity(id400)
set_task(5.0"user_gravity"id)

public 
user_gravity(id)
    
set_user_gravity(id800

PS - This is not how the gravity function is used. Use 1.0 for 800 and 0.5 for 400.

KuvZz 10-01-2015 12:48

Re: [Help] Set a timer/countdown
 
Yeah, thanks. I forgot the set_task lol
And you are right, btw gravity is the example but thanks :D

PS: Tested and works (I think you forget a { )

HamletEagle 10-01-2015 12:52

Re: [Help] Set a timer/countdown
 
Quote:

Originally Posted by OciXCrom (Post 2348661)
PHP Code:

set_user_gravity(id400)
set_task(5.0"user_gravity"id)

public 
user_gravity(id)
    
set_user_gravity(id800

PS - This is not how the gravity function is used. Use 1.0 for 800 and 0.5 for 400.

Or divide by sv_gravity cvar value.

OciXCrom 10-01-2015 14:35

Re: [Help] Set a timer/countdown
 
Quote:

Originally Posted by KuvZz (Post 2348668)
PS: Tested and works (I think you forget a { )

There's no need to use it when the function has only one line. Just hit TAB.

HamletEagle 10-01-2015 14:42

Re: [Help] Set a timer/countdown
 
Quote:

Originally Posted by OciXCrom (Post 2348691)
There's no need to use it when the function has only one line. Just hit TAB.

But it's okay to put { } even with only one line.

OciXCrom 10-01-2015 17:50

Re: [Help] Set a timer/countdown
 
Yes, I'm aware od that, but I prefer using TAB instead. However, there's no big difference.


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

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