Resource:Spawnmanager/getSpawnpointRotation

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function returns the current rotation of the specified spawnpoint.

Syntax

float getSpawnpointRotation ( spawnpoint theSpawn )             

Required Arguments

  • theSpawn: The spawnpoint element to get rotation of.

Returns

Returns the rotation as a float if the spawnpoint is valid, false otherwise.

Example

This example outputs the rotation associated with a spawnpoint when a player spawns.

function checkPlayerSpawn ( theSpawnpoint )
	local outString = "Player spawned"
	local spawnRotation
		
	if ( theSpawnpoint ) then
		outString = outString .. " on a spawnpoint"
		
		spawnRotation = call(getResourceFromName("spawnmanager"), "getSpawnpointRotation", theSpawnpoint )
		if ( spawnRotation ) then
			outString = outString .. " with rotation: " .. tostring(spawnRotation)
		end
	end
	
	outString = outString .. "."
	outputChatBox ( outString )
end
addEventHandler ( "onPlayerSpawn", getRootElement(), checkPlayerSpawn )