Events::callRemote

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function is used to call a server-side event from a client-side script.

Syntax

mp.events.callRemote(String eventName [, ...args])

Example

This example will call the server-side event, from the client-side script, to see if the player screen size is not 1280x1024.

Client-Side
let checkResolution = () => {
	let res = mp.game.graphics.getScreenActiveResolution(x, y);
	
	if (!((res.x == 1280) && (res.y == 1024))) {
		mp.events.callRemote("kickMeImBad", res.x, res.y);
	};
};

checkResolution();


Server-Side
let blahBlah = (player, sx, sy) => {
	console.log(`${player.name} bad boy :c, his screen size ${sx}x${sy}`);
	player.kick();
};

mp.events.add("kickMeImBad", blahBlah);

See Also