Events::addProc

From RAGE Multiplayer Wiki

This function register the specified player's Remote Prodecure Call (RPC) event and expects a callback.


Shared
Function

 C#  JavaScript



C# Syntax

RAGE.Events.AddProc(string eventName, RAGE.Events.CallDelegate handler, [async = false]);


JavaScript Syntax

Syntax

mp.events.addProc('eventProcName', callback);

Required Arguments

  • *eventProcName: String
  • *callback: Any

Examples

Server-Side
// register RPC 'test_proc' in server-side
mp.events.addProc('test_proc', (player, text) => {
  return 'hey beast: ' + text;
});


Client-Side
const response = await mp.events.callRemoteProc('test_proc', 'test');
// calls RPC 'test_proc' from server side and wait for result
mp.gui.chat.push(`response: ${response}`);