Resource:Spawnmanager/getSpawnpointRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
outString = outString .. " on a spawnpoint"
outString = outString .. " on a spawnpoint"
spawnRotation = call(getResourceFromName("spawnmanager", "getSpawnpointRotation", theSpawnpoint )
spawnRotation = call(getResourceFromName("spawnmanager"), "getSpawnpointRotation", theSpawnpoint )
if ( spawnRotation ) then
if ( spawnRotation ) then
outString = outString .. " with rotation: " .. tostring(spawnRotation)
outString = outString .. " with rotation: " .. tostring(spawnRotation)

Latest revision as of 20:33, 31 December 2007

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 )