I'm trying to create a plugin that logs players on connect.
This is what I have, but I'm just starting out with this... xD
function LogPlayer_OnClientConnect(player,name,reset,channelId)
local player=g_gameRules.game:GetPlayerByChannelId(tonumber(channelId));
local profileId=player.profile;
local host=player.host;
if(player)then
if(profileId~=nil)then
local f,err=io.open(SafeWriting.GlobalStorageFolder.."PlayerLog.txt","a+");
if(f)then
f:seek("end");
f:write("Connection: "..player:GetName().."["..player.profile..","..player.host.."] \n");
for i,v in pairs({profileId})do
f:write(" "..i..". - "..tostring(v).."\n");
end
f:close();
end
end
end
end
SafeWriting.FuncContainer:AddFunc(LogPlayer_OnClientConnect,"ClientConnect");
❤️ 0