Scripting/Squirrel/Functions/Textdraw.SetColourForAll: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "This function will set a new color for the textdraw on everyone's screen. == Syntax == <pre>Textdraw.SetColourForAll(Colour);</pre> == Arguments == * ''hex'' '''color''' -...") |
(→Syntax) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
== Syntax == | == Syntax == | ||
<pre>Textdraw.SetColourForAll( | <pre>Textdraw.SetColourForAll(color);</pre> | ||
== Arguments == | == Arguments == | ||
Line 64: | Line 64: | ||
} | } | ||
SetColourForAll( Color ); // Sets the color for everyone | Textdraw.SetColourForAll( Color ); // Sets the color for everyone | ||
} | } |
Latest revision as of 11:53, 12 March 2016
This function will set a new color for the textdraw on everyone's screen.
Syntax
Textdraw.SetColourForAll(color);
Arguments
- hex color - The new color of the textdraw in hex.
Example
function onScriptLoad()
{
local x = 100; // The x coodinate for the textdraw on the screen.
local y = 100; // The y coodinate for the textdraw on the screen.
local Color; // The color
switch(Random(1,5)) // Selects a random color
{
case 1:
Color = 0xFFFFFFFF; // Color white
break;
case 2:
Color = 0xFFFF0000; // Color red
break;
case 3:
Color = 0xFF00FF00; // Color green
break;
case 4:
Color = 0xFFFFFF00; // Color yellow
break;
case 5:
Color = 0xFF00BFFF; // Color blue
break;
}
Textdraw <- CreateTextdraw( "Text here", x, y, Color); // Creates a textdraw with a random color
Textdraw.ShowForAll(); // Shows the textdraw for all players.
}
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "randomtextcolor" ) // Command for setting a random textdraw color for everyone
{
local Color; // The color
switch(Random(1,5)) // Selects a random color
{
case 1:
Color = 0xFFFFFFFF; // Color white
break;
case 2:
Color = 0xFFFF0000; // Color red
break;
case 3:
Color = 0xFF00FF00; // Color green
break;
case 4:
Color = 0xFFFFFF00; // Color yellow
break;
case 5:
Color = 0xFF00BFFF; // Color blue
break;
}
Textdraw.SetColourForAll( Color ); // Sets the color for everyone
}
}
Notes
onScriptLoad, onPlayerCommand, Textdraw.ShowForAll and CreateTextdraw were used in this example. More info about them in the corresponding pages.