PL/setVehicleColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server client function}} Ta funkcja określa kolor pojazdu. Kolory są w formacie RGB, pojazdy mogą mieć maksymalnie 4 kolory. Większość pojazdów posiada tyl...")
 
No edit summary
Line 11: Line 11:
{{OOP||[[vehicle]]:setColor}}
{{OOP||[[vehicle]]:setColor}}
===Required Arguments===  
===Required Arguments===  
*'''theVehicle:''' pojazd [[Pojazd|vehicle]]
*'''theVehicle:''' ID Pojazdu ([[vehicle]]) którego chcesz ustawić kolor,
*'''r1, g1, b1:''' Three integers indicating the red, green and blue components of the first (main) color for the vehicle
*'''r1, g1, b1:''' Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy pierwszego (głównego) koloru dla danego pojazdu,
===Optional Arguments===
===Optional Arguments===
*'''r2, g2, b2:''' Three integers indicating the red, green and blue components of the second color for the vehicle
*'''r2, g2, b2:''' Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy czwartego koloru dla danego pojazdu,
*'''r3, g3, b3:''' Three integers indicating the red, green and blue components of the third color for the vehicle
*'''r3, g3, b3:''' Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy trzeciego koloru dla danego pojazdu,
*'''r4, g4, b4:''' Three integers indicating the red, green and blue components of the fourth color for the vehicle
*'''r4, g4, b4:''' Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy czwartego koloru dla danego pojazdu,
}}
}}
===Returns===
===Returns===
Returns ''true'' if vehicle's color was set, ''false'' if an invalid vehicle or invalid colors were specified.
'True' ', jeśli kolor pojazdu został ustawiony, 'false' ', jeśli nieprawidłowy pojazd lub nieprawidłowe kolory zostały określone zwroty.


==Example==  
==Example==  
<section name="Example 1" class="server" show="true">
<section name="Example 1" class="server" show="true">
This example implements a serverside ''random_color'' console command.
Ta przykładowa komenda (strona server-side) ustawia dowolny kolor pojazdu.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler( 'random_color',
addCommandHandler( 'zmienkolor',
function( uPlayer )
function( uPlayer )
if isPedInVehicle( uPlayer ) then
if isPedInVehicle( uPlayer ) then
Line 41: Line 41:
== Issues ==
== Issues ==
{{Issues|
{{Issues|
{{Issue|9033|Clientside setVehicleColor doesn't work directly after creation}}
{{Issue|9033|setVehicleColor po stronie klienta nie działa bezpośrednio po utworzeniu}}
}}
}}


==See Also==
==See Also==
{{Vehicle_functions}}
{{Vehicle_functions}}

Revision as of 20:11, 15 October 2016

Ta funkcja określa kolor pojazdu. Kolory są w formacie RGB, pojazdy mogą mieć maksymalnie 4 kolory. Większość pojazdów posiada tylko 2 kolory.

Syntax

bool setVehicleColor ( vehicle theVehicle, int r1, int g1, int b1, [int r2, int g2, int b2, int r3, int g3, int b3, int r4, int g4, int b4] )            


OOP Syntax Help! I don't understand this!

Method: vehicle:setColor(...)


Required Arguments

  • theVehicle: ID Pojazdu (vehicle) którego chcesz ustawić kolor,
  • r1, g1, b1: Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy pierwszego (głównego) koloru dla danego pojazdu,

Optional Arguments

  • r2, g2, b2: Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy czwartego koloru dla danego pojazdu,
  • r3, g3, b3: Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy trzeciego koloru dla danego pojazdu,
  • r4, g4, b4: Trzy liczby całkowite określające czerwone, zielone i niebieskie elementy czwartego koloru dla danego pojazdu,

Returns

'True' ', jeśli kolor pojazdu został ustawiony, 'false' ', jeśli nieprawidłowy pojazd lub nieprawidłowe kolory zostały określone zwroty.

Example

Click to collapse [-]
Example 1

Ta przykładowa komenda (strona server-side) ustawia dowolny kolor pojazdu.

addCommandHandler( 'zmienkolor',
	function( uPlayer )
		if isPedInVehicle( uPlayer ) then
			local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
				local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 )
				setVehicleColor( uVehicle, r, g, b )
			end
		end
	end
)

Issues

Issue ID Description
#9033 setVehicleColor po stronie klienta nie działa bezpośrednio po utworzeniu

See Also

Shared