Vehicle::getNeonColour: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This function used for get vehicle neon color in RGB format.
__NOTOC__
{{ServersideJsFunction}}
This function is used to get the vehicle's neon colour in an RGB format.


<syntaxhighlight lang="javascript">
{{JSContainer|
void vehicle.getNeonColour();
==Syntax==
</syntaxhighlight>  
<pre>
vehicle.getNeonColour();
</pre>


'''Return array containing colours.'''
===Returns===
*'''neonColours''': {{RageType|Array}} Array containing the colours.
** '''r''': Red [0 - 255]
** '''g''': Green [0 - 255]
** '''b''': Blue [0 - 255]


==Array content==
==Example==
* Red color in diapason 0 - 255.
{{ServersideCode|
* Green color in diapason 0 - 255.
<pre>
* Blue color in diapason 0 - 255.
mp.events.addCommand(`getneon`,  
 
==Example==  
That's example just show, how use it.
 
<syntaxhighlight lang="javascript">
mp.events.addCommand(`neonich`,  
(player) => {
(player) => {
let vehicle = player.vehicle;
let vehicle = player.vehicle;
Line 25: Line 27:
}
}
);
);
</syntaxhighlight>
</pre>
}}
}}


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

Latest revision as of 00:58, 14 September 2020

Server-Side
Function

 JavaScript



This function is used to get the vehicle's neon colour in an RGB format.

JavaScript Syntax

Syntax

vehicle.getNeonColour();

Returns

  • neonColours: Array Array containing the colours.
    • r: Red [0 - 255]
    • g: Green [0 - 255]
    • b: Blue [0 - 255]

Example

Server-Side
mp.events.addCommand(`getneon`, 
	(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