Scripting/Server/Functions/CreateCinema

(v0.5-rc3+) Creates a cinema screen: a flat screen in the 3D world that plays a video. x, y, z is the CENTRE of the screen, heading the direction it faces in degrees (like player.Angle: stand in front of it to see it), width x height its size in metres (give it the aspect of the video, 3.2 x 1.8 or 6.4 x 3.6 for 16:9: the picture is stretched over the whole screen). hearDistance (default 80 m) is how far away the sound is heard; players only download the stream while they are within that distance plus 10 m. Up to 8 screens. Players who join later get the screens that exist. See the Cinema chapter in CINEMA.md.

Syntax

CreateCinema(x, y, z, heading, width, height[, hearDistance])

Arguments

Returns

integer (the screen id 0..7, -1 when all 8 are in use)

Example

// a 6.4 x 3.6 m screen, 9 m in front of the player, facing him; ffmpeg (and yt-dlp for web pages) must sit next to the server
cinema <- -1;

function onPlayerCommand( player, cmd, text )
{
	if ( cmd == "cinema" )
	{
		local p = player.Pos;
		local a = player.Angle * 3.14159265 / 180.0;
		cinema = CreateCinema( p.x - sin( a ) * 9.0, p.y + cos( a ) * 9.0, p.z + 2.5, player.Angle + 180.0, 6.4, 3.6 );
		PlayCinema( cinema, text );        // /cinema https://www.youtube.com/watch?v=...
	}
	else if ( cmd == "stopcinema" ) StopCinema( cinema );
}

Section: World settings

Categories: Server functions | World settings