CallEvent Shared function

From Gothic 2 Online: Wiki
Jump to navigation Jump to search

This function was added in version: 0.0.0.0

NOTE! Events are special function, which are called when something specific happend. For example, when player join to the server, is called event named onPlayerJoin.

NOTE! New event must be registered via addEvent function.

Function calling already created event.

Syntax

void callEvent(string name, [, args...])

Required Arguments

  • name: The name of event.

Optional Arguments

  • args: Arguments, which will be parameters in event callback.

Example

Server

addEventHandler("onPlayerJoin",function(pid)
{
	spawnPlayer(pid);
	onPlayerLogin(pid); // calling new function
};

function onPlayerLogin(pid)
{
	callEvent("onPlayerLogin",pid); // calling new event
};

addEvent("onPlayerLogin") // registering new event (without this, addEventHandler functions won't be called)

Related functions