AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get time in milliseconds (https://forums.alliedmods.net/showthread.php?t=87772)

Wentix 03-16-2009 07:20

Get time in milliseconds
 
Hello,
I search function, that can return time in milliseconds.

Is it possible?

thx. (:

Owyn 03-16-2009 07:21

Re: Get time in milliseconds
 
wanted to ask this too
and also i wanted a function what would display time in milliseconds running up on player screen

ConnorMcLeod 03-16-2009 07:44

Re: Get time in milliseconds
 
get_gametime() return the time since map start, with 6 decimals, if you want to print int with only 3 decimals, use %.3f.

Owyn 03-16-2009 08:28

Re: Get time in milliseconds
 
i ment, can i display time in ms realtime increasing on player screen without sending a print to client every ms ?

SnoW 03-16-2009 09:36

Re: Get time in milliseconds
 
Quote:

Originally Posted by .Owyn. (Post 781782)
i ment, can i display time in ms realtime increasing on player screen without sending a print to client every ms ?

You have to show it separately everytime you want it to be changed.

Wentix 03-16-2009 10:17

Re: Get time in milliseconds
 
ConnorMcLeod, thanks, its working.

But I returned time in that format — 16.437 (seconds.milliseconds).

How can I get only milliseconds?)

YamiKaitou 03-16-2009 11:14

Re: Get time in milliseconds
 
Quote:

Originally Posted by Wentix (Post 781846)
How can I get only milliseconds?)

You convert it.

Wentix 03-16-2009 11:27

Re: Get time in milliseconds
 
Quote:

Originally Posted by YamiKaitou (Post 781888)
You convert it.

How?

format_time? How use it?

:)

Wentix 03-16-2009 13:15

Re: Get time in milliseconds
 
In format_time only this parametres:

Code:

%a abbreviated weekday name (Sun)
%A full weekday name (Sunday)
%b abbreviated month name (Dec)
%B full month name (December)
%c date and time (Dec 2 06:55:15 1979)
%d day of the month (02)
%H hour of the 24-hour day (06)
%I hour of the 12-hour day (06)
%j day of the year, from 001 (335)
%m month of the year, from 01 (12)
%M minutes after the hour (55)
%p AM/PM indicator (AM)
%S seconds after the minute (15)
%U Sunday week of the year, from 00 (48)
%w day of the week, from 0 for Sunday (6)
%W Monday week of the year, from 00 (47)
%x date (Dec 2 1979)
%X time (06:55:15)
%y year of the century, from 00 (79)
%Y year (1979)

Here is no "milliseconds".

May be exist another way to get only milliseconds?
How to remove seconds from the string?

SnoW 03-16-2009 13:21

Re: Get time in milliseconds
 
Code:

new Float:whole_num = 12.123;
new Float:only_decimals = whole_num - float(floatround(whole_num));

Can someone tell me what's difference with floatround_tozero and floatround_round? :mrgreen:


All times are GMT -4. The time now is 08:56.

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