So basically, if a user matches a certain criteria to be a regular on my server, I add them to the regular group:
hook.Add( "PlayerInitialSpawn", "MAWTTTRegularInitialSpawn", function(p)
local uid = p:UniqueID()
local row = sql.QueryRow( "SELECT totaltime FROM utime WHERE player = " .. uid .. ";" )
if not row then
return
end
local totaltime = row.totaltime
if (p:IsUserGroup("user") and not p:IsUserGroup("regular")) and tonumber(totaltime) > 172000 then
-- p:SetUserGroup("regular")
ucl.addUser(uid, {}, {}, "regular")
PrintMessage(HUD_PRINTTALK, "Congratulations " .. p:GetName() .. "! You have been promoted to a regular for playing a day on the server.")
elseif p:IsUserGroup("regular") and tonumber(totaltime) < 172000 then
-- p:SetUserGroup("user")
ucl.removeUser(uid)
PrintMessage(HUD_PRINTTALK, p:GetName() .. " has lost regular status for not playing on the server a day.")
end
end)
But it is not saving the user to the users.txt file. How do I fix ULX to save users after adding them to groups with a script?