AddEvent 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.

Function registers new event.

Syntax

void addEvent(string name)

Required Arguments

  • name: The name of event which we want to register.

Example

Server

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

function onPlayerLogin(pid)
{
	callEvent("onPlayerLogin",pid); // calling event handler (addEventHandler) functions
};

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

Related functions