Scripting/Squirrel/Functions/cRGB: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
ProsuWANTED (talk | contribs) (Uppercase fix & better example.) |
ProsuWANTED (talk | contribs) m (Changed Color to RGB.) |
||
Line 19: | Line 19: | ||
{ | { | ||
MessagePlayer("You're now red!", player); | MessagePlayer("You're now red!", player); | ||
player.Color = | player.Color = RGB(255, 0, 0); | ||
} | } | ||
else if ( cmd == "green" ) | else if ( cmd == "green" ) | ||
{ | { | ||
MessagePlayer("You're now green!", player); | MessagePlayer("You're now green!", player); | ||
player.Color = | player.Color = RGB(0, 255, 0); | ||
} | } | ||
else if ( cmd == "blue" ) | else if ( cmd == "blue" ) | ||
{ | { | ||
MessagePlayer("You're now blue!", player); | MessagePlayer("You're now blue!", player); | ||
player.Color = | player.Color = RGB(0, 0, 255); | ||
} | } | ||
} | } |
Revision as of 16:45, 2 July 2015
Creates an instance and returns the pointer.
Syntax
RGB( r, g, b )
Arguments
- int r - Red
- int g - Green
- int 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.