[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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)