Ulysses Stuff > Ulysses Release Archives

AutoPromote

<< < (5/29) > >>

jay209015:
Test this and let me know.

Jethro:
Yay it works like a dream. Thanks again Jay XD

Euphytose:

--- Quote from: jay209015 on July 16, 2009, 10:23:48 PM ---Test this and let me know.

--- End quote ---

Thanks a lot!  :)

jay209015:
You're welcome.

Euphytose:
It seems it's broken again.  :-[

Here is my lua file :


--- Code: ---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 )
--- End code ---

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: ---"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"
{
}
}

--- End code ---

And this is my users.txt file, I hope you'll find a solution. :D


--- Code: ---"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" ""
}

--- End code ---

Also, this is my Uteams.txt file, you have all that can cause the problem.


--- Code: ---"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"
}
}

--- End code ---

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 ?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version