Scripting/Squirrel/Functions/CreateTextdraw
This wiki is using an old backup from 2020
Some information may be old/missing
This function will create a text that can be shown on the players screen. You have to use Textdraw.ShowForPlayer or Textdraw.ShowForAll to display it on the screen.
Syntax
CreateTextdraw( text, x, y, color);
Arguments
- str text - The text string displayed.
- int x - The x position of the textdraw on the screen.
- int y - The y position of the textdraw on the screen.
- hex color - The hex value of a color.
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;
}
CreateTextdraw( "Text here", x, y, Color);
}
Notes
onScriptLoad were used in this example. More info about them in the corresponding pages.