Resource:Spawnmanager/getSpawnpointSkin

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 ID of the current skin from a particular spawnpoint.

Syntax

int getSpawnpointSkin ( spawnpoint spawn )              

Required Arguments

  • spawn: A valid spawnpoint element.

Returns

Returns an int containing the skin ID if the spawnpoint exists, false otherwise.

Example

This example outputs the skin, if any, associated with a spawnpoint when a player spawns.

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