Player::callProc: Difference between revisions
(Created page with "__TOC__ {{ServersideJsFunction}} This function calls the specified player's clientside and expects a callback. {{JSContainer| ==Syntax== <pre> player.callProc('eventProcNam...") |
No edit summary |
||
| Line 3: | Line 3: | ||
{{ServersideJsFunction}} | {{ServersideJsFunction}} | ||
This function calls the specified player's clientside and expects a callback. | This function calls the specified player's clientside Remote prodecure event (RPC) and expects a callback. | ||
{{JSContainer| | {{JSContainer| | ||
Revision as of 21:27, 22 June 2020
Server-Side Function
This function calls the specified player's clientside Remote prodecure event (RPC) and expects a callback.
JavaScript Syntax
Syntax
player.callProc('eventProcName', [...args]);
Required Arguments
- *eventProcName: String
- args: Any
Example
Server-Side
(async () => {
try {
let res = await player.callProc('test_proc', ['ok']);
console.log('succ', res);
} catch(e) {
console.error('Error: ' + e);
}
}();
Client-Side
mp.events.addProc('test_proc', (player, text) => {
return 'hey beast: ' + text;
});