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.


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.


  • string: The function returns hexadecimal number.



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);


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