Raised This Month: $51 Target: $400
 12% 

Get the server demo tick


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2NASTY4U
Senior Member
Join Date: Mar 2014
Old 04-22-2014 , 10:01   Get the server demo tick
Reply With Quote #1

Hey,

is there any way to get the tick number in server demo while record is running with SourcePawn?

GetCurrentRecordTick() -> return 3243211

Last edited by 2NASTY4U; 04-22-2014 at 10:28.
2NASTY4U is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-22-2014 , 10:37   Re: Get the server demo tick
Reply With Quote #2

You would need an extension for that.

(Hook INetChannel::SetDemoRecorder on the SourceTV bot's netchannel and keep the recorder param. Then, virtually call GetRecordingTick on it, optionally guarded by IsRecording)

Edit: that method of getting the IDemoRecorder would only work if tv_autorecord is on when the SourceTV bot joins, else SetDemoRecorder doesn't get called. You would instead need to use another way to get the recorder object on the CHLTVServer object.

Last edited by psychonic; 04-22-2014 at 10:46.
psychonic is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-22-2014 , 10:44   Re: Get the server demo tick
Reply With Quote #3

if you dont mind me asking, what is the need of getting the record tick?
Mitchell is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-22-2014 , 10:54   Re: Get the server demo tick
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
if you dont mind me asking, what is the need of getting the record tick?
A guess is so that you could pair it with cheat detection. Start recording with suspicious behavior starts and then log demo ticks of further detections, making them easy to jump to when viewing the demo later.
psychonic is offline
2NASTY4U
Senior Member
Join Date: Mar 2014
Old 04-22-2014 , 11:08   Re: Get the server demo tick
Reply With Quote #5

Thanks psychonic, that's great. Cheat detection is a applicability. But what about ban request in a Calladmin-Client? That's why we need getting demo tick.
2NASTY4U is offline
sheo
SourceMod Donor
Join Date: Jul 2013
Location: Russia, Moscow
Old 04-22-2014 , 11:19   Re: Get the server demo tick
Reply With Quote #6

There is an easier way)
Just set the int variable to 0 on demo start and increment it on every OnGameFrame()
sheo is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-22-2014 , 11:25   Re: Get the server demo tick
Reply With Quote #7

Quote:
Originally Posted by sheo View Post
There is an easier way)
Just set the int variable to 0 on demo start and increment it on every OnGameFrame()
That's what i was thinking also.
Mitchell is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-22-2014 , 11:39   Re: Get the server demo tick
Reply With Quote #8

Quote:
Originally Posted by sheo View Post
There is an easier way)
Just set the int variable to 0 on demo start and increment it on every OnGameFrame()
That won't be exact in some cases, but a similar method would work close enough and be similar to how the engine calculates it.

Use the GetGameTickCount native at the time of starting the demo to get the demo start tick, and then call it again and subtract the start when wanting to know the current demo tick.
psychonic is offline
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:33.


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