Author Topic: Auto promote problem  (Read 2329 times)

0 Members and 1 Guest are viewing this topic.

Offline hacon431

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Auto promote problem
« on: August 04, 2010, 03:17:12 PM »
i have autopromote and ulx/ulib svn +utime ,and i have configured to what i think the right files for autopromote. On my srcds server but when someone hits the required hours ,and die they do not rank up.
Here is my file for Groups

"superadmin"   
{
   "allow"   
   {
      "overcomeimmunity"
      "ulx addgroup"
      "ulx adduser"
      "ulx adduserid"
      "ulx cexec"
      "ulx ent"
      "ulx exec"
      "ulx groupallow"
      "ulx hiddenecho"
      "ulx logchat"
      "ulx logdir"
      "ulx logecho"
      "ulx logevents"
      "ulx logfile"
      "ulx logspawns"
      "ulx logspawnsecho"
      "ulx luarun"
      "ulx maul"
      "ulx rcon"
      "ulx removegroup"
      "ulx removeuser"
      "ulx removeuserid"
      "ulx renamegroup"
      "ulx setgroupcantarget"
      "ulx userallow"
      "ulx voteecho"
      "xgui_gmsettings"
      "xgui_managebans"
      "xgui_managegroups"
      "xgui_svsettings"
   }
   "inherit_from"   "admin"
}
"admin"   
{
   "can_target"   "!%platnum"
   "allow"   
   {
      "ulx adminmenu""
      "ulx ban"
      "ulx banid"
      "ulx banmenu"
      "ulx chattime"
      "ulx cloak"
      "ulx csay"
      "ulx freeze"
      "ulx gag"
      "ulx gimp"
      "ulx ignite"
      "ulx kick"
      "ulx map"
      "ulx mapsmenu"
      "ulx mute"
      "ulx noclip"
      "ulx physgunplayer"
      "ulx playsound"
      "ulx reservedslots"
      "ulx rslots"
      "ulx rslotsmode"
      "ulx rslotsvisible"
      "ulx send"
      "ulx showmotd"
      "ulx spawnecho"
      "ulx spectate"
      "ulx tsay"
      "ulx unban"
      "ulx uncloak"
      "ulx unfreeze"
      "ulx ungag"
      "ulx ungimp"
      "ulx unignite"
      "ulx unigniteall"
      "ulx unmute"
      "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"
   }
   "inherit_from"   "platnum"
}
"user"   
{
   "allow"   
   {
      "ulx asay"
      "ulx clientmenu"
      "ulx help"
      "ulx menu"
      "ulx motd"
      "ulx psay"
      "ulx thetime"
      "ulx usermanagementhelp"
      "ulx votemap"
      "ulx who"
   }
}
"member"   
{
   "can_target"   "!%user"
   "allow"   
   {
      "ulx seeasay"
      "ulx god"
      "ulx ungod"
   }
   "inherit_from"   "user"
}
"bronze"   
{
   "can_target"   "!%member"
   "allow"   
   {
      "ulx goto"
      "ulx bring"
      "ulx teleport"
   }
   "inherit_from"   "member"
}
"silver"   
{
   "can_target"   "!%bronze"
   "allow"   
   {
      "ulx hp"
      "ulx armor"
   }
   "inherit_from"   "bronze"
}
"gold"   
{
   "can_target"   "!%silver"
   "allow"   
   {
      "ulx ragdoll"
      "ulx unragdoll"
   }
   "inherit_from"   "silver"
}
"platnum"   
{
   "can_target"   "!%gold"
   "allow"   
   {
      "ulx sslay"
      "ulx slay"
      "ulx blind"
      "ulx unblind"
      "ulx strip"
   }
   "inherit_from"   "gold"
}
"demiadmin"   
{
   "can_target"   "!%platnum"
   "allow"   
   {
      "ulx jail"
      "ulx unjail"
      "ulx slap"
      "ulx whip"
}
   "inherit_from"   "platnum"
}

and heres my auto promote file i configured found in C:\Srcds\orangebox\garrysmod\addons\AutoPromote\lua\ulx\modules

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 = "Player" },
      { hours = 10, group = "bronze", name = "Regular" },
      { hours = 25, group = "silver", name = "Respected" },
      { hours = 60, group = "gold", name = "Highly Respected" },
      { hours = 120, group = "platnum", name = "Silver Player" },
      { hours = 240, group = "demiadmin", name = "Gold Player" }
}

---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "donator", "moderator", "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 )


Can anyone help me find my error.

Offline riki137

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
  • lol wuttermelon
    • SapphireWebsites
Re: Auto promote problem
« Reply #1 on: September 08, 2010, 08:56:34 AM »
Same problem. But there is a new version. That will probably fix it, i didnt tried...

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Auto promote problem
« Reply #2 on: September 08, 2010, 05:02:06 PM »
I missed it early August and am now about to move it, but why the h*** was this posted in SVN stuff?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming