tweak: cleanup server-data

This commit is contained in:
Ethan Wood
2026-08-24 16:14:13 +01:00
parent e265cb251c
commit bfc8ccb8e9
62 changed files with 59 additions and 157362 deletions
@@ -216,70 +216,54 @@ AddEventHandler('onResourceStop', function(resource)
unloadMap(resource)
end)
AddEventHandler('rconCommand', function(commandName, args)
if commandName == 'map' then
if #args ~= 1 then
RconPrint("usage: map [mapname]\n")
end
if not maps[args[1]] then
RconPrint('no such map ' .. args[1] .. "\n")
CancelEvent()
return
end
if currentGameType == nil or not doesMapSupportGameType(currentGameType, args[1]) then
local map = maps[args[1]]
local count = 0
local gt
for type, flag in pairs(map.gameTypes) do
if flag then
count = count + 1
gt = type
end
end
if count == 1 then
print("Changing map from " .. getCurrentMap() .. " to " .. args[1] .. " (gt " .. gt .. ")")
changeGameType(gt)
changeMap(args[1])
RconPrint('map ' .. args[1] .. "\n")
else
RconPrint('map ' .. args[1] .. ' does not support ' .. currentGameType .. "\n")
end
CancelEvent()
return
end
changeMap(args[1])
RconPrint('map ' .. args[1] .. "\n")
CancelEvent()
elseif commandName == 'gametype' then
if #args ~= 1 then
RconPrint("usage: gametype [name]\n")
end
if not gametypes[args[1]] then
RconPrint('no such gametype ' .. args[1] .. "\n")
CancelEvent()
return
end
changeGameType(args[1])
RconPrint('gametype ' .. args[1] .. "\n")
CancelEvent()
RegisterCommand("map", function(source, args)
if #args ~= 1 then
print("usage: map [mapname]")
return
end
if not maps[args[1]] then
print('no such map ' .. args[1] .. '\n')
return
end
if currentGameType == nil or not doesMapSupportGameType(currentGameType, args[1]) then
local map = maps[args[1]]
local count = 0
local gt
for type, flag in pairs(map.gameTypes) do
if flag then
count = count + 1
gt = type
end
end
if count == 1 then
print("Changing map from " .. getCurrentMap() .. " to " .. args[1] .. " (gt " .. gt .. ")")
changeGameType(gt)
changeMap(args[1])
print('map ' .. args[1] .. "\n")
else
print('map ' .. args[1] .. ' does not support ' .. currentGameType .. "\n")
end
end
end, true)
RegisterCommand("gametype", function(source, args)
if #args ~= 1 then
print("usage: gametype [name]\n")
return
end
if not gametypes[args[1]] then
print('no such gametype ' .. args[1] .. "\n")
return
end
changeGameType(args[1])
print('gametype ' .. args[1] .. "\n")
end)
function getCurrentGameType()