Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: t3hub3rz on November 12, 2009, 06:22:22 PM

Title: my Autopromote Wont promote!
Post by: t3hub3rz on November 12, 2009, 06:22:22 PM
OK Heres my auto promote thing

Code: [Select]
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
Code: [Select]
"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


Title: Re: my Autopromote Wont promote!
Post by: JamminR on November 12, 2009, 06:49:51 PM
Ulib uses no lower case group names.
Also, do you even have groups matching those in ULib/ULX?
Title: Re: my Autopromote Wont promote!
Post by: t3hub3rz on November 12, 2009, 06:53:40 PM
so just make all my groups lowercase?
Title: Re: my Autopromote Wont promote!
Post by: JamminR on November 12, 2009, 06:57:47 PM
In both files you show, yes.
Uteam can keep the 'name' with capital letters, but the actual group = must be lowercase.
Make sure you've used ULX or edited the groups.txt file for ULib to actually add those groups too.
You can't just pull them out of thin air.
Title: Re: my Autopromote Wont promote!
Post by: t3hub3rz on November 13, 2009, 06:36:46 PM
It still wont promote

Do i have to delete the

garrysmod/addons/AutoPromote/lua/autorun/server/Uteam.lua

because it might interfere with the other Uteam.lua

IN

/orangebox/garrysmod/lua/autorun/Uteam.lua

so Yea?
Title: Re: my Autopromote Wont promote!
Post by: JamminR on November 13, 2009, 08:53:09 PM
I've no idea. Not used the script before.
Also, two authors have collaborated to improve autopromote.
See http://forums.ulyssesmod.net/index.php/topic,3826.msg16337.html#msg16337 for v2
Ask for help in there.
Make sure you have ULib and ULX installed and it's groups set correctly to match the ones you specify.
Make sure Uteam is tracking times correctly.