Posts: 63
	Threads: 12
	Joined: Jan 2013
	
Reputation: 
0
	 
 
	
		
		
		
		18.07.2013, 21:57 
(
 Последний раз редактировалось HitnKill; 21.07.2013 в 13:30.
)
	
	 
	
		Hi, i want to optimise my script apparently with my last host my players see other player lag (teleport) with lot of players.
I upload my profiler for you see if my code it's bad on some callback / others...
edit.
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 535
	Threads: 36
	Joined: Oct 2009
	
Reputation: 
0
	 
 
	
	
		What is your OnPlayerUpdate ? It's a very frequent event, keep it fast.
OnPlayerKeyStateChange too.
Mysql_query is threaded not should give problem to your lag.
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 160
	Threads: 24
	Joined: Oct 2009
	
Reputation: 
0
	 
 
	
	
		Often lag reasons:
- Script in OnPlayerUpdate
- A lot of objects or vehicles at one place
- Timers < 500ms
- !! Changing materials or text on objects !!
- frequented asking about player infos GetPlayerPos, Skin, Weapons, Vehicle, Seat.. You can store this serverside, for example create Skin[MAX_PLAYERS] that you will change when you change player skin.. Scripts with variables are much faster than scripts using player getting functions.
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,046
	Threads: 29
	Joined: Mar 2010
	
	
 
	
	
		This is a really old script I made once: 
http://pastebin.com/TCkpwY3R
It doesn't use OnPlayerUpdate to detect someone "c-bugging".
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 977
	Threads: 10
	Joined: Apr 2011
	
Reputation: 
0
	 
 
	
	
		Your OnPlayerUpdate is not the problem here. It really irritates me that people think putting 20 lines of code inside that callback will completely ruin the server's performance. Those people simply have no clue what they're talking about.
As a reference, GodFather ran relatively stable with 100+ players and it saved every players' stats in OnPlayerUpdate.