ULX

Author Topic: AutoPromote not working  (Read 2444 times)

0 Members and 1 Guest are viewing this topic.

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
AutoPromote not working
« on: June 29, 2015, 12:28:32 PM »
http://steamcommunity.com/id/dogeyy/screenshot/447329337538937268

Evidence of my time I'm having.

In my code it says this:

Code: [Select]
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 = 5, group = "member", name = "Member" }
}

---------IF A PLAYER IS A MEMBER OF THESE GROUPS THEY WONT GET PROMOTED.......EVER
excludes = { "premium", "moderator", "admin", "superadmin", "founder", "vip", "vip+", "ultravip", "helper" }

---------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 )

I got UTime installed, as it needs that addon to work with it, have installed the most recent version, both of them., but it still doesn't promote me to member after 5 hours of waiting.

I am in the user group so it should promote me normally, right?
« Last Edit: June 30, 2015, 08:22:09 AM by Janjakob2000 »

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: AutoPromote not working
« Reply #1 on: July 01, 2015, 08:10:50 AM »
Can anyone out there help me?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: AutoPromote not working
« Reply #2 on: July 01, 2015, 04:40:46 PM »
There are a few different Autopromote releases in our Releases section of the forum.
You'd likely get more help from the one for which you downloaded.
Make sure you're using the latest version of whichever release you are using too.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: AutoPromote not working
« Reply #3 on: July 02, 2015, 06:05:40 AM »
I got this one http://forums.ulyssesmod.net/index.php?topic=3826.0

the latest version of this does not work with the latest version of UTime

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: AutoPromote not working
« Reply #4 on: July 02, 2015, 10:29:06 AM »
You got one from our Archived section.
They're archived for a reason.
From http://forums.ulyssesmod.net/index.php/topic,6634.0.html
THE LONG
This section of Ulysses Forums is reasonably self explanatory.
It's intended for releases that are no longer supported, contain dead links, or any other release that no longer work in their present state.

You'd likely have better luck with and more support from a release not in the archives.
There are these;
Autopromote XGUI Version [4.09v]
AutoPromote: The Continuation
APromote GUI

One of those is much more likely to work when installed an configured correctly than the one from Release Archives.
While reviewing the pages of our Releases section, I saw some other related addons that might be good.
Tempadd. It's not automatic, but is a temporary access change addon.
UTime Hour changer. Allows changing of time for players.
There was a UTime utilities too.

Just go through all the pages of our releases section, one by one. You might find more tools you need and didn't even know it.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Janjakob2000

  • Jr. Member
  • **
  • Posts: 65
  • Karma: 0
Re: AutoPromote not working
« Reply #5 on: July 02, 2015, 12:00:20 PM »
I love you <3