Ulysses Stuff > Ulysses Release Archives
AutoPromote
jay209015:
Congrats on the release!
Something I'd like to see is a simple gui that shows remaining time until next promotion, and what group you will be promoted to :D
Another not, if you'd be interested, I'd like to see this script merged into APromotion as an addon that will promote with/without UTime.
Would only take me about five minutes to merge them if you are interested, you will get full credit for your work of course. I make this offer,
because you've done what I've planned on, but not had time to do.
Feelings wont be hurt if you choose not to, just trying to make things simple. One addon multiple solutions :D
EDIT:
- You can choose name :D
Cephalexin:
if you accepted the offer that would be cool :D
HOLOGRAPHICpizza:
Hey, this is why I chose an open-source license. You can go ahead and merge it into APromotion, just give me credit. I'm still going to keep AutoPromote up for people who know for sure they only want it with UTime and they want it to be as lightweight as possible, like me. But this is why I chose the MIT license. You are free to do whatever the heck you want with the code, just make sure I get credit. :)
JamminR:
--- Quote from: HOLOGRAPHICpizza on January 28, 2009, 12:02:05 PM ---Hey, this is why I chose an open-source license.<clip>
just give me credit.
--- End quote ---
* JamminR claps.I've used code from others before, then basically ended up totally rewriting the code to do the same function but more efficiently.
I still put in comments 'loosely based on idea by <author>'
I love collaboration and learning from others.
XbabyX:
Hey guys i got some problems too, i hope i can get some help here, its just not working.
--- 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",
["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
--- End code ---
Is that correct?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version