Ulysses Stuff > Ulysses Release Archives
AutoPromote
HOLOGRAPHICpizza:
What specific problem are you having? The config looks good to me...
Make sure you have UTime and ULX installed and properly configured.
Make sure the group you want to promote to actually exists and it is possible to promote users to the group manualy.
Make sure you have completely restarted the server after installing the addon.
Make sure the user is not in an excluded group.
Remember that the script only checks hours when the player dies, and users are not promoted as soon as they hit the hour mark, they need to die first.
Post any error messages you encounter.
XbabyX:
lol my fault, he didnt get promoted because he was alive. He had to die. But thanks anyway
DiscoBiscuit:
It won't promote players for my server either...
I have ULIB and ULX installed properly, and UTime, and I made each group in ULIB's groups.txt but it still won't promote them, even after death. Here's the code:
--- Code: ---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",
["24"] = "senior"
["15"] = "legendary"
["12"] = "awesome"
["10"] = "respected"
["8"] = "1337",
["6"] = "pro",
["4"] = "builder",
["1"] = "experienced"
}
local excludeGroups = {
"moderator",
"vip",
"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
--- End code ---
HOLOGRAPHICpizza:
Sorry, I don't know what to tell you, the code looks good...
Make sure that you can promote users to the group manually.
Make sure you have completely restarted the server after installing the addon.
Make sure the user is not in an excluded group.
Post any error messages you encounter.
JamminR:
Also, make sure the player has died. Suicide works, fun "slay" initiation would work too. :)
Don't know if HolographicPizza has added any other check events, but they specifically mention death in first post.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version