[Include] [INC] NPC-Bridge (GM to NPC Communication)
#1

Code:
  NNNNNNNN    NNNNNNNNPPPPPPPPPPPPPPPPP      CCCCCCCCCCCCC
  N:::::::N    N::::::NP::::::::::::::::P    CCC::::::::::::C
  N::::::::N   N::::::NP::::::PPPPPP:::::P  CC:::::::::::::::C
  N:::::::::N   N::::::NPP:::::P   P:::::P C:::::CCCCCCCC::::C
  N::::::::::N  N::::::N P::::P   P:::::P C:::::C    CCCCCC
  N:::::::::::N  N::::::N P::::P   P:::::PC:::::C       
  N:::::::N::::N N::::::N P::::PPPPPP:::::P C:::::C       
  N::::::N N::::N N::::::N P:::::::::::::PP C:::::C       
  N::::::N N::::N:::::::N P::::PPPPPPPPP  C:::::C       
  N::::::N  N:::::::::::N P::::P      C:::::C       
  N::::::N  N::::::::::N P::::P      C:::::C       
  N::::::N   N:::::::::N P::::P       C:::::C    CCCCCC
  N::::::N   N::::::::NPP::::::PP      C:::::CCCCCCCC::::C
  N::::::N    N:::::::NP::::::::P       CC:::::::::::::::C
  N::::::N    N::::::NP::::::::P        CCC::::::::::::C
  NNNNNNNN     NNNNNNNPPPPPPPPPP         CCCCCCCCCCCCC
Code:
88888888ba  88888888ba  88 88888888ba,   ,ad8888ba,  88888888888 
88   "8b 88   "8b 88 88   `"8b  d8"'  `"8b 88      
88   ,8P 88   ,8P 88 88    `8b d8'      88      
88aaaaaa8P' 88aaaaaa8P' 88 88     88 88       88aaaaa   
88""""""8b, 88""""88'  88 88     88 88   88888 88"""""   
88   `8b 88  `8b  88 88     8P Y8,    88 88      
88   a8P 88   `8b  88 88   .a8P  Y8a.  .a88 88      
88888888P"  88   `8b 88 88888888Y"'   `"Y88888P"  88888888888
So this is my first public release of anything Pawno related.

This is a communication Bridge between any GameMode and NPC.

Installation

ON YOUR GAMEMODE:
After your includes:
Code:
#define SECRETCODE "!:S3cr3tC0d3:!" // Insert your secret code here, this allow communication to the NPC's, make it safe since it can be used in chat or anyone can control any bot!!!!, Consider it as a rcon password!
#define TOTALCHARS 14 // Total chars of the Secret word, sorry cant use sizeof :(
#include <npc_bridge> // Our include.
ON YOUR NPC:
After your includes:
Code:
#define SECRETCODE "!:S3cr3tC0d3:!" // Insert your secret code here, this allow communication to the NPC's, make it safe since it can be used in chat or anyone can control any bot!!!!, Consider it as a rcon password!
#define TOTALCHARS 14 // Total chars of the Secret word, sorry cant use sizeof :(
#include <npc_bridge> // Our include.
In the end of your script:
Code:
public OnClientMessage(color, text[])
{
	ClientMessageBridge(text); // Call the function needed.
}
Usage:
Run a command trough your gamemod:
Code:
NPCMessage(<NPC ID>, "<SYNTAX>", "<COMMAND HERE>");
Examples & Current available commands:
Code:
NPCMessage(NPCIdHere, "This is a sample SendChat", "SendChat"); // SendChat("This is a sample SendChat")
NPCMessage(NPCIdHere, "/mycommand", "SendCommand"); // SendCommand("/mycommand")
NPCMessage(NPCIdHere, "2 square", "StartRecordingPlayback"); // StartRecordingPlayback(2,"square");
NPCMessage(NPCIdHere, "StopRecordingPlayback", "StopRecordingPlayback"); // StopRecordingPlayback();
NPCMessage(NPCIdHere, "PauseRecordingPlayback", "PauseRecordingPlayback"); // PauseRecordingPlayback();
NPCMessage(NPCIdHere, "ResumeRecordingPlayback", "ResumeRecordingPlayback"); // ResumeRecordingPlayback();
Commands & Syntax:
Code:
[COMMAND] - [SYNTAX]
SendChat - Message
SendCommand - /Command
StartRecordingPlayback - <Recording Type ID>[space]<Recording Name>
StopRecordingPlayback - None
PauseRecordingPlayback - None
ResumeRecordingPlayback - None
Thanks to:
> Kye & The SA:MP Dev team (Not only for the new great version but also for the nice examples that i was able to modify)
> Backwardsman97 for this
> Zezombia, because he release "made"/"inspired" me to release this

Download it Here

PS: Please report any bugs!

Changelog:
0.1: Released
0.1.1: Removed some forgotten debug functions
Reply
#2

Looks nice, but your download link is not working.
Reply
#3

Quote:
Originally Posted by Wanted1900
Looks nice, but your download link is not working.
Sorry about that,

There was an error during the upload, fixed
Reply
#4

Quote:
Originally Posted by Whiteagle
Quote:
Originally Posted by Wanted1900
Looks nice, but your download link is not working.
Sorry about that,

There was an error during the upload, fixed
Thank you.
Reply
#5

Quote:
Originally Posted by Wanted1900
Quote:
Originally Posted by Whiteagle
Quote:
Originally Posted by Wanted1900
Looks nice, but your download link is not working.
Sorry about that,

There was an error during the upload, fixed
Thank you.
You're welcome, please report any bugs that you find
Reply
#6

Cool
Reply
#7

But it is Wrong Section i think
Reply
#8

Oh this is old :P

This is here since the pre-beta for developers, when SA:MP 0.3 was still a dream for us mortals.

This was in fact posted over the 0.3 stuff but with the changes this got lost here

Going to report to get moved to FS & Inc's.

Thanks guys
Reply
#9

Seems like the easiest system around for NPC communication but I can't get it to work when using YSI, more specifically (I believe) its foreach that is causing the problems. I am running some tests now to see if I can't figure out exactly why.

[Edit] Out I figured out the problem, it has to do with the way foreach determines if something is a bot (SendChat) and since this include uses that it broke foreach. Since I am not using this feature (I only want it for the playback features) I was able to comment those sections out and everything is compiling fine now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)