Vehicle::getNeonColour: Difference between revisions

From RAGE Multiplayer Wiki
(Updated the example section's text to be grammatically correct.)
No edit summary
 
(4 intermediate revisions by one other user 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.


{{JSContainer|
==Syntax==
==Syntax==
<syntaxhighlight lang="typescript">
<pre>
Object vehicle.getNeonColour();
vehicle.getNeonColour();
</syntaxhighlight>  
</pre>
 
===Returns===
===Returns===
Return array containing colours.
*'''neonColours''': {{RageType|Array}} Array containing the colours.
==Array content==
** '''r''': Red [0 - 255]
* Red color in diapason 0 - 255.
** '''g''': Green [0 - 255]
* Green color in diapason 0 - 255.
** '''b''': Blue [0 - 255]
* Blue color in diapason 0 - 255.
 
==Example==
An example showing the function's use.


<syntaxhighlight lang="javascript" highlight="5">
==Example==
mp.events.addCommand(`neonich`,  
{{ServersideCode|
<pre>
mp.events.addCommand(`getneon`,  
(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