RgbToHex Shared function

From Gothic 2 Online: Wiki
Jump to navigation Jump to search

This function was added in version: 0.0.0

Calculates the hex representation of the specified color in r, g, b model.

NOTE! Returned hex color is lowercase.

Syntax

string rgbToHex(int r, int g, int b)

Required Arguments

  • r: The representative of red in RGB model.
  • g: The representative of green in RGB model.
  • b: The representative of blue in RGB model.

Returns

  • string: The function returns hexadecimal number.

Example

Server-side:

local function joinHandler(pid)
{
	sendMessageToPlayer(pid,255,255,0,"Welcome to our server!");
	sendMessageToPlayer(pid,255,255,0,"Interesting fact: the hex color of this message is " + rgbToHex(255,255,0));
}

addEventHandler("onPlayerJoin", joinHandler);

Client-side:

local function respawnHandler()
{
	print("Congratulations, you are spawned!");
	print("Did you know that the hex color of this message is " + rgbToHex(255,255,0) + "?");
}

addEventHandler("onRespawn", respawnHandler);

Related functions