Hey guys i got some problems too, i hope i can get some help here, its just not working.
if not SERVER then return end
--AutoPromote 1.0
--Automaticly promotes players to different groups based on UTime.
--By HOLOGRAPHICpizza. Released under the MIT license.
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["100"] = "msergeant",
["50"] = "sergeant",
["25"] = "1337",
["15"] = "respected",
["10"] = "VIP",
["5"] = "private",
["2"] = "builder"
}
local excludeGroups = {
"member",
"moderator",
"admin",
"superadmin"
}
--DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING--
--Checks if they are ready to be promoted.
function deathCheck(ply)
if not excludeCheck(ply) then
local newGroup = promoteCheck(ply)
promote(ply, newGroup)
end
end
hook.Add( "PlayerDeath", "deathCheck", deathCheck )
--Check if they are in an excluded group.
function excludeCheck(ply)
local excluded = false
for k, v in ipairs(excludeGroups) do
if ply:IsUserGroup(v) then
excluded = true
end
end
return excluded
end
--Check what group they fall in.
function promoteCheck(ply)
local hours = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
local newGroup = "user"
for k, v in pairs(promoteGroups) do
if hours >= tonumber(k) then
newGroup = v
end
end
return newGroup
end
--Promote the player to the group.
function promote(ply, newGroup)
if not ply:IsUserGroup(newGroup) then --Make sure we don't promote them tho their current group.
game.ConsoleCommand("ulx adduser " ..string.format("%q", ply:Nick() ).. " " ..string.format("%q", newGroup).. " \n")
end
end
Is that correct?