ULX

Poll

Was this module useful, and helpful?

Yes it was :)
114 (95.8%)
No it was not :(
5 (4.2%)

Total Members Voted: 118

Author Topic: Autopromote XGUI Version [4.09v]  (Read 91498 times)

0 Members and 2 Guests are viewing this topic.

Offline Aerosoft

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #75 on: August 10, 2015, 06:37:32 PM »
Hi! I'm having a problem with the ulx auto promote addon where it is spamming an error in my console

Code: [Select]
ULib queue error: addons/ulx_auto_promote/lua/ulx/xgui/server/sv_apromote.lua:110: attempt to call method 'GetUTimeTotalTime' (a nil value)
Here is the lua code

Code: [Select]
---------------------------------------------------------------
// APromoteGUI by Lead4u, Modified and Fixed by Mr. Apple    //
// Version: 3.5 Full Release                                 //
---------------------------------------------------------------

resource.AddFile("materials/gui/silkicons/cog.vmt")

ULib.ucl.registerAccess( "apromote_settings", "superadmin", "Allows managing all settings related to APromote.", "XGUI" )

local APromote = {}
local set = {} APromote["set"] = set
local grp = {} APromote["grp"] = grp

util.AddNetworkString( "doApShinys" )

local function Save()
file.Write( "ulx/apromote.txt", ULib.makeKeyValues( APromote ) )
end

local function APUpdateGroups()
//for added groups
for k, v in pairs(ULib.ucl.groups) do
if ( APromote["grp"][k] == nil and k != "user") then
print("Added " .. k .. " to APromote.")
APromote["grp"][k] = -1
end
end
for k, v in pairs(APromote["grp"]) do
if ( k != nil and !ULib.ucl.groups[k]) or k == "user" then
print("Removed " .. k .. " from APromote.")
APromote["grp"][k] = nil
end
end
xgui.sendDataTable( {}, "AP_SendData" )
Save()
end

local function loadAP()
xgui.addDataType( "AP_SendData", function() return APromote["grp"] end, "apromote_settings", 0, 0 )

// File Stuffs
if not file.Exists( "ulx/apromote.txt", "DATA" ) then
for k, v in pairs(ULib.ucl.groups) do
APromote["grp"][k] = -1
end
APromote["set"]["ap_enabled"] = 1
APromote["set"]["ap_snd_enabled"] = 1
APromote["set"]["ap_snd_scope"] = 1
APromote["set"]["ap_effect_enabled"] = 1
APromote["set"]["ap_auto_demote"] = 0
Save()
else
APromote = ULib.parseKeyValues( file.Read( "ulx/apromote.txt" ) )
end
// ConVars
ULib.replicatedWritableCvar("ap_enabled","rep_ap_enabled", APromote["set"]["ap_enabled"],false,false,"apromote_settings")
ULib.replicatedWritableCvar("ap_snd_enabled","rep_ap_snd_enabled",APromote["set"]["ap_snd_enabled"] ,false,false,"apromote_settings")
ULib.replicatedWritableCvar("ap_snd_scope","rep_ap_snd_scope",APromote["set"]["ap_snd_scope"] ,false,false,"apromote_settings")
ULib.replicatedWritableCvar("ap_effect_enabled","rep_ap_effect_enabled",APromote["set"]["ap_effect_enabled"] ,false,false,"apromote_settings")
ULib.replicatedWritableCvar("ap_auto_demote","rep_ap_auto_demote",APromote["set"]["ap_auto_demote"] ,false,false,"apromote_settings")
// Data and Hook Add
xgui.sendDataTable( {}, "AP_SendData" )
hook.Add( "UCLChanged", "doApUpdateSV", APUpdateGroups )
end

local function cVarChange( sv_cvar, cl_cvar, ply, old_val, new_val )
if ( sv_cvar =="ap_enabled" or sv_cvar=="ap_snd_enabled" or sv_cvar=="ap_snd_scope" or sv_cvar=="ap_effect_enabled" or sv_cvar=="ap_auto_demote" ) then
APromote["set"][sv_cvar] = new_val
Save()
end
end

local function PlayRankSound( ply )
if ( GetConVarNumber( "ap_effect_enabled" ) == 1 ) then
net.Start( "doApShinys" )
net.WriteEntity( ply )
net.Broadcast()
end
if ( GetConVarNumber( "ap_snd_enabled" ) == 1) then
if ( GetConVarNumber( "ap_snd_scope" ) == 1 ) then
for k, v in pairs(player.GetAll()) do
v:SendLua("surface.PlaySound( \"/garrysmod/save_load1.wav\" )")
end
elseif ( GetConVarNumber( "ap_snd_scope" ) == 0) then
ply:SendLua("surface.PlaySound( \"/garrysmod/save_load1.wav\" )")
end
end
end

local function isValidCommand( command, compare )
for k, v in pairs( compare ) do
if ( command[1] == k ) then
if ( type( command[2] == "number")) then
return true
end
end
end
return false
end

concommand.Add("APGroup", function( ply, cmd, args )
if (ply:query( "apromote_settings" ) and isValidCommand( args, APromote["grp"] )) then
APromote["grp"][args[1]] = tonumber(args[2])
xgui.sendDataTable( {}, "AP_SendData" )
Save()
end
end)
 
local function checkPlayer( ply )
local plyhours = math.floor( ply:GetUTimeTotalTime() / 3600 )
local usrgrp = ply:GetUserGroup()
local Rank = ""
local Hours = 0

for k, v in pairs( APromote["grp"] ) do
if plyhours >= tonumber( v ) and tonumber( v ) >= Hours then
if tonumber( v ) >= 0 then
Rank = k
Hours = tonumber( v )
end
end
end
if (!ply:IsUserGroup(Rank) and Rank != "") then
if tonumber( APromote["grp"][usrgrp]) != -1 then
if not tobool( GetConVarNumber( "ap_auto_demote" ) ) and APromote["grp"][usrgrp] != nil
and Hours < tonumber( APromote["grp"][usrgrp] ) then
return
else
if ply:IsConnected() then
RunConsoleCommand( "ulx", "adduserid", ply:SteamID(), Rank )
PlayRankSound( ply )
end
end
end
end
end

timer.Create("doAPUpdateTimer", 10, 0, function()
if not tobool( GetConVarNumber( "ap_enabled" ) ) then return end
for k, v in pairs( player.GetAll() ) do
if (v:IsPlayer() and v:IsValid() and !v:IsBot()) then
ULib.queueFunctionCall( checkPlayer, v )
end
end
end)

xgui.addSVModule( "AP_LoadAP", loadAP )
hook.Add( "ULibReplicatedCvarChanged", "APGroupCVAR", cVarChange )

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Autopromote XGUI Version [4.09v]
« Reply #76 on: August 14, 2015, 07:50:45 AM »
Do you have UTime installed (which the first post says is required)?

EDIT: nvm, you posted twice about it.

http://forums.ulyssesmod.net/index.php/topic,8864.msg45239.html#new
« Last Edit: August 14, 2015, 07:52:49 AM by Aaron113 »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Autopromote XGUI Version [4.09v]
« Reply #77 on: August 14, 2015, 10:00:23 PM »
Do you have UTime installed (which the first post says is required)?
EDIT: nvm, you posted twice about it.
And he's still not answered that question to either post.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Roberito

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #78 on: December 23, 2015, 12:34:53 PM »
hey i added your ulx auto promote addons and i added utime to my server but auto promote wont show up in my !menu please help!

Offline theGoldTrigger

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #79 on: December 27, 2015, 02:26:36 PM »
Question:
Let's say I have a group called member that I do not want people to be auto promoted to and a group called trusted that I do want people to be auto promoted to. Is it possible to set someone to the member group manually and still have them be autopromoted to trusted?

Ex: of what I mean

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Autopromote XGUI Version [4.09v]
« Reply #80 on: December 31, 2015, 10:36:18 PM »
Question:
Let's say I have a group called member that I do not want people to be auto promoted to and a group called trusted that I do want people to be auto promoted to. Is it possible to set someone to the member group manually and still have them be autopromoted to trusted?

Ex: of what I mean

[/quote

No, that's literally impossible with ulx/ulib in general. You'd have to extremely alter ulib/ulx.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline ????????? ????????

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #81 on: January 02, 2016, 10:52:04 PM »
From yesterday autopromote and awarn doesnt work on my server. I got 3 errors when i have started server.

I have tried to update all these addons (ulx, ulib, utime, apromote, awarn) but nothing changes. One thing that i know right now, that everything gone wrong with apromote. If i delete it - everything works fine. But with it i got 3 errors on start and nothing works properly.

P.S. Sorry for my login name.. Login with Google

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Autopromote XGUI Version [4.09v]
« Reply #82 on: January 07, 2016, 02:39:00 AM »
From yesterday autopromote and awarn doesnt work on my server. I got 3 errors when i have started server.

I have tried to update all these addons (ulx, ulib, utime, apromote, awarn) but nothing changes. One thing that i know right now, that everything gone wrong with apromote. If i delete it - everything works fine. But with it i got 3 errors on start and nothing works properly.

P.S. Sorry for my login name.. Login with Google

Post this in the general help here: http://forums.ulyssesmod.net/index.php/board,11.0.html

This is an an issue I can fix, due to it not being my addon's issue. My suggestion is delete ulx/ulib addon folders and reinstall it
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline TT=open again Isabella Jazzlyn

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #83 on: January 22, 2016, 01:33:20 AM »
I uploaded the addon on my server. but it does not show up did i forgot something?

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Autopromote XGUI Version [4.09v]
« Reply #84 on: January 22, 2016, 08:07:03 AM »
where did you put the addon's folder?

did you restart the server?

what did you do to check if the addon was installed? "it does not show up"
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline TT=open again Isabella Jazzlyn

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Autopromote XGUI Version [4.09v]
« Reply #85 on: January 23, 2016, 02:09:26 PM »
it is fixed now uploaded it wrong my bad

Offline Gr0m3r

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: Autopromote XGUI Version [4.09v]
« Reply #86 on: April 13, 2017, 06:29:25 AM »
Thanks, this tool is really helpful :D

Offline Codingale

  • Newbie
  • *
  • Posts: 4
  • Karma: 1
Re: Autopromote XGUI Version [4.09v]
« Reply #87 on: September 12, 2017, 06:02:25 PM »
Not sure if this has been asked before, but can you have multiple auto-promote trees?


EG:

user -> Newbie (1hr) -> Regular (3hr)
BUT also have something at the same time like
Trusted Newbie (-1) -> Trusted Regular (1hr)

Is there a way for that or would I have to either, A find something else or B just give up


I mean I could modify it probably but, I'm far to lazy for that..

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Autopromote XGUI Version [4.09v]
« Reply #88 on: September 12, 2017, 06:51:44 PM »
This does not have branches.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Codingale

  • Newbie
  • *
  • Posts: 4
  • Karma: 1
Re: Autopromote XGUI Version [4.09v]
« Reply #89 on: September 12, 2017, 06:57:27 PM »
Know of any that do have branches by chance? Thanks and sorry for getting of topic.