Advertisement
Guest User

botsync.pwn

a guest
Jul 10th, 2011
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.07 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*-
  2.                     ==========================
  3.                      NPC script communication
  4.                     ==========================
  5. Description:
  6.     This code provides a system to communicate with bots via files.  It uses
  7.     locks to ensure only one script may communicate at once - bots and the main
  8.     server run in separate processes so it is possible to read and write from
  9.     the files at the same time if locks are not used.
  10.  
  11.     Because the communication is asynchronous replies are not instant, you send
  12.     a message to the bot (or vice versa) then use a callback to process the
  13.     response later.
  14.  
  15.     Fast communication with bots is done via OnClientMessage, but there is no
  16.     way of returning data using this method, any responses from the bot will
  17.     have to go via the regular file system.
  18.  
  19.     This file defines the filterscript used to read and write messages on the
  20.     server end.  Communication is done via a filterscript to avoid the
  21.     complexities of trying to synchronise multiple scripts at both the server
  22.     and the bot ends.  It also means less timers are running.
  23. Legal:
  24.     Copyright (C) 2009 Alex "Y_Less" Cole
  25.  
  26.     The contents of this file are subject to the Mozilla Public License
  27.     Version 1.1 (the "License"); you may not use this file except in
  28.     compliance with the License. You may obtain a copy of the License at
  29.     http://www.mozilla.org/MPL/
  30.  
  31.     Software distributed under the License is distributed on an "AS IS"
  32.     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  33.     License for the specific language governing rights and limitations
  34.     under the License.
  35.  
  36.     The Original Code is the NPC synchronisation code filterscript.
  37.  
  38.     The Initial Developer of the Original Code is Alex "Y_Less" Cole.  All
  39.     Rights Reserved.
  40. Version:
  41.     0.1
  42. Changelog:
  43.     02/09/09:
  44.         First version
  45. -*----------------------------------------------------------------------------*/
  46.  
  47. #define BOTSYNC_SYNC_FS
  48.  
  49. #define FILTERSCRIPT
  50.  
  51. #include <a_samp>
  52. #include <botsync>
  53.  
  54. public
  55.     OnFilterScriptInit()
  56. {
  57.     SetTimer("BotSync_Tick", 10, true);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement