Vehicle::getNeonColour: Difference between revisions

From RAGE Multiplayer Wiki
(Updated the example section's text to be grammatically correct.)
(Updated example section to use "<pre>" tags instead of incorrect syntax highlighting.)
Line 12: Line 12:
* Blue color in diapason 0 - 255.
* Blue color in diapason 0 - 255.


==Example==  
==Example==
An example showing the function's use.
{{ServersideCode|
 
<pre>
<syntaxhighlight lang="javascript" highlight="5">
mp.events.addCommand(`neonich`,  
mp.events.addCommand(`neonich`,  
(player) => {
(player) => {
Line 25: Line 24:
}
}
);
);
</syntaxhighlight>
</pre>
}}


==See Also==
==See Also==
{{Vehicle_block}}
{{Vehicle_block}}

Revision as of 19:51, 11 September 2020

This function used for get vehicle neon color in RGB format.

Syntax

Object vehicle.getNeonColour();

Returns

Return array containing colours.

Array content

  • Red color in diapason 0 - 255.
  • Green color in diapason 0 - 255.
  • Blue color in diapason 0 - 255.

Example

Server-Side
mp.events.addCommand(`neonich`, 
	(player) => {
		let vehicle = player.vehicle;
		if (!!vehicle) {
			let [r, g, b] = vehicle.getNeonColour();
			player.outputChatBox(`R <b>${r}</b>; G <b>${g}</b>; B <b>${b}</b>`);
		};
	}
);

See Also

Template:Vehicle block