Resource:Spawnmanager/setSpawnpointSkin

From Multi Theft Auto: Wiki
Revision as of 20:33, 31 December 2007 by Talidan (talk | contribs) (Spawnmanager/setSpawnpointSkin moved to Resource:Spawnmanager/setSpawnpointSkin)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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