Made check for ext

This commit is contained in:
Cooldude2606
2020-03-27 17:54:46 +00:00
parent 701ad7cb67
commit e8f86ac054
2 changed files with 9 additions and 5 deletions

View File

@@ -74,3 +74,5 @@ home-set=Your home point has been set to x: __1__ y: __2__
return-set=Your return point has been set to x: __1__ y: __2__ return-set=Your return point has been set to x: __1__ y: __2__
home-get=Your home point is at x: __1__ y: __2__ home-get=Your home point is at x: __1__ y: __2__
[expcom-server-ups]
no-ext=No external source was found, cannot display server ups.

View File

@@ -25,6 +25,9 @@ Commands.new_command('server-ups','Toggle the server ups display')
:add_alias('sups','ups') :add_alias('sups','ups')
:register(function(player) :register(function(player)
local label = player.gui.screen[sverer_ups.name] local label = player.gui.screen[sverer_ups.name]
if not global.ext or not global.ext.server_ups then
return Commands.error{'expcom-server-ups.no-ext'}
end
label.visible = not label.visible label.visible = not label.visible
end) end)
@@ -48,12 +51,11 @@ end)
-- Update the caption for all online players -- Update the caption for all online players
Event.on_nth_tick(60,function() Event.on_nth_tick(60,function()
local caption = 'Server UPS = 60.0'
if global.ext and global.ext.server_ups then if global.ext and global.ext.server_ups then
caption = 'Server UPS = '..global.ext.server_ups local caption = 'Server UPS = '..global.ext.server_ups
end for _,player in pairs(game.connected_players) do
for _,player in pairs(game.connected_players) do player.gui.screen[sverer_ups.name].caption = caption
player.gui.screen[sverer_ups.name].caption = caption end
end end
end) end)