Ulysses
Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: HOLOGRAPHICpizza on January 14, 2009, 07:51:18 PM
-
AutoPromote is a lightweight UTime-integrated alternative to other promotion systems such as APromotion.
UTime and ULX are requred for this addon to operate.
To install, extract the AutoPromote folder to C:\Program Files\Steam\steamapps\<username>\garrysmod\garrysmod\addons\
Configuration options are at the top of AutoPromote/lua/ulx/modules/AutoPromote.lua
This addon is realeased under the MIT license, which gives you the right to use, distribute, and modify as long as you give me credit.
Version 3.1 includes a variety of bugfixes and improvements by me, Major_Pain, and Smithy.
(http://www.garrysmod.org/img/?t=dll&id=87218) (http://www.garrysmod.org/downloads/?a=view&id=87218)
-
Very cool work! Interesting that you chose to build it off UTime, but it does seem like the two go hand-in-hand. :)
-
it won't promote my users after they have passed the three hours mark, what am i doing wrong?
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",
["72"] = "member",
["48"] = "vip",
["24"] = "highlyrespected",
["12"] = "respected",
["6"] = "regular",
["3"] = "builder",
["0"] = "user",
}
local excludeGroups = {
"owner",
"admin",
"superadmin",
}
-
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.
Try changing the config section to look like this:
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["72"] = "member",
["48"] = "vip",
["24"] = "highlyrespected",
["12"] = "respected",
["6"] = "regular",
["3"] = "builder"
}
Note the lack of the users group and the lack of a comma after the last entry.
Also, please post any error messages you get.
-
That seemed to fix it...thanks, dude
you da man
-
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
-
if you accepted the offer that would be cool :D
-
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. :)
-
Hey, this is why I chose an open-source license.<clip>
just give me credit.
/me 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.
-
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?
-
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.
-
lol my fault, he didnt get promoted because he was alive. He had to die. But thanks anyway
-
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:
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
-
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.
-
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.
-
Oh nevermind I forgot the commas, now it works.
Well crap, it seems to be broken AGAIN.
here's the code, it just won't promote people past anything pro
i also manually did it but it changed them back when they died
-- ["hours"] = "group",
["24"] = "senior",
["15"] = "legendary",
["12"] = "awesome",
["10"] = "respected",
["8"] = "1337",
["6"] = "pro",
["3"] = "builder",
["1"] = "experienced"
}
local excludeGroups = {
"moderator",
"vip",
"admin",
"superadmin",
"owner",
}
-
Sorry for the bump/doublepost thing but people on my server are nagging about it >.>
-
Your previous post was several hours after the author of this mod was last active.
Bumping does no good if they didn't even see the first post.
"Last Active: February 22, 2009, 02:12:07 PM"
Check the profile and see if they provide an email address or other means of contact.
Perhaps leave a quick PM, as they may have 'email me if I get a PM' feature turned on.
-
Has someone this plugin installed and fully working at the moment ?
I am really interested in, but I want it to work perfectly after installation.
-
I suppose we have to wait till some hero comes and fixes it for us as the writer isn't going to be able to fix it any time soon :(
-
Test this and let me know.
-
Yay it works like a dream. Thanks again Jay XD
-
Test this and let me know.
Thanks a lot! :)
-
You're welcome.
-
It seems it's broken again. :-[
Here is my lua file :
if not SERVER then return end
--AutoPromote 1.1
--Automaticly promotes players to different groups based on UTime.
--By HOLOGRAPHICpizza. Released under the MIT license.
--Update By: Jay209015
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["36"] = "heromember",
["32"] = "platinummember",
["28"] = "goldmember",
["24"] = "silvermember",
["20"] = "bronzemember",
["16"] = "member",
["12"] = "highlyrespected",
["8"] = "respected",
["4"] = "builder",
["2"] = "newbie"
}
-- Groups not touched by the script
local excludeGroups = {
"mingebag",
"miniadmin",
"admin",
"superadmin"
}
--DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING--
--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
--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
--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
--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 )
It worked when I put exactly this file before, I didn't make any change.
Edit : The problem will be harder to find. :'(
It stops promoting when the user is in the " Respected " group. I tried to " promote " a guy to " builders ", then he killed himself, and he has been promoted back to " Respected ". I don't know why, but it stops promoting after " Respected ". This guy has more than 8 hours of playing.
This is my " groups.txt " file :
"superadmin"
{
"deny"
{
}
"allow"
{
"ulx hiddenecho"
"ulx rcon"
"ulx luarun"
"ulx cexec"
"ulx ent"
"ulx adduser"
"ulx adduserid"
"ulx removeuser"
"ulx userallow"
"ulx userdeny"
"ulx addgroup"
"ulx removegroup"
"ulx groupallow"
"ulx groupdeny"
"overcomeimmunity"
}
"inherit_from"
{
"admin"
}
}
"admin"
{
"deny"
{
}
"allow"
{
"ulib_passtime"
"ulib_passtimeout"
"ulx spawnecho"
"ulx tsay"
"ulx csay"
"ulx gimp"
"ulx mute"
"ulx ungimp"
"ulx unmute"
"ulx gag"
"ulx ungag"
"ulx chattime"
"ulx welcomemessage"
"ulx slap"
"ulx whip"
"ulx slay"
"ulx sslay"
"ulx ignite"
"ulx unignite"
"ulx playsound"
"ulx freeze"
"ulx unfreeze"
"ulx god"
"ulx ungod"
"ulx noclip"
"ulx hp"
"ulx armor"
"ulx cloak"
"ulx uncloak"
"ulx blind"
"ulx unblind"
"ulx jail"
"ulx unjail"
"ulx ghost"
"ulx unghost"
"ulx ragdoll"
"ulx unragdoll"
"ulx maul"
"ulx strip"
"ulx adminmenu"
"ulx clientmenu"
"ulx mapsmenu"
"ulx showmotd"
"ulx banmenu"
"ulx exec"
"ulx rslotsmode"
"ulx rslots"
"ulx rslotsvisible"
"ulx reservedslots"
"ulx bring"
"ulx goto"
"ulx send"
"ulx teleport"
"ulx tooldeny"
"ulx toolallow"
"ulx tooldenyuser"
"ulx toolallowuser"
"ulx tooldenyoverride"
"ulx map"
"ulx kick"
"ulx ban"
"ulx banid"
"ulx unban"
"ulx spectate"
"ulx physgunplayer"
"ulx vote"
"ulx votemap2"
"ulx votekick"
"ulx voteban"
"ulx veto"
"ups_damage"
"ups_vehicle"
"ups_freeze"
"ups_physgun"
"ups_remove"
"ups_tool"
"ups_unfreeze"
"ups_use"
"ups disableplayers"
"ups miscdeletionaccess"
"ulx rocket"
}
"inherit_from"
{
"operator"
}
}
"miniadmin"
{
"deny"
{
}
"allow"
{
"ulx kick"
"ulx ban"
"ulx rocket"
"ulx jail"
"ulx unjail"
}
"inherit_from"
{
"heromember"
}
}
"heromember"
{
"deny"
{
}
"allow"
{
"ulx ungod"
}
"inherit_from"
{
"platinummember"
}
}
"platinummember"
{
"deny"
{
}
"allow"
{
"ulx hp"
}
"inherit_from"
{
"goldmember"
}
}
"goldmember"
{
"deny"
{
}
"allow"
{
"ulx armor"
}
"inherit_from"
{
"silvermember"
}
}
"silvermember"
{
"deny"
{
}
"allow"
{
"ulx god"
}
"inherit_from"
{
"bronzemember"
}
}
"bronzemember"
{
"deny"
{
}
"allow"
{
}
"inherit_from"
{
"member"
}
}
"member"
{
"deny"
{
}
"allow"
{
"ulx votekick"
}
"inherit_from"
{
"highlyrespected"
}
}
"highlyrespected"
{
"deny"
{
}
"allow"
{
}
"inherit_from"
{
"respected"
}
}
"respected"
{
"deny"
{
}
"allow"
{
}
"inherit_from"
{
"builder"
}
}
"builder"
{
"deny"
{
}
"allow"
{
}
"inherit_from"
{
"newbie"
}
}
"newbie"
{
"deny"
{
}
"allow"
{
}
"inherit_from"
{
"user"
}
}
"user"
{
"deny"
{
}
"allow"
{
"ulx"
"ulx help"
"ulx psay"
"ulx asay"
"ulx thetime"
"ulx menu"
"ulx_valueupdate"
"ulx_cvar"
"ulx_getgamemodes"
"ulx motd"
"ulx_getbans"
"ulx usermanagementhelp"
"ulx who"
"ulx votemap"
}
"inherit_from"
{
}
}
"mingebag"
{
"deny"
{
"ulx votemap"
"ulx psay"
"ulx asay"
"ulx_valueupdate"
"ulx_cvar"
"ulx_getgamemodes"
"ulx_getbans"
"ulx usermanagementhelp"
}
"allow"
{
}
"inherit_from"
{
"user"
}
}
"none"
{
"deny"
{
}
"allow"
{
"ulx logecho"
"ulx logfile"
"ulx logevents"
"ulx logchat"
"ulx logspawns"
"ulx logspawnsecho"
"ulx logdir"
"ulx addgimpsay"
"ulx addadvert"
"ulx addcsayadvert"
"ulx addforceddownload"
"ulx debuginfo"
"ulx voteecho"
"ulx votemap2successratio"
"ulx votemap2minvotes"
"ulx votekicksuccessratio"
"ulx votekickminvotes"
"ulx votebansuccessratio"
"ulx votebanminvotes"
"ulx votemapenabled"
"ulx votemapmintime"
"ulx votemapwaittime"
"ulx votemapsuccessratio"
"ulx votemapminvotes"
"ulx votemapvetotime"
"ulx votemapmapmode"
"ulx votemapaddmap"
}
"inherit_from"
{
}
}
"operator"
{
"deny"
{
}
"allow"
{
"ulx seeasay"
}
"inherit_from"
{
}
}
And this is my users.txt file, I hope you'll find a solution. :D
"jack in the box !"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"admin"
}
"id" "STEAM_0:1:1170481"
"pass" ""
"allow"
{
"immunity"
}
}
"euphytose"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"superadmin"
}
"id" "STEAM_0:1:14556854"
"pass" ""
"allow"
{
"immunity"
"ulx hasreadhelp"
}
}
"hat"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"respected"
}
"id" "STEAM_0:0:19650474"
"pass" ""
"allow"
{
}
}
"[bh]werewolf"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"newbie"
}
"id" "STEAM_0:0:24461014"
"pass" ""
"allow"
{
}
}
"kwiji"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"respected"
}
"id" "STEAM_0:1:10069716"
"pass" ""
"allow"
{
}
}
"dolpinus"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"respected"
}
"id" "STEAM_0:0:13262363"
"pass" ""
"allow"
{
}
}
"smith 117"
{
"deny"
{
}
"type" "steamid"
"groups"
{
"miniadmin"
}
"id" "STEAM_0:1:19094973"
"allow"
{
"immunity"
}
"pass" ""
}
Also, this is my Uteams.txt file, you have all that can cause the problem.
"Out"
{
"teams"
{
"1"
{
"name" "Server Owner"
"group" "superadmin"
"armor" "1000"
"hp" "1000"
"color"
{
"a" "255"
"B" "36"
"g" "36"
"r" "233"
}
}
"2"
{
"name" "Admins"
"group" "admin"
"armor" "500"
"hp" "500"
"color"
{
"a" "255"
"B" "0"
"g" "110"
"r" "255"
}
}
"3"
{
"name" "MiniAdmins"
"group" "miniadmin"
"armor" "400"
"hp" "400"
"color"
{
"a" "255"
"B" "0"
"g" "240"
"r" "255"
}
}
"4"
{
"name" "Operators"
"group" "operator"
"armor" "150"
"hp" "150"
"color"
{
"a" "255"
"B" "0"
"g" "200"
"r" "255"
}
}
"5"
{
"name" "Hero Members"
"group" "heromember"
"armor" "300"
"hp" "300"
"color"
{
"a" "255"
"B" "102"
"g" "255"
"r" "175"
}
}
"6"
{
"name" "Platinum Members"
"group" "platinummember"
"armor" "275"
"hp" "275"
"color"
{
"a" "255"
"B" "10"
"g" "255"
"r" "102"
}
}
"7"
{
"name" "Gold Members"
"group" "goldmember"
"armor" "250"
"hp" "250"
"color"
{
"a" "255"
"B" "10"
"g" "242"
"r" "102"
}
}
"8"
{
"name" "Silver Members"
"group" "silvermember"
"armor" "225"
"hp" "225"
"color"
{
"a" "255"
"B" "10"
"g" "227"
"r" "102"
}
}
"9"
{
"name" "Bronze Members"
"group" "bronzemember"
"armor" "200"
"hp" "200"
"color"
{
"a" "255"
"B" "10"
"g" "212"
"r" "102"
}
}
"10"
{
"name" "Members"
"group" "member"
"armor" "175"
"hp" "175"
"color"
{
"a" "255"
"B" "10"
"g" "201"
"r" "102"
}
}
"11"
{
"name" "Highly Respected"
"group" "highlyrespected"
"armor" "150"
"hp" "150"
"color"
{
"a" "255"
"B" "175"
"g" "175"
"r" "255"
}
}
"12"
{
"name" "Respected"
"group" "respected"
"armor" "125"
"hp" "125"
"color"
{
"a" "255"
"B" "190"
"g" "190"
"r" "255"
}
}
"13"
{
"name" "Builders"
"group" "builder"
"color"
{
"a" "255"
"B" "204"
"g" "220"
"r" "0"
}
}
"14"
{
"name" "Newbies"
"group" "newbie"
"color"
{
"a" "255"
"B" "204"
"g" "204"
"r" "0"
}
}
"15"
{
"name" "Players"
"group" "user"
"color"
{
"a" "255"
"B" "204"
"g" "102"
"r" "0"
}
}
"16"
{
"name" "MingeBags"
"group" "mingebag"
"color"
{
"a" "255"
"B" "255"
"g" "0"
"r" "255"
}
}
}
"gamemodes"
{
"1" "Sandbox"
}
}
Edit 2 : I tried to promote the guy to " Hero Members ", it worked, but after that, he stays an hero member, it seems that the script doesn't detect more than 3 groups. Maybe it's because, by default, there are 3 groups in the list ?
-
I looked over the code, and the only thing I can think of is to look in your server console and see you have have any errors. Sometimes when trying to format string to have quotes you run into problems when users have special characters in their names. So in the console you should find an error right after the player you're trying to have promoted dies, something like invalid group or invalid user.
-
I just tried with me.
I have more than 24 hours of playing, I removed me from the users.txt file, but it added me to " member " group, I was supposed to be added in "silvermember". :-\ And no error at all.
I also tried to add me directly in " goldmember ". When I kill myself after that, nothing happens, and the scoreboard, and me, my hp and armor, stay at " member ". The color is green for member, and even if I add me into higher groups, I'll stay in green.
Edit : It seems it's totally broken now. I have deleted my users.txt file to clean up the system, I have readded myself as superadmin, but when a player with more than 6 hours of playing comes and suicides, nothing happens. :-\
Edit 2 : Well, it's kinda strange, it worked for one guy, only one, I don't know at all what's happening there, I don't know if it's my server or the code, but it's really, really strange. ;D
Edit 3 : Finally, it worked for 3 guys at the moment, I'm really confused, I don't know what's the problem. :-\
Edit 4 : You were right, special symbols cause the plugin to bug with players who have them. A player had a " © ", I told him to remove it, it worked. But I wonder why people are not added in the right group. I mean, they have sufficient time to be in " gold member " and they are only in " member ", things like that, I don't know why.
Edit 5 : Yeah, I confirm, it does the same thing it was doing before, but in different way, now it doesn't stop at " respected " but it stops at " member ", even if a guy has more than 26 hours he will stay in the " member " group, I don't know what to do. :-\ It seems that times which are needed to be promoted are important. Since I changed them, players can be promoted to " members ", before they could to " respected " only. I don't know what's happening, but if you could look into the code and search for conflicts between times we set and promotions... It could be great. :)
Edit 6 : I still have the problem. :-\ Plugin is blocked at " member " and doesn't want to promote more. :'(
-
Sorry for bumping, but maybe I didn't have answers because my post date from the 22. :-\
So, I bump. ;D
Right now it still doesn't work. :-\
EDIT : It's really strange. I have changed required times again, and now, people can go to " Gold Member ", but they are blocked to " Gold Member ". So, I'll try to change the required times to be a " Platinum Member " and a " Hero Member ". ;D
-
The author of this script hasn't been active in 6 months. What would be the interest level of remaking this script? Any more features you'd like to see?
-
The author of this script hasn't been active in 6 months. What would be the interest level of remaking this script? Any more features you'd like to see?
Test this and let me know.
jay209015 rewrote this script.
-
Oh, whoops, didn't see that. :P
-
You can take over megg :D
-
jay please could you look into the code, there are problems. I'm sure they depend from the times I set.
-
Would someone please remake it? I'm going to have to take it off and promote manually for now...
-
After a good week of learning lua, I have successfully made an autopromote script that works just for my server. I will be remaking it tomorrow to be more user-friendly for you all.
-
Sorry it took so long guys! I got it done finally!
To edit the promotions simply change the first part of the A1-A10 to how ever many hours and the second part to the group.
Ex: A1 = { [hours] = "group" }
It must be listed in ascending order or it will not work properly.
For right now, it will only work for 10 groups and will only exclude 10 groups. I can extend that if anyone needs it.
EDIT: Sorry to that one person that downloaded it. I fixed it to where it doesn't add you to the same group everytime you die.
UPDATE: Made it add groups by steam id so weird names don't screw up the adding.
UPDATE: Added in a timer with the help of jay.
-
Sorry it took so long guys! I got it done finally!
To edit the promotions simply change the first part of the A1-A10 to how ever many hours and the second part to the group.
Ex: A1 = { [hours] = "group" }
It must be listed in ascending order or it will not work properly.
For right now, it will only work for 10 groups and will only exclude 10 groups. I can extend that if anyone needs it.
EDIT: Sorry to that one person that downloaded it. I fixed it to where it doesn't add you to the same group everytime you die.
UPDATE: Made it add groups by steam id so weird names don't screw up the adding.
If this works you can have my babies and eat them
-
If this works you can have my babies and eat them
It works.
I am going to be updating it soon to use a timer so it will check to see if they need a promote every minute or so.
-
With the help of jay...
UPDATE: Now it will check to see if a player needs a promotion every 10 seconds, so no more waiting for them to die.
-
Hehe, I love working mysteriously in the background :D
-
seems it won't promote anyone with quotes in their username, but i'm not sure about any other special characters
-
Quote, as in a ' (single) or " (double)...which?
I could see both causing problems.
-
oh, a double quote. i didn't try single quotes but it probably would do the same thing, i'm sure it could be fixed though with some simple string manipulations i just don't know any lua lol
-
Hey guys, I just checked back here and it seems a lot has gone on with this addon. What's going on right now? If mine is broken and someone else has made a working version, then I'll just link to it and stop development on this. If there is no new better addon than mine and mine is broken, then I'll fix mine and release a new version.
So what's going on?
-
Pizza.
Welcome Back! Everyone missed you... autopromote (as you can see) was/is quite popular.
Seems it broke somewhere along the way..not sure why. Several started working on it.
MajorPain in the post above yours seems to be the latest.
Also, someone on Facepunch tried having someone do all the work for them (http://www.facepunch.com/showthread.php?t=844013)
-
Ok, I'm gonna do some testing and fix whatever is necessary and release a 1.1. MajorPain's looks like a complete rewrite with none of my code, but it has the same name...
-
Ah, ok. I'd not compared.
Make sure you're aware of the new command structure being used in SVN now.
Adduser hasn't changed too much, but it no longer allows immunity like the old (0/1) method.
I don't know if you did that automatically in any way in v1. See the SVN area of the forums. There's a sticky for how immunity is handled now.
-
I'm not sure if this was actually broken or not from the posts(I didn't test Major_pains), but I optimised some of the code and added a chat announcement when people get promoted. I made this I wanted a version I know works and something that was exactly what i want.
Instructions:
As before in previous versions, pretty simple configuration - but its a bit different in this version.
Default settings:
Pretty self explanatory. Hours are when the promotion will take place. Group is the usergroup it will promote to. Name is what will be printed in chat when it says PLAYER has been promoted to name.
promotes = {
{ hours = 1, group = "player", name = "Player" },
{ hours = 2, group = "regular", name = "Regular" },
{ hours = 5, group = "respected", name = "Respected" },
{ hours = 10, group = "highrespected", name = "Highly Respected" },
{ hours = 25, group = "silverplayer", name = "Silver Player" },
{ hours = 50, group = "goldplayer", name = "Gold Player" }
}
Excludes work the same as previous versions, but are layed out differently.
excludes = { "donator", "moderator", "admin", "superadmin" }
Change msgOn to false if you want chat announcements disabled.
Change the below to change the color of the chat announcements.(Default is yellow)
Change effOn to false if you want effects/sound disabled.
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
EDIT: Also, first post for me. xD
EDIT#2: Removed the links, download 3.1 in HOLO's post.
-
Edited my last post with newer version, this is kinda a bump post. Anyway new stuff includes:
*Almost entirely recoded, simplified/optimised - can add as many groups as you like now, instead of Major_pains 10 alotted ones
*Chat announcement "Player has been promoted to 'Group name'." - Can disable if you don't like it, or change color of it.
*Effects and sound, when a player is promoted confetti appears and a sound is played. - Can disable if you don't like it.
*Easier configuration
*Works with SVN version of ULX
*Added awesomeness
If anyone can think of anything that would be good to include to AutoPromote I will gladly add it for you(granted its not too much hassle), also I will tell HOLOGRAPHICpizza that i posted here as he frequents a community I am in.
-
I am using HoloGraphic Pizza's AutoPromote but having a problem.
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["100"] = "platinum",
["50"] = "gold",
["20"] = "silver",
["5"] = "bronze",
["2"] = "member"
}
local excludeGroups = {
"dj",
"donator",
"mod",
"admin",
"superadmin"
}
It will promote up until bronze, but it fails to promote to silver (yes, past 20h). If I manually promote to silver it will demote to bronze. Yay.
Anyone know why? I'm certain my syntax is correct.
-
I made a few changes to Smithy's version and uploaded it to garrymod.org and updated the post.
v3.1 Changelog:
- Now loads as a ULX module.
- Calls ULX promote function directly, instead of through a console command.
Thanks Major_Pain and Smithy!
(http://www.garrysmod.org/img/?t=dll&id=87218) (http://www.garrysmod.org/downloads/?a=view&id=87218)
-
So wait, this is the new version, and I should disregard my problem and download this?
A new version released the very day I need it, how perfect. :D
Does not seem to work, the old one worked some-what... :S
if not SERVER then return end
--AutoPromote 2.0
--Automaticly promotes players to different groups based on UTime.
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 2, group = "member", name = "Member" },
{ hours = 5, group = "bronze", name = "Bronze Member" },
{ hours = 20, group = "silver", name = "Silver Member" },
{ hours = 50, group = "gold", name = "Gold Member" },
{ hours = 100, group = "platinum", name = "Platinum Member" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "dj", "donator", "mod", "admin", "superadmin" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
local cID = 1
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if not ply:IsUserGroup(excludes[id]) then
exclude = false
else
exclude = true
end
end
return exclude
end
function groupSet( ply )
local plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
while plhrs >= promotes[cID].hours and cID < table.Count(promotes) do
cID = cID + 1
groupTS = promotes[cID-1].group
end
if cID == table.Count(promotes) then
groupTS = promotes[table.Count(promotes)].group
return true
else
if cID <= 2 then
if plhrs >= promotes[1].hours then
return true
end
else
if plhrs >= promotes[cID-1].hours then
return true
end
end
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
cID = 1
if groupSet( ply ) and not ply:IsUserGroup(groupTS) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
if cID == table.Count(promotes) then
cID = table.Count(promotes) + 1
return true
else
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..promotes[cID-1].name.."'.")
end
end
cID = 1
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, groupTS)
--game.ConsoleCommand("ulx adduser "..string.format("%q", ply:Nick() ).." "..groupTS.."\n")
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
-
Add me on steam Ploo and I'll try and help you. :)
-
Smithy released a version of his own within holographic pizza's.
Prob should have made his own release - Smithy's Autopromote or something similar.
-
It's not a new script though, its based from HOLO's.
Version 3.1 that HOLO released is just my v3 version in modular form, with slight fixes. We worked together on 3.1.
There is no need for a new thread for the same addon, am I right?
Anyway Ploo if you are still having problems add me on steam, like I said it has been tested and works fine - so its probably misconfiguration somewhere.
-
Added you.
-
I realised a major flaw in my code so here is 3.2. I will ask HOLO to reupload to garrysmod.org, but for now here is a temp mirror.
DOWNLOAD (http://smithy.netii.net/site/AutoPromote.rar)
Version 3.2 changes:
*Fixed the exclude group code, it was only excluding the last group in the excludes table. - Fixed in V3.2
-
*Fixed the exclude group code, it was only excluding the last group in the excludes table. - Fixed in V3.2
- Nice find! :)
-
So I am trying to get this thing to work... first here is what i have for a config:
promotes = {
{ hours = 2, group = "player", name = "Player" },
{ hours = 10, group = "regular", name = "Regular" },
{ hours = 25, group = "pro", name = "Pro" },
{ hours = 45, group = "vip", name = "VIP" },
{ hours = 75, group = "respected", name = "Respected" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "respected", "admin", "admin2", "superadmin" }
and what is happening is it will promote to player, regular, pro...but when a player hits 45 hours it jumps to respected and skips vip... or whatever the second to last group defined is in any case...
any ideas? ??? or am i just crazy
edit: i dont think having respected in the excludes makes a difference but im not 100% on that
-
I have the same problem as TweaK..
-
I'll look into since smithy appears to be busy.
-
any fix would be great!
-
Been looking at it, and trying to make head or tails of this code is a difficult task lol. I've come to the conclusion that I'm going to overhaul this and try and make it more developer friendly.
-
Got a fix I think, but no way to test. Anyone care do test it for me?
-
EDIT: doesn't work, comes out with tis lua error:
Lua Error: Timer Error: ulx\modules/AutoPromote.lua:68: attempt to call field 'count' (a nil value)
-
Sorry, that was my bad. Case error.
Quick fix below.
::EDIT::
Tested, and working! :)
-
Tested, and working! :)
Thanks for fixing that, haven't checked back here in a while.
-
Thanks for the help!
-
No problem, do what I can to help.
-
Just found a problem, it promotes someone to the last rank at the right time, but them promoted them back to the first rank and goes through the ranks again in a loop.
EX. User has been promoted to "platinum Member"
-5 seconds later-
User have been promoted to "member"
and so on
-
Again no way to test, but this should fix her.
-
<clip>her<clip>
Well now... that explains the loopiness of the application.
/me ducks as ULX feminine users throw 50 pound unix manuals at him
/me covers screen as he's posting to hide from wife.
-
Haha, careful Jamm, treading in dangerous waters :P
-
I have not been able to get this to work, and I'm tired of waiting an hour every time to test it.
promotes = {
{ hours = 14, group = "respected3", name = "Bronze" },
{ hours = 24, group = "respected2", name = "Silver" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "owner", "respected", "admin", "superadmin", "temp-admin" }
I downloaded the one from Jay, the most recent one he fixed.
Should I maybe rename the groups so they don't have similar names?
I was thinking that it stores the groups you have been in and still excludes you if you demote yourself to test it.
-
Aaron, I think you have to have the hours from more to less, higher group to lesser group/name.
That may have changed in more recent versions, but the original cfg had higher to lower.
-
K I'll try reversing it later, people in server right now. I'll let you know if it worked.
-
Seems I was wrong. Jay's correction from a few posts above yours, shows in order least to greatest.
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 1, group = "player", name = "Player" },
{ hours = 2, group = "regular", name = "Regular" },
{ hours = 5, group = "respected", name = "Respected" },
{ hours = 10, group = "highrespected", name = "Highly Respected" },
{ hours = 25, group = "silverplayer", name = "Silver Player" },
{ hours = 50, group = "goldplayer", name = "Gold Player" }
}
But, it could depend on which version you're using. Several fixes/enhancements/versions exist within these pages.
-
I have no idea which I should use. I am using the latest SVNed version of ULX if that has anything to do with it. I also just downloaded UTime just a couple days ago. So maybe there was a change that broke it?
-
I keep getting a re-occuring error:
ulx\modules/AutoPromote.lua:65: 'then' expected near '='
-
If you guys want, I'll add mine, it's working perfectly. Only thing you have to do is add the last group to the list that won't be promoted... ever.
-
Sure I'll take it.
-
if not SERVER then return end
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 3, group = "member", name = "Member" },
{ hours = 10, group = "b_member", name = "Bronze Member" },
{ hours = 30, group = "s_member", name = "Silver Member" },
{ hours = 60, group = "g_member", name = "Gold Member" },
{ hours = 120, group = "p_member", name = "Platinum Member" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "supporter", "moderator", "administrator", "superadmin", "vip", "s_admin", "p_member", "storm" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = false }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end
function hoursToPromote( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end
function getPromoteName( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end
function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id,_ in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) then
return true
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, ply.promote)
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
So just see that p_member is the last group players get promoted to but they are also in the excluded, if you don't do that with your last group, it's going to go in a loop.
-
if not SERVER then return end
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 3, group = "member", name = "Member" },
{ hours = 10, group = "b_member", name = "Bronze Member" },
{ hours = 30, group = "s_member", name = "Silver Member" },
{ hours = 60, group = "g_member", name = "Gold Member" },
{ hours = 120, group = "p_member", name = "Platinum Member" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "supporter", "moderator", "administrator", "superadmin", "vip", "s_admin", "p_member", "storm" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = false }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end
function hoursToPromote( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end
function getPromoteName( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end
function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id,_ in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) then
return true
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, ply.promote)
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
So just see that p_member is the last group players get promoted to but they are also in the excluded, if you don't do that with your last group, it's going to go in a loop.
Thanks that strangely worked perfectly. ;D
-
Is this compatible with ULX and ULIB SVN?
-
Is this compatible with ULX and ULIB SVN?
Read the last three posts before yours.
Aaron says he's using SVN, Someone920 provides working code.
-
For some reason I can't get it to work. Here's my code.
]]
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["100"] = "dedicatedmember",
["60"] = "highlyrespected",
["40"] = "moderatlyrespected",
["20"] = "lightlyrespected",
["10"] = "regular",
["2"] = "builder"
["0"] = "user"
}
-
Unless there was an update on it, that is not even close to how your suppose to do it.
promotes = {
{ hours =2, group = "builder", name = "Builder" },
{ hours = 10, group = "regular", name = "Regular" },
{ hours = 20, group = "lightlyrespected", name = "Lightly Respected" },
{ hours = 40, group = "moderatlyrespected", name = "Moderately Respected" },
{ hours = 60, group = "highlyrespected", name = "Highly Respected" },
{ hours = 100, group = "dedicatedmember", name = "Dedicated Member" }
}
And make sure you use the working code that someone920 gave me.
-
it seems Garry's last update broke my autopromote, anyone else have the same problem?
-
<clip>anyone else have the same problem?
For those that might be, what, other than it not promoting, is the problem?
Errors? Symptoms?
-
I've been watching it all day, but there are no errors so far, but i just remembered, I don't have a cl_utime.lua for my utime, could that cause the problem?
-
I'm using ulx / ulib SVN, and utime 1.4 and some other stuff, but it wont promote for me at all :x i dont see any errors or anything printed in console of the server so yeah :/ any help would be greatly appreciated
-
I've been watching it all day, but there are no errors so far, but i just remembered, I don't have a cl_utime.lua for my utime, could that cause the problem?
If you don't have a cl_utime for your utime, you're not running utime.
-
It still records time though, if you join my server, you won't see what the time is, but you still get time. I'm using UTimeM if it makes any difference.
-
thats probly why your auto promote isnt working, im using just regular utime :x but mine still isnt working either
-
it works fine with either utime, it's been working till garry updated last week
-
Then it might need a re-code, but i doubt thatl happen anytime soon, ive been trying to get ahold of smithy :x
-
Okay, i just tried using the cl_utime now, still no dice. No errors, or anything.
-
That sucks :x, i may have a friend recode it or something
-
Mine seems to be working just fine.
-
Mind posting your code? and which version of utime / ulib / ulx you use?
-
Unless there was an update on it, that is not even close to how your suppose to do it.
promotes = {
{ hours =2, group = "builder", name = "Builder" },
{ hours = 10, group = "regular", name = "Regular" },
{ hours = 20, group = "lightlyrespected", name = "Lightly Respected" },
{ hours = 40, group = "moderatlyrespected", name = "Moderately Respected" },
{ hours = 60, group = "highlyrespected", name = "Highly Respected" },
{ hours = 100, group = "dedicatedmember", name = "Dedicated Member" }
}
And make sure you use the working code that someone920 gave me.
Can i have the group.txt file for this and also the uteam.txt file for this please and thank you
-
Can i have the group.txt file for this and also the uteam.txt file for this please and thank you
You either have to ask tucker on the previous page for these or make them yourself. Unless he just didn't respond I think tucker never came back, which means he probably won't come back. I find these really easy but am not going to make it when I'm not going to use it.
If you PM tucker (I'm not sure if he gets emailed) he may respond.
EDIT: You do not need UTeam to have this if that is why you asked for both. UTeam would be really simple and easy to set up. Especially with the new built in UTime, which I should use on my server instead of the separate addon.
-
hey umm i DO see an error in my console (i run my own server yes, yes i do) and it is this...
addons\autopromote\lua\ulx\modules\autopromote.lua:75: '<eof>' expected near 'end'
please help
-
'<eof>' expected near 'end'
This usually means you're either missing a " or , or { or } in your promotions table, or have one too many of any, or combo of all the above.
-
This is what I got. Still nothing. Help would be nice. Thanks.
local promoteGroups = {
-- Groups must be listed in decending order.
-- ["hours"] = "group",
["100"] = "dedicatedmember",
["60"] = "highlyrespected",
["40"] = "moderatelyrespected",
["20"] = "lightlyrespected",
["10"] = "regular",
["2"] = "builder"
}
-
Try placing the two commented lines outside of the table.
In otherwords, take the
local blah = {
-- blah.
-- blah,
["#"] = "blah",
...
}
and make it look like
-- blah.
-- blah,
local blah = {
["#"] = "blah",
...
}
I'm not even sure the version from the original release post is working anymore.
There's been much discussion and two or three re-writes of the code, all I think within this thread, by different authors
The thread is a mess, but if you find the latest re-write, and convert to the latest way of storing the group tables, you may have better luck.
Look over the last 2-3 pages.
-
I'm not sure which version of AutoPromote I have, but I do know mine works fine.
Should I zip it and attach it?
-
I'm having the weirdest problem. I updated ULX, ULib and UTime to SVN, and now my AutoPromote is buggy; it seems to be ignoring the "excludes" section and treats every joining player as if this is their first session, working them back up the ranks as User, Player, Regular, etc at each tick. However, all ranks that aren't attained by hours played like Trusted and Admin aren't re-earned. But this isn't the weird problem.
The problem is that I tried simply removing AutoPromote temporarily so that my admins could at least retain their rank while I try to fix this. For some reason though, not having AutoPromote on my server causes players to instantly crash when they join. So now I have the choice of either having an empty server, or one with no admins. :(
-
Did you have you server shutdown when you removed the addon?
If using a downloadurl, did you update your cache to match the new cache on the server?
Errors in server console when starting your server? Errors in server console when players join?
Errors in player/client console when they join?
Too many things can go wrong...removing an addon won't cause problems unless something else relies on it (ULib), or peices of it still exist in different places (cache, etc)
-
Did you have you server shutdown when you removed the addon?
If using a downloadurl, did you update your cache to match the new cache on the server?
Errors in server console when starting your server? Errors in server console when players join?
Errors in player/client console when they join?
Too many things can go wrong...removing an addon won't cause problems unless something else relies on it (ULib), or peices of it still exist in different places (cache, etc)
Yes, the server was down each time I tried removing the addon.
I tried both updating the fastDL's cache and disabling it completely, both yielded the crash on join.
No errors when starting the server nor when players try to join, aside from the crash.
My Sandbox server is working fine, so I copy/pasted the UTime and AutoPromote addons from there and into my DarkRP server, where the problem is. It's still happening though, so I'm pretty mystified.
EDIT: However, when an admin joins the server, they use up one of the admin-only reserved slots. It's like the server recognizes them as an admin when they first join, but then AutoPromote demotes them back down.
-
UTime is now incorporated into SVN of ULX.
May be some issues there. I'm not familiar enough with Autopromote (never used it, and, too many versions among these pages) to even consider why removing it would cause a player to crash. I'm still guessing some cache issue. Just my guess.
-
UTime is now incorporated into SVN of ULX.
May be some issues there. I'm not familiar enough with Autopromote (never used it, and, too many versions among these pages) to even consider why removing it would cause a player to crash. I'm still guessing some cache issue. Just my guess.
You were right, I cleaned out the server's cache after deleting AutoPromote and players no longer crash. Now I'm getting an error that may lead to diagnosing the rank reset problem:
[@ulib\shared\sh_ucl.lua:51] [ULIB] Unauthed player
[@ulib\shared\sh_ucl.lua:51] [ULIB] Unauthed player
[@ulib\shared\sh_ucl.lua:51] [ULIB] Unauthed player
[@ulib\shared\sh_ucl.lua:51] [ULIB] Unauthed player
This happens whenever a player joins, and it always resets their access back to User.
-
As far as I know, the "Unauthed Player" issue has been more than extensively squashed by Megiddo a while ago. Are you absolutely positive that your server is running the latest SVNs of ULX/ULib? (Unless you're running the release version).
We've been having issues with users who are set up with servers (Xenon Servers, to be exact) that will "automatically" update the SVN for you.. except their script to update was broken and their users were getting stuck with an older version, thinking they had the latest.
UTime is now incorporated into SVN of ULX.
Erm, don't you mean UTeam is now incorporated? ???
-
As far as I know, the "Unauthed Player" issue has been more than extensively squashed by Megiddo a while ago. Are you absolutely positive that your server is running the latest SVNs of ULX/ULib? (Unless you're running the release version).
We've been having issues with users who are set up with servers (Xenon Servers, to be exact) that will "automatically" update the SVN for you.. except their script to update was broken and their users were getting stuck with an older version, thinking they had the latest.
Erm, don't you mean UTeam is now incorporated? ???
It's entirely likely I simply have a corrupt file somewhere so I'm completely gutting ULX/ULib and reinstalling. I uploaded the SVN version to the server as I'd known about the host's auto-SVN reputation of not being totally reliable.
Actually, now that I think about it, the latest version of DarkRP introduced a more expansive administration system. Maybe there's some incompatibility there?
-
Could be, haven't heard any complaints about it yet though. How new is this DarkRP version? If it's been a while then it might not be as likely, since I know we have quite a few users here using DarkRP. Let us know how your reinstall goes!
-
Could be, haven't heard any complaints about it yet though. How new is this DarkRP version? If it's been a while then it might not be as likely, since I know we have quite a few users here using DarkRP. Let us know how your reinstall goes!
Yep, the problem lies in the latest version of DarkRP. This 'FAdmin' system that was integrated has its own set of access requirements; anyone that doesn't have their access set in FAdmin gets reset to User every time they rejoin, completely ignoring ULX ranks.
Why do I continue hosting this trash. I do appreciate the help, JamminR and Stickly Man!
EDIT: It gets better. The highest level of access in FAdmin is root_user. Of course, being root_user means I no longer have access to ULX admin commands so to accomplish everything I need to, I'll have to juggle my rank back and forth.
-
Though I am of the normally strong opinion that gamemodes shouldn't require; yet another control system such as ULX and it's plethora of mods (UPPL/URestrict/UNolimited) to control access in them, it bothers me to see that a gamemode has totally abandoned the standard GLua groups of superadmin and admin.
Though ULX allows custom additions like many other mods, we attempt to keep it simple for the three standards, user, admin, superadmin, and use a custom check written in for inheritance.
Back on topic for this thread, perhaps, if you decide to continue to use DarkRP *cringe*, the current authors (of many previous it seems) have a plugin system for which to write a system such as autopromote.
-
I think what's happening is Autopromote is still looking for the old UTeam files instead of using the new updated way of ULX.
-
I think what's happening is Autopromote is still looking for the old UTeam files instead of using the new updated way of ULX.
This. I tried it on my server, which is fully up to date, and it doesn't recognise the ranks made by XGUI. Fairly annoying.
-
AutoPromote does not in any way relate to UTeam. It is not dependent upon UTeam. You have to use the actual group names, not the ones you assign through UTeam.
-
I got it to work now. However, now it doesn't take notice of my excludes at all and keeps promoting them all the time.
Help.
if not SERVER then return end
--AutoPromote 2.0
--Automaticly promotes players to different groups based on UTime.
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 1, group = "player", name = "Player" },
{ hours = 5, group = "regular", name = "Regular" },
{ hours = 16, group = "respected", name = "Respected" },
{ hours = 25, group = "dedicated", name = "Dedicated" },
{ hours = 90, group = "silver_member", name = "Silver Member" },
{ hours = 130, group = "gold_member", name = "Gold Member" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "donator", "moderator", "administrator", "superadmin", "god", "admin", "privileged" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
local cID = 1
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if not ply:IsUserGroup(excludes[id]) then
exclude = false
end
else
exclude = true
end
return exclude
end
function groupSet( ply )
local plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
while plhrs >= promotes[cID].hours and cID < table.Count(promotes) do
cID = cID + 1
groupTS = promotes[cID-1].group
end
if cID == table.Count(promotes) then
groupTS = promotes[table.Count(promotes)].group
return true
else
if cID <= 2 then
if plhrs >= promotes[1].hours then
return true
end
else
if plhrs >= promotes[cID-1].hours then
return true
end
end
return false
end
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
cID = 1
if groupSet( ply ) and not ply:IsUserGroup(groupTS) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
if cID == table.Count(promotes) then
cID = table.Count(promotes) + 1
return true
else
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..promotes[cID-1].name.."'.")
end
end
cID = 1
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, groupTS)
--game.ConsoleCommand("ulx adduser "..string.format("%q", ply:Nick() ).." "..groupTS.."\n")
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
-
Could you tell what modifications you actually made there? Or how you got it work, mine isnt even working!
BUT! Might the problem be that your first group is "player" it's not the default "user" group and your autopromote don't know which group to start on and it just keep promoting?
Thats how I have it:
if not SERVER then return end
--AutoPromote 2.0
--Automaticly promotes players to different groups based on UTime.
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 1, group = "user", name = "Guest" },
{ hours = 2, group = "player", name = "Player" },
{ hours = 3, group = "silverplayer", name = "Silverplayer" },
{ hours = 10, group = "goldplayer", name = "Goldplayer" },
{ hours = 15, group = "platinaplayer", name = "Platinaplayer" },
{ hours = 20, group = "member", name = "Member" },
{ hours = 25, group = "silvermember", name = "Silvermember" },
{ hours = 30, group = "goldmember", name = "Goldmember" },
{ hours = 35, group = "platinamember", name = "Platinamember" },
{ hours = 40, group = "", name = "" },
{ hours = 45, group = "bitcher", name = "Bitcher" },
{ hours = 50, group = "bitchest", name = "Bichest" },
{ hours = 75, group = "halfrespected", name = "HalfRespected" },
{ hours = 100, group = "respected", name = "Respected" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "admin", "superadmin", "owner"}
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
local cID = 1
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if not ply:IsUserGroup(excludes[id]) then
exclude = false
else
exclude = true
end
end
return exclude
end
function groupSet( ply )
local plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
while plhrs >= promotes[cID].hours and cID < table.Count(promotes) do
cID = cID + 1
groupTS = promotes[cID-1].group
end
if cID == table.Count(promotes) then
groupTS = promotes[table.Count(promotes)].group
return true
else
if cID <= 2 then
if plhrs >= promotes[1].hours then
return true
end
else
if plhrs >= promotes[cID-1].hours then
return true
end
end
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
cID = 1
if groupSet( ply ) and not ply:IsUserGroup(groupTS) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
if cID == table.Count(promotes) then
cID = table.Count(promotes) + 1
return true
else
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..promotes[cID-1].name.."'.")
end
end
cID = 1
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, groupTS)
--game.ConsoleCommand("ulx adduser "..string.format("%q", ply:Nick() ).." "..groupTS.."\n")
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
and that's how I set the groups:
"silverplayer"
{
"team"
{
"health" 300
"color_red" 86
"index" 27
"order" 7
"name" "Silverplayer"
"color_blue" 89
"color_green" 86
}
"allow"
{
}
"inherit_from" "player"
}
"bitcher"
{
"team"
{
"health" 1100
"color_red" 247
"index" 35
"order" 15
"name" "Bitcher"
"color_blue" 13
"color_green" 13
}
"allow"
{
}
"inherit_from" ""
}
"goldmember"
{
"team"
{
"health" 800
"color_red" 147
"index" 32
"order" 12
"name" "Goldmember"
"color_blue" 5
"color_green" 113
}
"allow"
{
}
"inherit_from" "silvermember"
}
"bitchest"
{
"team"
{
"health" 1200
"color_red" 249
"index" 36
"order" 16
"name" "Bitchest"
"color_blue" 13
"color_green" 37
}
"allow"
{
}
"inherit_from" "user"
}
"halfrespected"
{
"team"
{
"health" 1250
"color_red" 7
"index" 37
"order" 17
"name" "Halfrespected"
"color_blue" 211
"color_green" 126
}
"allow"
{
}
"inherit_from" "bitcher"
}
"superadmin"
{
"team"
{
"index" 22
"runSpeed" 600
"order" 2
"color_blue" 10
"name" "Superadmin"
"health" 5000
"color_red" 4
"walkSpeed" 400
"color_green" 178
}
"allow"
{
"ulx adduser"
"ulx adduserid"
"ulx blind"
"ulx cloak"
"ulx god"
"ulx hiddenecho"
"ulx logchat"
"ulx logdir"
"ulx logecho"
"ulx logevents"
"ulx logfile"
"ulx logspawns"
"ulx logspawnsecho"
"ulx maul"
"ulx removeuser"
"ulx removeuserid"
"ulx setgroupcantarget"
"ulx userallow"
"ulx userallowid"
"ulx userdeny"
"ulx userdenyid"
"ulx voteecho"
"xgui_gmsettings"
"xgui_managebans"
"xgui_svsettings"
}
"inherit_from" "admin"
}
"user"
{
"team"
{
"color_red" 6
"index" 26
"order" 6
"name" "Guest"
"color_blue" 244
"color_green" 18
}
"allow"
{
"ulx asay"
"ulx clientmenu"
"ulx help"
"ulx menu"
"ulx motd"
"ulx psay"
"ulx thetime"
"ulx usermanagementhelp"
"ulx votemap"
"ulx who"
}
}
"platinamember"
{
"team"
{
"health" 900
"color_red" 166
"index" 33
"order" 13
"name" "Platinamember"
"color_blue" 219
"color_green" 234
}
"allow"
{
}
"inherit_from" "goldmember"
}
""
{
"team"
{
"health" 1000
"color_red" 249
"index" 34
"order" 14
"name" ""
"color_blue" 20
"color_green" 20
}
"allow"
{
}
"inherit_from" "platinamember"
}
"platinaplayer"
{
"team"
{
"health" 500
"color_red" 166
"index" 29
"order" 9
"name" "Platinaplayer"
"color_blue" 219
"color_green" 234
}
"allow"
{
}
"inherit_from" "goldplayer"
}
"silvermember"
{
"team"
{
"health" 700
"color_red" 166
"index" 31
"order" 11
"name" "Silvermember"
"color_blue" 219
"color_green" 234
}
"allow"
{
}
"inherit_from" "member"
}
"player"
{
"team"
{
"health" 200
"color_red" 51
"name" "Player"
"order" 5
"index" 25
"color_blue" 186
"color_green" 6
}
"allow"
{
}
"inherit_from" "user"
}
"admin"
{
"can_target" "!%superadmin"
"team"
{
"health" 3000
"color_red" 153
"name" "Admin"
"order" 3
"index" 23
"color_blue" 244
"color_green" 8
}
"allow"
{
"ulx adminmenu"
"ulx ban"
"ulx banid"
"ulx banmenu"
"ulx bring"
"ulx chattime"
"ulx csay"
"ulx freeze"
"ulx gag"
"ulx gimp"
"ulx goto"
"ulx ignite"
"ulx jail"
"ulx kick"
"ulx map"
"ulx mapsmenu"
"ulx mute"
"ulx noclip"
"ulx physgunplayer"
"ulx playsound"
"ulx ragdoll"
"ulx resetspawn"
"ulx rslots"
"ulx rslotsmode"
"ulx rslotsvisible"
"ulx send"
"ulx setspawn"
"ulx showmotd"
"ulx slap"
"ulx slay"
"ulx spawnecho"
"ulx spectate"
"ulx sslay"
"ulx strip"
"ulx teleport"
"ulx tsay"
"ulx unban"
"ulx unblind"
"ulx uncloak"
"ulx unfreeze"
"ulx ungag"
"ulx ungimp"
"ulx unignite"
"ulx unigniteall"
"ulx unjail"
"ulx unmute"
"ulx unragdoll"
"ulx veto"
"ulx vote"
"ulx voteban"
"ulx votebanminvotes"
"ulx votebansuccessratio"
"ulx votekick"
"ulx votekickminvotes"
"ulx votekicksuccessratio"
"ulx votemap2"
"ulx votemap2minvotes"
"ulx votemap2successratio"
"ulx votemapenabled"
"ulx votemapmapmode"
"ulx votemapmintime"
"ulx votemapminvotes"
"ulx votemapsuccessratio"
"ulx votemapvetotime"
"ulx votemapwaittime"
"ulx welcomemessage"
"ulx whip"
"urestrict allowspawn"
"urestrict denyspawn"
"urestrict npcs"
"urestrict props"
"urestrict ragdolls"
"urestrict sents"
"urestrict vehicles"
"xgui_managebans"
}
"inherit_from" "operator"
}
"goldplayer"
{
"team"
{
"health" 400
"color_red" 163
"index" 28
"order" 8
"name" "Goldplayer"
"color_blue" 5
"color_green" 105
}
"allow"
{
}
"inherit_from" "silverplayer"
}
"respected"
{
"team"
{
"health" 1337
"color_red" 12
"name" "Respected"
"order" 4
"index" 24
"color_blue" 255
"color_green" 242
}
"allow"
{
"ulx csay"
"ulx gag"
"ulx gimp"
"ulx mute"
"ulx tsay"
"ulx ungag"
"ulx ungimp"
"ulx unmute"
"ulx votekick"
}
"inherit_from" "user"
}
"member"
{
"team"
{
"health" 600
"color_red" 166
"index" 30
"order" 10
"name" "Member"
"color_blue" 219
"color_green" 234
}
"allow"
{
}
"inherit_from" "platinaplayer"
}
"operator"
{
"can_target" "!%admin"
"allow"
{
"ulx seeasay"
}
"inherit_from" "user"
}
"owner"
{
"team"
{
"index" 21
"runSpeed" 5000
"order" 1
"color_blue" 169
"color_red" 247
"health" 10000
"name" "Owner"
"jumpPower" 552
"walkSpeed" 680
"color_green" 13
}
"allow"
{
"ulx addgroup"
"ulx adduser"
"ulx adduserid"
"ulx adminmenu"
"ulx armor"
"ulx ban"
"ulx banid"
"ulx banmenu"
"ulx blind"
"ulx bring"
"ulx cexec"
"ulx chattime"
"ulx cloak"
"ulx csay"
"ulx ent"
"ulx exec"
"ulx freeze"
"ulx gag"
"ulx gimp"
"ulx god"
"ulx goto"
"ulx groupallow"
"ulx groupdeny"
"ulx hiddenecho"
"ulx hp"
"ulx ignite"
"ulx jail"
"ulx kick"
"ulx logchat"
"ulx logdir"
"ulx logecho"
"ulx logevents"
"ulx logfile"
"ulx logspawns"
"ulx logspawnsecho"
"ulx luarun"
"ulx map"
"ulx mapsmenu"
"ulx maul"
"ulx mute"
"ulx noclip"
"ulx physgunplayer"
"ulx playsound"
"ulx ragdoll"
"ulx rcon"
"ulx removegroup"
"ulx removeuser"
"ulx removeuserid"
"ulx renamegroup"
"ulx reservedslots"
"ulx resetspawn"
"ulx rslots"
"ulx rslotsmode"
"ulx rslotsvisible"
"ulx seeasay"
"ulx send"
"ulx setgroupcantarget"
"ulx setspawn"
"ulx showmotd"
"ulx slap"
"ulx slay"
"ulx spawnecho"
"ulx spectate"
"ulx sslay"
"ulx strip"
"ulx teleport"
"ulx tsay"
"ulx unban"
"ulx unblind"
"ulx uncloak"
"ulx unfreeze"
"ulx ungag"
"ulx ungimp"
"ulx ungod"
"ulx unignite"
"ulx unigniteall"
"ulx unjail"
"ulx unmute"
"ulx unragdoll"
"ulx userallow"
"ulx userallowid"
"ulx userdeny"
"ulx userdenyid"
"ulx veto"
"ulx vote"
"ulx voteban"
"ulx votebanminvotes"
"ulx votebansuccessratio"
"ulx voteecho"
"ulx votekick"
"ulx votekickminvotes"
"ulx votekicksuccessratio"
"ulx votemap2"
"ulx votemap2minvotes"
"ulx votemap2successratio"
"ulx votemapenabled"
"ulx votemapmapmode"
"ulx votemapmintime"
"ulx votemapminvotes"
"ulx votemapsuccessratio"
"ulx votemapvetotime"
"ulx votemapwaittime"
"ulx welcomemessage"
"ulx whip"
"urestrict allowspawn"
"urestrict denyspawn"
"urestrict npcs"
"urestrict props"
"urestrict ragdolls"
"urestrict sents"
"urestrict vehicles"
"xgui_gmsettings"
"xgui_managebans"
"xgui_managegroups"
"xgui_svsettings"
}
"inherit_from" "superadmin"
}
-
Try these. If they don't work, I don't know what is going wrong.
@sweetone
if not SERVER then return end
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 2, group = "player", name = "Player" },
{ hours = 3, group = "silverplayer", name = "Silverplayer" },
{ hours = 10, group = "goldplayer", name = "Goldplayer" },
{ hours = 15, group = "platinaplayer", name = "Platinaplayer" },
{ hours = 20, group = "member", name = "Member" },
{ hours = 25, group = "silvermember", name = "Silvermember" },
{ hours = 30, group = "goldmember", name = "Goldmember" },
{ hours = 35, group = "platinamember", name = "Platinamember" },
{ hours = 45, group = "bitcher", name = "Bitcher" },
{ hours = 50, group = "bitchest", name = "Bichest" },
{ hours = 75, group = "halfrespected", name = "HalfRespected" },
{ hours = 100, group = "respected", name = "Respected" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "admin", "superadmin", "owner"}
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end
function hoursToPromote( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end
function getPromoteName( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end
function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id,_ in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) then
return true
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, ply.promote)
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
@botman
if not SERVER then return end
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 1, group = "player", name = "Player" },
{ hours = 5, group = "regular", name = "Regular" },
{ hours = 16, group = "respected", name = "Respected" },
{ hours = 25, group = "dedicated", name = "Dedicated" },
{ hours = 90, group = "silver_member", name = "Silver Member" },
{ hours = 130, group = "gold_member", name = "Gold Member" }
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "donator", "moderator", "administrator", "superadmin", "god", "admin", "privileged" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end
function hoursToPromote( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end
function getPromoteName( group )
for id,_ in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end
function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id,_ in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) then
return true
end
return false
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
WorldSound( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160, 100 )
end
ulx.adduser(nil, ply, ply.promote)
end
end
if not timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function timerStart( ply )
timer.Create("Promotion-" ..tostring(ply:SteamID()), 10, 0, promotePlayer, ply)
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart)
function destroyTimers(ply)
if timer.IsTimer("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
-
Thank you very much. :) it works!
-
No problem.
-
Yes, that seems to help, thank you. I did not test your piece of code before now as I made my own fix earlier.
-
Updated AutoPromote for GMod 13!
Tell me if there's any bugs if you end up using it!
EDIT
Forgot to remove a debug print on line 80.
I'll just leave it there.
-
Thanks for the 13 version 8)
-
for some reason it stop auto promoting people how can i fix that?
-
for some reason it stop auto promoting people how can i fix that?
Mines also decided to just quit on me, was working fine not too long ago. Any ideas?
-
Where do i put this? i put it in my addons and it doesn't even load with the server?
-
Well, as is usual for most release posts here made before October 2012, make sure you're trying an updated version, IF one exists.
http://forums.ulyssesmod.net/index.php/topic,3826.msg27481.html#msg27481
If that doesn't work for you, try IMing the user?
-
I want it so it just promotes a player from user to Respected in 3 hours, can you show me how to do that? Thank You.
-
I want it so it just promotes a player from user to Respected in 3 hours, can you show me how to do that? Thank You.
Go into C:\(Gmod Server Directory)\orangebox\garrysmod\addons\AutoPromote\lua\ulx\modules\AutoPromote.lua
And if I am correct (if I'm not, someone correct me), this should be the code for what you're trying to do.
--[[
CREDIT FOR THIS VERSION OF AUTOPROMOTE GOES TO:
HOLOGRAPHICpizza
Major_Pain
Smithy
Jay209015
Garry's Mod 13 fix by EmilHem
PRETTY SELF EXLANATORY
HOURS IS THE POINT OF WHERE THE PLAYER WILL GET PROMOTED TO THE GROUP
NAME IS THE NAME THAT WILL GET DISPLAYED WHEN SOMEONE GETS PROMOTED
]]
promotes = {
{ hours = 3, group = "Respected", name = "Respected" },
}
---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "admin", "superadmin" }
---------Chat announcement settings, msgOn - if true then it will announce promotions(false if you want it disabled), msgcol - color of the chat announcements
settings = {
{ msgOn = true, msgcol = Color(255,225,0), effOn = true }
}
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--------------------- DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING---------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
if settings[1].effOn then
resource.AddFile( "sound/autopromote/promote.wav" )
end
function checkExcludes( ply )
for id, eX in pairs (excludes) do
if ply:IsUserGroup(eX) then
return true
end
end
return false
end
function hoursToPromote( group )
for id, blank in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["hours"]
end
end
end
function getPromoteName( group )
for id, blank in ipairs( promotes ) do
if group == promotes[id]["group"] then
return promotes[id]["name"]
end
end
end
function loopBlock( ply )
local toMark = 0;
local fromMark = 0;
for i=1, table.Count(promotes) do
if ply.promote == promotes[i]["group"] then
toMark = i;
end
if ply:IsUserGroup( promotes[i]["group"] ) then
fromMark = i;
end
end
print("fromMark: "..tostring(fromMark).." (<) toMark: "..tostring(toMark))
if fromMark < toMark then
return true
else
return false
end
end
function groupSet( ply )
ply.plhrs = math.floor((ply:GetUTime() + CurTime() - ply:GetUTimeStart())/60/60)
ply.promote = promotes[1]["group"]
for id, blank in ipairs(promotes) do
if ply:IsUserGroup(promotes[id]["group"]) and id < table.Count(promotes) then
ply.promote = promotes[id + 1]["group"]
end
end
if not(ply:IsUserGroup(ply.promote)) and (ply.plhrs >= hoursToPromote( ply.promote )) and loopBlock(ply) then
return true
end
return false
end
function effectS( ply )
local ed = EffectData()
ed:SetEntity(ply)
util.Effect("autopromotion",ed, true, true)
local vPoint = ply:GetPos()
local effectdata = EffectData()
local r = math.random(20, 255)
local g = math.random(20, 255)
local b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
util.Effect( "autopromotion2", effectdata )
timer.Simple( 1, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 2, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 3, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
timer.Simple( 4, function()
r = math.random(20, 255)
g = math.random(20, 255)
b = math.random(20, 255)
effectdata:SetStart( Vector( r, g, b ) )
local vPoint = ply:GetPos()
effectdata:SetOrigin( vPoint )
util.Effect( "autopromotion2", effectdata )
end)
end
function promotePlayer( ply )
if not checkExcludes( ply ) then
if groupSet( ply ) then
if settings[1].msgOn then
for ud, blank in pairs( player.GetAll()) do
ULib.tsayColor(player.GetAll()[ud],false,settings[1].msgcol,ply:Nick().." has been promoted to '"..getPromoteName(ply.promote).."'.")
end
end
if settings[1].effOn then
effectS( ply )
sound.Play( "autopromote/promote.wav", ply:GetPos( 0, 0, 0 ), 160 )
end
game.ConsoleCommand( "ulx adduserid "..ply:SteamID().." "..ply.promote.."\n" ) // I'm using this since it works and logs in the console. -EmilHem
end
end
if not timer.Exists("Promotion-" ..tostring(ply:SteamID())) then
timer.Create( "Promotion-"..tostring(ply:SteamID()), 15, 0, function() if not (ply and IsValid(ply)) then return end promotePlayer( ply ) end )
end
end
function timerStart( ply )
timer.Create( "Promotion-"..tostring(ply:SteamID()), 15, 0, function() if not (ply and IsValid(ply)) then return end promotePlayer( ply ) end )
end
hook.Add( "PlayerInitialSpawn", "timerstarting", timerStart )
function destroyTimers(ply)
if timer.Exists("Promotion-" ..tostring(ply:SteamID())) then
timer.Stop("Promotion-" ..tostring(ply:SteamID()))
timer.Destroy("Promotion-" ..tostring(ply:SteamID()))
end
end
hook.Add( "PlayerDisconnected", "PromotionCleanUP", destroyTimers )
I'd suggest you also look around in there to see if you want to change anything else.
-
TY Zevoxa and i also changed the people who wont get updated to respected like respected itself and oeprator and Vip ( well those are jut the ranks in my server).
-
Does anyone know how to make this plugin work(the gmod13 version)? i cant figure out why it isn't working
-
Mine is not working either. I have it in their and added the code for my user groups that I want promoted. Everything should work fine.
-
I've made a continuation to continue the development (if any more is needed) of AutoPromote.
Check this topic out: http://forums.ulyssesmod.net/index.php/topic,6381.0.html
The topic has a fixed AutoPromote attached to it.
-
Locking topic (see post above). If HOLOGRAPHICpizza becomes active again and wants to continue working on this project, he should message me. :)
-
I'm sorry if this is a stupid question, but how do I download this?
Never mind, I found there's an updated post for this. http://forums.ulyssesmod.net/index.php/topic,6381.0.html (http://forums.ulyssesmod.net/index.php/topic,6381.0.html)
-
Interesting - no lock.
Re-locked.
See link a few posts above.