|
|
| Line 1: |
Line 1: |
| __NOTOC__
| | <font face="sans-serif"> |
| {{Server client function}}
| | <div style="background:#333;"> |
| This function returns the color of the specified vehicle. A vehicle can have up to four colors.
| | <div style="height:4px;background:#AAA;"></div> |
| | | <font color="#FFF" size="5"> |
| ==Syntax==
| | <p> Ваша версия Adobe Flash Player устарела</p> |
| <syntaxhighlight lang="lua"> | | </font> |
| int int int int getVehicleColor ( vehicle theVehicle )
| | <div style="background:#FFF;"> |
| </syntaxhighlight> | | <font color="#F00" size="2"> |
| {{OOP||[[vehicle]]:getColor||setVehicleColor}}
| | <p>Требуется срочное обновление до текущей версии!</p> |
| ===Required Arguments=== | | </font> |
| *'''theVehicle:''' the [[vehicle]] element.
| | <font color="#000" size="4"> |
| | | <p>Adobe Flash Player 30.0.0.164 <font color="#888" size="2">(~18 kB)</font></p> |
| ===Returns===
| | </font> |
| Returns 4 [[int|ints]] indicating the color of the vehicle. Returns ''false'' if the vehicle doesn't exist.
| | <font color="#444" size="2"> |
| | | <p><b>Операционная система:</b> Windows<br><b>Язык:</b> Выбирает пользователь</p> |
| Valid color ids:
| | </font> |
| {{Vehicle_colors}}
| | <font color="#000" size="4"> |
| <br> | | <p>Скачать обновление с Яндекс.Диска: yadi.sk/d/AfbiMAr1PkGdww</p> |
| {{New feature|3.0110|1.1|
| | </font> |
| From 1.1, as well as the above syntax, colors can also be retrieved as RGB values:
| | </div> |
| ==Syntax== | | </div> |
| <syntaxhighlight lang="lua">
| | </font> |
| int, int, int, int, int, int, int, int, int, int, int, int = getVehicleColor ( vehicle theVehicle, bool bRGB )
| |
| </syntaxhighlight> | |
| | |
| ===Required Arguments=== | |
| *'''theVehicle:''' The [[vehicle]] that you wish to get the color of.
| |
| *'''bRGB :''' A boolean specifying whether to return RGB values. A setting of ''false'' will result in the function returning color ids instead.
| |
| | |
| ===Returns===
| |
| *Returns 12 [[int|ints]] (if bRGB is ''true'') indicating the red, green and blue components of each of the 4 vehicle colors.
| |
| *Returns 4 [[int|ints]] (if bRGB is ''false'') indicating the color ids of each of the 4 vehicle colors.
| |
| *Returns ''false'' if the vehicle doesn't exist.
| |
| | |
| }}
| |
| | |
| ==Example==
| |
| <section name="Server" class="server" show="true"> | |
| This will output the 4 colors of any car that the player enters.
| |
| <syntaxhighlight lang="lua"> | |
| function playerEnterVehicle ( theVehicle, seat, jacked )
| |
| -- Get the colors of the car and store them to 4 seperate variables
| |
| local color1, color2, color3, color4 = getVehicleColor ( theVehicle )
| |
| -- Output the four retrieved car colors into the chatbox
| |
| outputChatBox ( "Car color 1: " .. color1 )
| |
| outputChatBox ( "Car color 2: " .. color2 )
| |
| outputChatBox ( "Car color 3: " .. color3 )
| |
| outputChatBox ( "Car color 4: " .. color4 )
| |
| end
| |
| addEventHandler ( "onPlayerVehicleEnter", getRootElement(), playerEnterVehicle )
| |
| </syntaxhighlight> | |
| </section> | |
| | |
| ==See Also==
| |
| {{Vehicle functions}}
| |