88 lines
4.3 KiB
Text
88 lines
4.3 KiB
Text
|
--@name
|
||
|
--@author
|
||
|
--@server
|
||
|
|
||
|
do
|
||
|
-- Probably move this at some point
|
||
|
local function getEntCount(ply)
|
||
|
local ents = find.all(function(thing)
|
||
|
if thing:getOwner() == ply then
|
||
|
return thing
|
||
|
end
|
||
|
end)
|
||
|
return #ents
|
||
|
end
|
||
|
|
||
|
local function getPlyInfo(args)
|
||
|
local target = core:get_entity(args[1])
|
||
|
if target == nil then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
core:log(log.TEXT, "-------------------------")
|
||
|
core:log(log.INFO, "Name: ", core.colors.text, target:getName())
|
||
|
core:log(log.INFO, "SteamID: ", core.colors.text, target:getSteamID())
|
||
|
core:log(log.INFO, "Profile: ", core.colors.text, "https://steamcommunity.com/profiles/"..target:getSteamID64())
|
||
|
core:log(log.INFO, "")
|
||
|
|
||
|
core:log(log.INFO, "Ping: ", core.colors.text, target:getPing().."ms")
|
||
|
local time = string.formattedTime(target:getTimeConnected())
|
||
|
core:log(log.INFO, "Time Connected: ", core.colors.text, time["h"].."h "..time["m"].."m "..time["s"].."s")
|
||
|
core:log(log.INFO, "Ent Count: ", core.colors.text, getEntCount(target))
|
||
|
|
||
|
core:log(log.INFO, "HP/Armor: ", core.colors.text, target:getHealth().."|"..target:getArmor().." ("..math.round(target:getHealth()*100/target:getMaxHealth()).."%|"..math.round(target:getArmor()*100/target:getMaxArmor()).."%)")
|
||
|
core:log(log.INFO, "K/D: ", core.colors.text, target:getFrags().."/"..target:getDeaths().." ("..math.round(target:getFrags()/target:getDeaths(),3)..")")
|
||
|
core:log(log.INFO, "Team: ", team.getColor(target:getTeam()), target:getTeamName())
|
||
|
if target:getActiveWeapon():getClass() == "gmod_tool" then
|
||
|
core:log(log.INFO, "Toolgun: ", core.colors.text, target:getActiveWeapon():getToolMode())
|
||
|
else
|
||
|
core:log(log.INFO, "Weapon: ", core.colors.text, target:getActiveWeapon():getClass().." ("..target:getActiveWeapon():clip1().."/"..target:getAmmoCount(target:getActiveWeapon():getPrimaryAmmoType())..")")
|
||
|
end
|
||
|
core:log(log.INFO, "")
|
||
|
|
||
|
-- Shit DarkRP and old SF check
|
||
|
if xpcall(function() target:getMoney() return true end, function() return false end) then
|
||
|
core:log(log.INFO, "Money: ", core.colors.text, darkrp.formatMoney(target:getMoney()))
|
||
|
if target:isWanted() then
|
||
|
core:log(log.INFO, "Wanted Reason: ", core.colors.text, target:getWantedReason())
|
||
|
end
|
||
|
core:log(log.INFO, "")
|
||
|
end
|
||
|
|
||
|
local tags = ""
|
||
|
tags = tags .. (target:isBot() and "Bot " or "")
|
||
|
tags = tags .. (target:isSuperAdmin() and "Superadmin " or "")
|
||
|
tags = tags .. ((target:isAdmin() and not target:isSuperAdmin()) and "Admin " or "")
|
||
|
tags = tags .. (target:inVehicle() and "InVehicle " or "")
|
||
|
tags = tags .. (target:hasGodMode() and "Godmode " or "")
|
||
|
tags = tags .. (target:isNoclipped() and "Noclip " or "")
|
||
|
tags = tags .. (target:isFrozen() and "Frozen " or "")
|
||
|
tags = tags .. (target:isTimingOut() and "Lagging " or "")
|
||
|
tags = tags .. (not target:isAlive() and "Dead " or "")
|
||
|
tags = tags .. (target:isTimingOut() and "Lagging " or "")
|
||
|
if xpcall(function() target:getMoney() return true end, function() return false end) then
|
||
|
tags = tags .. (target:isWanted() and "Wanted " or "")
|
||
|
tags = tags .. (target:isArrested() and "RPArrest " or "")
|
||
|
tags = tags .. (target:isChief() and "CPChief " or "")
|
||
|
tags = tags .. ((target:isCP() and not target:isChief()) and "CP " or "")
|
||
|
tags = tags .. (target:isHitman() and "Hitman " or "")
|
||
|
tags = tags .. (target:isMayor() and "Mayor " or "")
|
||
|
tags = tags .. (target:isMedic() and "Medic " or "")
|
||
|
end
|
||
|
|
||
|
core:log(log.INFO, "Misc: ", core.colors.text, string.trim(tags))
|
||
|
core:log(log.TEXT, "-------------------------")
|
||
|
end
|
||
|
|
||
|
core.modules.playerinfo = {
|
||
|
version = 1,
|
||
|
desc = "Provides information about a player on the server.",
|
||
|
commands = {
|
||
|
plyinfo = {
|
||
|
usage = "plyinfo <name>",
|
||
|
desc = "Prints information about a player on the server.",
|
||
|
func = getPlyInfo,
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
end
|