Added ExpGamingPlayer.playerList

This commit is contained in:
Cooldude2606
2018-07-21 21:17:35 +01:00
parent 5f0872100e
commit 8e0ae8c2de
8 changed files with 101 additions and 35 deletions

View File

@@ -1,39 +0,0 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
function get_allowed_afk_time(player)
local rank = Ranking.get_rank(player)
local count = #game.connected_players
local base = rank.base_afk_time or false
if not base then return false end
return (base/5)*count
end
Event.register(-1,function(event)
Server.new_thread{
name='afk-kick',
}:on_event('tick',function(self)
if (game.tick%3600) ~= 0 then return end
for _,player in pairs(game.connected_players) do
local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player)
if afk then
if player.afk_time > afk*3600 then game.kick_player(player,'AFK For Too Long ('..math.floor(afk)..' Minutes)') end
end
end
end):on_event('error',function(self,err)
Sync.emit_embeded{
title='Auto Kick Error',
color=Color.to_hex(defines.text_color.bg),
description='Auto Kick Error - Closed Thread',
Error=err
}
self:close()
end):open()
end)

View File

@@ -1,40 +0,0 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
function get_player_info(player,frame,add_cam)
local player = Game.get_player(player)
if not player then return {} end
local _player = {}
_player.index = player.index
_player.name = player.name
_player.online = player.connected
_player.tag = player.tag
_player.color = player.color
_player.admin = player.admin
_player.online_time = player.online_time
_player.rank = Ranking.get_rank(player).name
_player.group = Ranking.get_group(player).name
if frame then
local frame = frame.add{type='frame',direction='vertical',style='image_frame'}
frame.style.width = 200
frame.style.height = 275
frame.add{type='label',caption={'player-info.name',_player.index,_player.name},style='caption_label'}
local _online = {'player-info.no'}; if _player.online then _online = {'player-info.yes'} end
frame.add{type='label',caption={'player-info.online',_online,tick_to_display_format(_player.online_time)}}
local _admin = {'player-info.no'}; if _player.admin then _admin = {'player-info.yes'} end
frame.add{type='label',caption={'player-info.admin',_admin}}
frame.add{type='label',caption={'player-info.group',_player.group}}
frame.add{type='label',caption={'player-info.rank',_player.rank}}
if add_cam then
Gui.cam_link{entity=player.character,frame=frame,width=200,height=150,zoom=0.5,respawn_open=true}
end
end
return _player
end