ULX

Author Topic: AutoPromote  (Read 111883 times)

0 Members and 3 Guests are viewing this topic.

Offline DiscoBiscuit

  • Full Member
  • ***
  • Posts: 112
  • Karma: 1
    • DiscoBuild
Re: AutoPromote
« Reply #15 on: February 22, 2009, 04:54:30 PM »
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

Code: [Select]
-- ["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",
}
« Last Edit: March 13, 2009, 10:30:53 PM by DiscoBiscuit »

Offline DiscoBiscuit

  • Full Member
  • ***
  • Posts: 112
  • Karma: 1
    • DiscoBuild
Re: AutoPromote
« Reply #16 on: March 13, 2009, 10:29:45 PM »
Sorry for the bump/doublepost thing but people on my server are nagging about it >.>

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: AutoPromote
« Reply #17 on: March 13, 2009, 11:12:11 PM »
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #18 on: July 16, 2009, 10:08:51 AM »
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.

Offline Jethro

  • Newbie
  • *
  • Posts: 45
  • Karma: 1
Re: AutoPromote
« Reply #19 on: July 16, 2009, 02:26:03 PM »
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 :(

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: AutoPromote
« Reply #20 on: July 16, 2009, 10:23:48 PM »
Test this and let me know.
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline Jethro

  • Newbie
  • *
  • Posts: 45
  • Karma: 1
Re: AutoPromote
« Reply #21 on: July 17, 2009, 07:50:13 AM »
Yay it works like a dream. Thanks again Jay XD

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #22 on: July 17, 2009, 03:37:28 PM »
Test this and let me know.

Thanks a lot!  :)

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: AutoPromote
« Reply #23 on: July 18, 2009, 07:33:25 AM »
You're welcome.
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #24 on: July 22, 2009, 12:50:33 AM »
It seems it's broken again.  :-[

Here is my lua file :

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

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

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

Code: [Select]
"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 ?
« Last Edit: July 22, 2009, 04:16:08 AM by Euphytose »

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: AutoPromote
« Reply #25 on: July 22, 2009, 09:58:42 AM »
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.
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #26 on: July 22, 2009, 08:58:08 PM »
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.  :'(
« Last Edit: July 26, 2009, 07:42:36 AM by Euphytose »

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #27 on: July 26, 2009, 09:58:59 AM »
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
« Last Edit: July 27, 2009, 06:24:51 AM by Euphytose »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: AutoPromote
« Reply #28 on: July 27, 2009, 01:18:34 PM »
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?
Experiencing God's grace one day at a time.

Offline Euphytose

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 5
  • I love Lemonade!
Re: AutoPromote
« Reply #29 on: July 27, 2009, 01:26:00 PM »
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.