FDA, Here's the second part to the lua for spawn point control you asked for.
The starting spawn point should be named
spawn0. All the others in different arenas should be named spawn1, spawn2, ect. The players can switch between arenas with the '!arena [number]' chat command. For example
!arena 3 will put them in arena 3 and continue to spawn them there until they change their arena. If you have more or less than 6 arenas then change the
ARENA_NUM variable to how many you have. If you have any issues, send me a PM.
Code:
player_table = {}
ARENA_NUM = 6 -- Increase this number if you want more spawn points.
function player_connected( player )
player_table[player:GetId()] = { arena = 0 }
end
base_spawn = info_ff_teamspawn:new({ arena_number = 0, validspawn = function(self,player)
return player:GetTeamId() == Team.kRed or player:GetTeamId() == Team.kBlue and self.arena_number == player_table[player:GetId()].arena
end })
-- For setting a spawnpoint Use spawn1, spawn2, ect.
-- Use Spawn0 as the inital spawn point.
for i = 0, ARENA_NUM do
_G["spawn"..i] = base_spawn:new({ arena_number = i })
end
function player_onchat( player, chatstring )
local player = CastToPlayer( player )
-- string.gsub call removes all control characters (newlines, return carriages, etc)
-- string.sub call removes the playername: part of the string, leaving just the message
local message = string.sub( string.gsub( chatstring, "%c", "" ), string.len(player:GetName())+3 )
for i = 1, ARENA_NUM do
if message == "!arena "..i then
ChatToPlayer(player, "Sending you to Arena "..tostring(i))
player_table[player:GetId()].arena = i
ApplyToPlayer(player, { AT.kRespawnPlayers })
return false
end
end
return true
end