Raised This Month: $ Target: $400
 0% 

Player think update time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 05-11-2015 , 13:00   Player think update time
Reply With Quote #1

Quick question:

Is player's pre/post think (FM_PlayerPreThink/FM_PlayerPostThink) fired every time the player gets updated (sends packets to the server) or is it fired every server frame? If not, is there another way of detecting the update rate? (maybe by using FM_CmdStart/FM_CmdEnd? Querying commands won't cut it.)

Last edited by Mehis; 05-11-2015 at 13:03.
Mehis is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-11-2015 , 15:19   Re: Player think update time
Reply With Quote #2

it's fired at every frame the CLIENT has, not the server
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 05-11-2015 , 20:41   Re: Player think update time
Reply With Quote #3

1.Client sends a message with protocol "clc_move" (#define clc_move 2) to tell server that he has to run movement code.
2.the server-side engine will call SV_ParseMove, SV_ParseMove will call SV_RunCmd for multiple times.
3.SV_RunCmd will call itself recusive recursively for multiple times.
4.SV_RunCmd will call FM_CmdStart, FM_PlayerPreThink, FM_PlayerPostThink and call "PM_Move" to run PlayerMove code then finally call FM_CmdEnd in SV_RunCmd.

5.if it's called from SV_ParseMove for more than once, or recursively, the gpGlobals->time will be the same in the later. so you can compare the current gpGlobals->time with last saved gpGlobals->time and wait until gpGlobals->time changed.

example:
PHP Code:
new Float:g_PlayerCmdTime[33];
new 
Float:g_PlayerUpdateRate[33];
public 
FM_CmdStart(index)
{
  new 
Float:curtime get_gametime();
  if(
curtime g_PlayerCmdTime[player_index])
  {
    
g_PlayerUpdateRate[player_index] = curtime g_PlayerCmdTime[player_index]
    
g_PlayerCmdTime[player_index] = curtime;
  }

if g_PlayerUpdateRate[player_index] is less than 10.0 / 1000.0 (10ms) for more than 5 secs, this player is likely to be a cheater who is changing the game speed.

Last edited by hzqst; 05-11-2015 at 20:59.
hzqst 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 09:16.


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