1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Implement the custom event functions.

This commit is contained in:
Sandu Liviu Catalin 2016-05-23 03:51:44 +03:00
parent fdd06e8c2e
commit 86297882d5
3 changed files with 18 additions and 0 deletions

View File

@ -642,6 +642,11 @@ public:
void ConnectPlayer(Int32 id, Int32 header, Object & payload); void ConnectPlayer(Int32 id, Int32 header, Object & payload);
void DisconnectPlayer(Int32 id, Int32 header, Object & payload); void DisconnectPlayer(Int32 id, Int32 header, Object & payload);
/* --------------------------------------------------------------------------------------------
* Emit a custom event.
*/
void EmitCustomEvent(Int32 group, Int32 header, Object & payload);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Server events. * Server events.
*/ */

View File

@ -11,6 +11,12 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
extern void ProcessRoutines(); extern void ProcessRoutines();
// ------------------------------------------------------------------------------------------------
void Core::EmitCustomEvent(Int32 group, Int32 header, Object & payload)
{
Emit(mOnCustomEvent, group, header, payload);
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Core::EmitBlipCreated(Int32 blip, Int32 header, Object & payload) void Core::EmitBlipCreated(Int32 blip, Int32 header, Object & payload)
{ {

View File

@ -60,6 +60,12 @@ static void BindEvent(Int32 id, Object & env, Function & func)
Core::Get().BindEvent(id, env, func); Core::Get().BindEvent(id, env, func);
} }
// ------------------------------------------------------------------------------------------------
static void CustomEvent(Int32 group, Int32 header, Object & payload)
{
Core::Get().EmitCustomEvent(group, header, payload);
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static Int32 GetState() static Int32 GetState()
{ {
@ -118,6 +124,7 @@ void Register_Core(HSQUIRRELVM vm)
RootTable(vm) RootTable(vm)
.Bind(_SC("SqCore"), Table(vm) .Bind(_SC("SqCore"), Table(vm)
.Func(_SC("Bind"), &BindEvent) .Func(_SC("Bind"), &BindEvent)
.Func(_SC("CustomEvent"), &CustomEvent)
.Func(_SC("Reload"), &SetReload) .Func(_SC("Reload"), &SetReload)
.Func(_SC("ReloadBecause"), &SetReloadBecause) .Func(_SC("ReloadBecause"), &SetReloadBecause)
.Func(_SC("Reloading"), &IsReloading) .Func(_SC("Reloading"), &IsReloading)