<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=P%C3%A9ter+Czibula</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=P%C3%A9ter+Czibula"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/P%C3%A9ter_Czibula"/>
	<updated>2026-04-21T23:09:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Rgb2hex&amp;diff=42669</id>
		<title>Rgb2hex</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Rgb2hex&amp;diff=42669"/>
		<updated>2014-10-21T19:20:00Z</updated>

		<summary type="html">&lt;p&gt;Péter Czibula: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function convert the R,G,B color codes to hexadecimal.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string rgb2Hex ( int red, int green, int blue)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Required Arguments ==&lt;br /&gt;
* red: The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
* green: The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
* blue: The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server or Clientside function&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function rgb2hex(r,g,b)&lt;br /&gt;
	&lt;br /&gt;
	local hex_table = {[10] = 'A',[11] = 'B',[12] = 'C',[13] = 'D',[14] = 'E',[15] = 'F'}&lt;br /&gt;
	&lt;br /&gt;
	local r1 = math.floor(r / 16)&lt;br /&gt;
	local r2 = r - (16 * r1)&lt;br /&gt;
	local g1 = math.floor(g / 16)&lt;br /&gt;
	local g2 = g - (16 * g1)&lt;br /&gt;
	local b1 = math.floor(b / 16)&lt;br /&gt;
	local b2 = b - (16 * b1)&lt;br /&gt;
	&lt;br /&gt;
	if r1 &amp;gt; 9 then r1 = hex_table[r1] end&lt;br /&gt;
	if r2 &amp;gt; 9 then r2 = hex_table[r2] end&lt;br /&gt;
	if g1 &amp;gt; 9 then g1 = hex_table[g1] end&lt;br /&gt;
	if g2 &amp;gt; 9 then g2 = hex_table[g2] end&lt;br /&gt;
	if b1 &amp;gt; 9 then r1 = hex_table[b1] end&lt;br /&gt;
	if b2 &amp;gt; 9 then r2 = hex_table[b2] end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;quot;#&amp;quot; .. r1 .. r2 .. g1 .. g2 .. b1 .. b2&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local color = rgb2hex(255,50,25)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;255,50,25 = &amp;quot; .. color)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;/div&gt;</summary>
		<author><name>Péter Czibula</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Rgb2hex&amp;diff=42668</id>
		<title>Rgb2hex</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Rgb2hex&amp;diff=42668"/>
		<updated>2014-10-21T19:06:18Z</updated>

		<summary type="html">&lt;p&gt;Péter Czibula: rgb to hex color converter function&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function convert the R,G,B color codes to hexadecimal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server or Clientside function&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function rgb2hex(r,g,b)&lt;br /&gt;
	&lt;br /&gt;
	local hex_table = {[10] = 'A',[11] = 'B',[12] = 'C',[13] = 'D',[14] = 'E',[15] = 'F'}&lt;br /&gt;
	&lt;br /&gt;
	local r1 = math.floor(r / 16)&lt;br /&gt;
	local r2 = r - (16 * r1)&lt;br /&gt;
	local g1 = math.floor(g / 16)&lt;br /&gt;
	local g2 = g - (16 * g1)&lt;br /&gt;
	local b1 = math.floor(b / 16)&lt;br /&gt;
	local b2 = b - (16 * b1)&lt;br /&gt;
	&lt;br /&gt;
	if r1 &amp;gt; 9 then r1 = hex_table[r1] end&lt;br /&gt;
	if r2 &amp;gt; 9 then r2 = hex_table[r2] end&lt;br /&gt;
	if g1 &amp;gt; 9 then g1 = hex_table[g1] end&lt;br /&gt;
	if g2 &amp;gt; 9 then g2 = hex_table[g2] end&lt;br /&gt;
	if b1 &amp;gt; 9 then r1 = hex_table[b1] end&lt;br /&gt;
	if b2 &amp;gt; 9 then r2 = hex_table[b2] end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;quot;#&amp;quot; .. r1 .. r2 .. g1 .. g2 .. b1 .. b2&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local color = rgb2hex(255,50,25)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;255,50,25 = &amp;quot; .. color)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;/div&gt;</summary>
		<author><name>Péter Czibula</name></author>
	</entry>
</feed>