triggerServerEvent

From IV:MP Wiki

Jump to: navigation, search

Client · (Functions · Events)
Please use the function getLocalPlayer instead of playerid

This function calls a server-side event from the client.

Contents

[hide]

Syntax

bool triggerServerEvent(string event, ...);

Parameters

(string event, ...)
string eventthe event
...optional parameters, can be any type

Returns

Returns true if the event was called, false otherwise.

Example

Client · (Functions · Events)
Please use the function getLocalPlayer instead of playerid
1
2
3
4
5
// get user and password from some GUI login box
 
triggerServerEvent("login", username, password);
 
// ...
Server · (Functions · Events)
1
2
3
4
5
6
function loginHandler(playerid, username, password)
{
    // Check if username and password are valid
    // ...
}
addEvent("login", loginHandler);

See also

0.1
Personal tools
Namespaces
Variants
Actions
Navigation
Server
Client
Scripting
Toolbox