Resource:Spawnmanager/setSpawnpointSkin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} This function sets the skin that players will spawn with when they spawn at the specified spawnpoint. ==Syntax== <syntaxhighlight lang="lua"> bool setSpawnpointSkin ( spaw...)
 
 
(One intermediate revision by the same user not shown)
Line 23: Line 23:
for index, spawn in ipairs (allSpawnpoints) do
for index, spawn in ipairs (allSpawnpoints) do
     -- change the spawn skin to 27
     -- change the spawn skin to 27
     call(getResourceFromName("spawnmanager", "setSpawnpointSkin", spawn, 27 )
     call(getResourceFromName("spawnmanager"), "setSpawnpointSkin", spawn, 27 )
end
end
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 20:33, 31 December 2007

This function sets the skin that players will spawn with when they spawn at the specified spawnpoint.

Syntax

bool setSpawnpointSkin ( spawnpoint theSpawnpoint, int skin )

Required Arguments

  • theSpawnpoint: The spawnpoint you want to change skin of.
  • skin: An int corresponding to the ID of the desired skin. See Character Skins.

Returns

Returns true if the skin was successfully set, false if invalid arguments were passed.

Example

This code alters all existing spawnpoints so everyone spawns as construction workers.

-- get a table of all spawnpoints
local allSpawnpoints = getElementsByType("spawnpoint")
-- for each spawnpoint,
for index, spawn in ipairs (allSpawnpoints) do
    -- change the spawn skin to 27
    call(getResourceFromName("spawnmanager"), "setSpawnpointSkin", spawn, 27 )
end