[Tutorial] Understanding the SA-MP sync
#29

The more correct statement would be "the scripts run on a single thread". Any incoming info from the bit-stream is put in a buffer/queue then called when the PAWN script isn't busy. By default, the server will wait for SQLite to finish writing/reading to the file - you can allow it to do this in a different thread by running the following query.
pawn Code:
db_query( db, "PRAGMA synchronous = 0" );
Why the dialos is delayed is simply because:
  • Player types command.
  • Command is recieved by the server.
  • After ~5ms, the server calls OnPlayerCommandText.
  • The outgoing data to show the dialog is sent to Player.
  • Player recieves the data and the dialog is shown.
So basically, PAWN can't be doing two things at a time.

How MySQL plugins are threaded is when they get the action to perform, a new thread is started and when the data is ready to be sent back into the PAWN script it will call a PAWN callback when it isn't busy (usually at ProcessTick).

Player position and everything does go through the PAWN script before it is sent to the other clients - through OnPlayerUpdate. That callback is called every time any player-related info is about to get sent to the other clients. If you return 0 in OnPlayerUpdate, the server won't send that information. This clearly indicates it has to go through the PAWN thread just like everything else.

I hope you understand me a bit better now.
Reply


Messages In This Thread
Understanding the SA-MP sync - by Slice - 18.10.2010, 07:34
Re: Understanding the SA-MP sync - by Retardedwolf - 18.10.2010, 07:43
Re: Understanding the SA-MP sync - by Slice - 18.10.2010, 07:51
Re: Understanding the SA-MP sync - by Mike_Peterson - 18.10.2010, 07:57
Re: Understanding the SA-MP sync - by Retardedwolf - 18.10.2010, 08:03
Re: Understanding the SA-MP sync - by Slice - 18.10.2010, 08:05
Re: Understanding the SA-MP sync - by Retardedwolf - 18.10.2010, 08:12
Re: Understanding the SA-MP sync - by Hiddos - 18.10.2010, 15:45
Re: Understanding the SA-MP sync - by vyper - 18.10.2010, 15:49
Respuesta: Understanding the SA-MP sync - by The_Moddler - 18.10.2010, 20:25
Re: Understanding the SA-MP sync - by Scenario - 18.10.2010, 20:30
Respuesta: Understanding the SA-MP sync - by MrDeath537 - 18.10.2010, 21:01
Re: Understanding the SA-MP sync - by Calgon - 18.10.2010, 21:43
Respuesta: Re: Understanding the SA-MP sync - by The_Moddler - 18.10.2010, 22:18
Re: Understanding the SA-MP sync - by BP13 - 18.10.2010, 22:19
Re: Understanding the SA-MP sync - by iggy1 - 19.10.2010, 07:41
Re: Understanding the SA-MP sync - by Voldemort - 19.10.2010, 12:09
Re: Understanding the SA-MP sync - by Luka P. - 22.10.2010, 12:34
Re: Understanding the SA-MP sync - by VIRUXE - 24.10.2010, 13:33
Re: Understanding the SA-MP sync - by Slice - 24.10.2010, 14:16
Re: Understanding the SA-MP sync - by DiddyBop - 17.11.2010, 23:12
Re: Understanding the SA-MP sync - by DeadAhead - 09.12.2010, 14:29
Re: Understanding the SA-MP sync - by Slice - 09.12.2010, 14:55
Re: Understanding the SA-MP sync - by SkizzoTrick - 09.12.2010, 15:09
Re: Understanding the SA-MP sync - by ғαιιοцт - 05.01.2011, 09:04
Re: Understanding the SA-MP sync - by HyperZ - 05.01.2011, 09:08
Re: Understanding the SA-MP sync - by leong124 - 05.01.2011, 09:31
Re: Understanding the SA-MP sync - by yezizhu - 31.01.2011, 16:55
Re: Understanding the SA-MP sync - by Slice - 31.01.2011, 20:56
Re: Understanding the SA-MP sync - by yezizhu - 02.02.2011, 03:43
Re: Understanding the SA-MP sync - by Slice - 02.02.2011, 06:38
Re: Understanding the SA-MP sync - by XFlawless - 03.02.2011, 12:44
Re: Understanding the SA-MP sync - by Kerlan - 16.06.2012, 23:59
Re: Understanding the SA-MP sync - by davve95 - 27.07.2012, 19:55
Re: Understanding the SA-MP sync - by RedFusion - 19.04.2013, 10:05
Re: Understanding the SA-MP sync - by Slice - 19.04.2013, 10:53
Re: Understanding the SA-MP sync - by RedFusion - 19.04.2013, 11:21
Re: Understanding the SA-MP sync - by Yashas - 19.04.2013, 15:39
Re: Understanding the SA-MP sync - by DJTunes - 04.07.2013, 05:22
Re: Understanding the SA-MP sync - by RedFusion - 04.07.2013, 10:23
Re: Understanding the SA-MP sync - by Uberanwar - 23.11.2013, 07:46
Re: Understanding the SA-MP sync - by awirer - 10.09.2014, 11:18

Forum Jump:


Users browsing this thread: 8 Guest(s)