Scripting/Squirrel/Functions/cRGB: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Scripting/Needs_Text}}
Creates an instance and returns the pointer.


== Syntax ==
== Syntax ==


<pre>RGB( R, G, B )</pre>
<pre>RGB( r, g, b )</pre>


== Arguments ==
== Arguments ==


* ''int'' '''R''' - Red
* ''int'' (''byte'') '''r''' - Red
* ''int'' '''G''' - Green
* ''int'' (''byte'') '''g''' - Green
* ''int'' '''B''' - Blue
* ''int'' (''byte'') '''b''' - Blue


== Example ==
== Example ==
<source>
 
function onPlayerJoin( player )
<source lang="squirrel">
function onPlayerCommand( player, cmd, text )
{
{
MessagePlayer("[#CE0C77] Hello, welcome to the server",player);
if( cmd == "red" )
{
MessagePlayer("You're now red!", player);
player.Color = RGB(255, 0, 0);
}
else if ( cmd == "green" )
{
MessagePlayer("You're now green!", player);
player.Color = RGB(0, 255, 0);
}
else if ( cmd == "blue" )
{
MessagePlayer("You're now blue!", player);
player.Color = RGB(0, 0, 255);
}
}
}
</source>
</source>
=== Notes ===
=== Notes ===
Call [[onPlayerCommand]] was used in this example. More info in the page.


== Related Functions ==
== Related Functions ==


{{Scripting/Squirrel/Functions/Data Structures}}
{{Scripting/Squirrel/Functions/Data Structures}}
[[Category:Scripting/Squirrel/Functions/Data_Structures]]

Latest revision as of 18:01, 30 January 2017

Creates an instance and returns the pointer.

Syntax

RGB( r, g, b )

Arguments

  • int (byte) r - Red
  • int (byte) g - Green
  • int (byte) b - Blue

Example

function onPlayerCommand( player, cmd, text )
{
	if( cmd == "red" )
	{
		MessagePlayer("You're now red!", player);
		player.Color = RGB(255, 0, 0);
	} 
	else if ( cmd == "green" ) 
	{
		MessagePlayer("You're now green!", player);
		player.Color = RGB(0, 255, 0);
	}
	else if ( cmd == "blue" ) 
	{
		MessagePlayer("You're now blue!", player);
		player.Color = RGB(0, 0, 255);
	}
}

Notes

Call onPlayerCommand was used in this example. More info in the page.

Related Functions