OK Heres my auto promote thing
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"] = "No Life",
["40"] = "Legend",
["20"] = "Master",
["15"] = "Veteran",
["10"] = "VIP",
["7"] = "Highly Respected",
["5"] = "Respected",
["3"] = "Regular",
["2"] = "Pro Builder",
["1"] = "Builder",
["0"] = "user"
}
local excludeGroups = {
"minge",
"respected",
"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
Im pretty sure thats all right But when It Gets to 1 hour it never promotes
Heres my U team
"Out"
{
"teams"
{
"1"
{
"name" "SuperAdmins"
"group" "superadmin"
"armor" "1000"
"hp" "1000"
"color"
{
"a" "255"
"B" "0"
"g" "0"
"r" "153"
}
}
"2"
{
"name" "Admins"
"group" "admin"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "0"
"g" "0"
"r" "153"
}
}
"3"
{
"name" "No Life"
"group" "No Life"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "50"
"g" "50"
"r" "255"
}
}
"4"
{
"name" "Legend"
"group" "Legend"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "51"
"g" "0"
"r" "255"
}
}
"5"
{
"name" "Master"
"group" "Master"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "0"
"g" "102"
"r" "255"
}
}
"6"
{
"name" "Veteran"
"group" "Veteran"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "0"
"g" "153"
"r" "0"
}
}
"7"
{
"name" "VIP"
"group" "VIP"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "102"
"g" "0"
"r" "102"
}
}
"8"
{
"name" "Highly Respected"
"group" "Highly Respected"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "153"
"g" "51"
"r" "153"
}
}
"9"
{
"name" "Respected"
"group" "Respected"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "204"
"g" "0"
"r" "255"
}
}
"10"
{
"name" "Regular"
"group" "Regular"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "204"
"g" "0"
"r" "0"
}
}
"11"
{
"name" "Pro Builder"
"group" "Pro Builder"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "255"
"g" "153"
"r" "0"
}
}
"12"
{
"name" "Builder"
"group" "Builder"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "255"
"g" "204"
"r" "0"
}
}
"13"
{
"name" "Newbie"
"group" "user"
"color"
{
"a" "255"
"B" "0"
"g" "204"
"r" "153"
}
}
}
"gamemodes"
{
"1" "Sandbox"
"2" "SpaceBuild"
}
}
Im also using Utime
Please help