Team Spartan Cookies & Milk Forums
Player:PlayerInfo() - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Player:PlayerInfo() (/thread-3370.html)



Player:PlayerInfo() - TheDeadScythe - 09-07-2020

Hello,
Would it be to have a function to be able to have all the statistics of a person (health,armor,AFk,maxspeed,maxhealth,nick,jumpPower,...) or just a function to see if he is AFK

thx


RE: Player:PlayerInfo() - The17thDoctor - 09-07-2020

Just make a function you can call that returns a table with all the values by adding every single functions results to it.


RE: Player:PlayerInfo() - The17thDoctor - 09-07-2020

Here is a function that adds all of what you could ever possibly use for a player, there's not everything, but its in fact so much as of now.

local Player = starfall.getTypeDef("Player")

function Player:getAllInfos()
return {
Health = self:health(),
Armor = self:armor(),
Alive = self:alive(),
Crouching = self:crouching(),
Deaths = self:deaths(),
EyeTrace = self:eyeTrace(),
AimEntity = self:aimEntity(),
AimPos = self:aimPos(),
EyePos = self:eyePos(),
EyeAng = self:eyeAngles(),
FOV = self:fov(),
Frags = self:frags(),
Team = {Name=self:getUserGroup(),NiceName=self:teamName(),Color=self:getTeamColor()},
Name = self:name(),
SteamID = selfConfusedteamID(),
SteamID64 = selfConfusedteamID64(),
Ping = self:ping(),
RunSpeed = self:runSpeed(),
IsAdmin = self:isAdmin(),
IsSuperAdmin = self:isSuperAdmin(),
}
end

Quite a useless function though as it is. I'd suggest you filtering much of the information you're using, otherwise it's lost quota for nothing.


RE: Player:PlayerInfo() - TheDeadScythe - 09-07-2020

but it would mostly be to find out if he was afk


RE: Player:PlayerInfo() - The17thDoctor - 09-07-2020

You could just make for each player a timer counting up that resets everytime they press a key.