Resource:Spawnmanager/getSpawnpointSkin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ This function returns the ID of the current skin from a particular spawnpoint. ==Syntax== <syntaxhighlight lang="lua"> int getSpawnpointSkin ( spawnpoint spawn ) </syntaxhighlight> ==...)
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
This function returns the ID of the current skin from a particular spawnpoint.   
This function returns the ID of the current skin from a particular spawnpoint.   


Line 23: Line 24:
outString = outString .. " on a spawnpoint"
outString = outString .. " on a spawnpoint"
spawnSkin = call(getResourceFromName("spawnmanager", "getSpawnpointSkin", theSpawnpoint )
spawnSkin = call(getResourceFromName("spawnmanager"), "getSpawnpointSkin", theSpawnpoint )
if ( spawnSkin ) then
if ( spawnSkin ) then
outString = outString .. " with skin: " .. tostring(spawnSkin)
outString = outString .. " with skin: " .. tostring(spawnSkin)

Latest revision as of 20:33, 31 December 2007

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 )