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...)
 
mNo edit summary
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>

Revision as of 18:02, 27 October 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