Vehicle::getColor: Difference between revisions

From RAGE Multiplayer Wiki
(Fixed british spelling)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Zentorno: On the client-side, this function requires three args (red: int, green: int, blue: int), and will return an object: r,g,b


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.getColor(id);</syntaxhighlight>
<pre>vehicle.getColor(id);</pre>
=== Required Arguments ===
=== Required Arguments ===
*'''id:''' int
*'''id:''' int
(0 - Primary Color, 1 - Secondary Color)
===Return value===
===Return value===
*'''integer:''' color
*'''integer:''' color
==Example==
==Example==
<syntaxhighlight lang="javascript">
<pre>
let primaryColor = player.vehicle.getColor(0)
let primaryColor = player.vehicle.getColor(0)
let secondaryColor = player.vehicle.getColor(1)
let secondaryColor = player.vehicle.getColor(1)
Line 13: Line 18:
// If the vehicle primary color was black the following would return 0
// If the vehicle primary color was black the following would return 0
console.log(primaryColor)
console.log(primaryColor)
</syntaxhighlight>
</pre>
 
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 11:33, 9 May 2024

Zentorno: On the client-side, this function requires three args (red: int, green: int, blue: int), and will return an object: r,g,b


Syntax

vehicle.getColor(id);

Required Arguments

  • id: int

(0 - Primary Color, 1 - Secondary Color)

Return value

  • integer: color

Example

let primaryColor = player.vehicle.getColor(0)
let secondaryColor = player.vehicle.getColor(1)

// If the vehicle primary color was black the following would return 0
console.log(primaryColor)

See also