Scripting/Squirrel/Functions/Textdraw.SetPosForAll

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

This function will set the position of the textdraw on everyone's screen.

Syntax

Textdraw.SetPosForAll(x, y);

Arguments

  • int x - The new x position of the textdraw on the screen.
  • int y - The new y position of the textdraw on the screen.

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 == "textsetposall" ) // Command for setting the textdraw position for every player that has it shown.
	{
		Textdraw.SetPosForAll(50, 50); // sets the x & y pos to 50 for everyone.

	}
}

Notes

onScriptLoad, onPlayerCommand, Textdraw.ShowForAll and CreateTextdraw were used in this example. More info about them in the corresponding pages.

Related Functions