Resource:Spawnmanager/getSpawnpointTeam: Difference between revisions
Jump to navigation
Jump to search
(New page: {{Server function}} __NOTOC__ This function returns the team element from a particular spawnpoint. ==Syntax== <syntaxhighlight lang="lua"> team getSpawnpointTeam ( spawnpoint spawn ) ...) |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 24: | Line 24: | ||
outString = outString .. " on a spawnpoint" | outString = outString .. " on a spawnpoint" | ||
spawnTeam = call(getResourceFromName("spawnmanager", "getSpawnpointTeam", theSpawnpoint ) | spawnTeam = call(getResourceFromName("spawnmanager"), "getSpawnpointTeam", theSpawnpoint ) | ||
if ( spawnTeam ) then | if ( spawnTeam ) then | ||
outString = outString .. " for team: " .. getTeamName ( spawnTeam ) | outString = outString .. " for team: " .. getTeamName ( spawnTeam ) | ||
Latest revision as of 20:33, 31 December 2007
This function returns the team element from a particular spawnpoint.
Syntax
team getSpawnpointTeam ( spawnpoint spawn )
Required Arguments
- spawn: A valid spawnpoint element.
Returns
If the spawnpoint given is valid and has a team, it returns a team element representing the team players will join when spawning there, false otherwise.
Example
This example outputs which team, if any, the spawnpoint is associated with when a player spawns.
function checkPlayerSpawn ( theSpawnpoint )
local outString = "Player spawned"
local spawnTeam
if ( theSpawnpoint ) then
outString = outString .. " on a spawnpoint"
spawnTeam = call(getResourceFromName("spawnmanager"), "getSpawnpointTeam", theSpawnpoint )
if ( spawnTeam ) then
outString = outString .. " for team: " .. getTeamName ( spawnTeam )
end
end
outString = outString .. "."
outputChatBox ( outString )
end
addEventHandler ( "onPlayerSpawn", getRootElement(), checkPlayerSpawn )