All pastes #1551738 Raw Edit

botsync.pwn

public cpp v1 · immutable
#1551738 ·published 2009-09-02 18:03 UTC
rendered paste body
/*----------------------------------------------------------------------------*-					==========================					 NPC script communication					==========================Description:	This code provides a system to communicate with bots via files.  It uses	locks to ensure only one script may communicate at once - bots and the main	server run in separate processes so it is possible to read and write from	the files at the same time if locks are not used.		Because the communication is asynchronous replies are not instant, you send	a message to the bot (or vice versa) then use a callback to process the	response later.		Fast communication with bots is done via OnClientMessage, but there is no	way of returning data using this method, any responses from the bot will	have to go via the regular file system.		This file defines the filterscript used to read and write messages on the	server end.  Communication is done via a filterscript to avoid the	complexities of trying to synchronise multiple scripts at both the server	and the bot ends.  It also means less timers are running.Legal:	Copyright (C) 2009 Alex "Y_Less" Cole	The contents of this file are subject to the Mozilla Public License	Version 1.1 (the "License"); you may not use this file except in	compliance with the License. You may obtain a copy of the License at	http://www.mozilla.org/MPL/		Software distributed under the License is distributed on an "AS IS"	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the	License for the specific language governing rights and limitations	under the License.		The Original Code is the NPC synchronisation code filterscript.		The Initial Developer of the Original Code is Alex "Y_Less" Cole.  All	Rights Reserved.Version:	0.1Changelog:	02/09/09:		First version-*----------------------------------------------------------------------------*/#define BOTSYNC_SYNC_FS#define FILTERSCRIPT#include <a_samp>#include <botsync>public	OnFilterScriptInit(){	SetTimer("BotSync_Tick", 10, true);}