• Print

Author Topic: How do I demote someone and not have auto promote promote them back?  (Read 5834 times)

0 Members and 1 Guest are viewing this topic.

Offline conviper30

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
I have auto promote installed as well as ULX and Utime.

Let's say for example these are my ranks I have on my server:

Client - 0-4 hours
Respected - 5 hours
Member - 10 hours
Senior Member - 20 hours

Someone ranked up to Senior Member by playing on the server and started to abuse the perks that are associated with the user group. So I want to demote them down to Client, once I do that auto promote promotes them back to Senior Member due to their time allotted on the server. How do I get around the auto promote and Utime affecting this? I love auto promote but it is a pain when trying to get this to work.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: How do I demote someone and not have auto promote promote them back?
« Reply #1 on: January 12, 2017, 11:54:15 am »
As far as I know, there's no simple workaround for this. If anything, I'm fairly certain you'd need to edit the actual code of APromote, especially around this area:

Code: Lua
  1. local function checkPlayer( ply )
  2.         local plyhours = math.floor( ply:GetUTimeTotalTime() / 3600 )
  3.         local usrgrp = ply:GetUserGroup()
  4.         local Rank = ""
  5.         local Hours = 0
  6.  
  7.         for k, v in pairs( APromote["grp"] ) do
  8.                 if plyhours >= tonumber( v ) and tonumber( v ) >= Hours then
  9.                         if tonumber( v ) >= 0 then
  10.                                 Rank = k
  11.                                 Hours = tonumber( v )
  12.                         end
  13.                 end
  14.         end
  15.         if (!ply:IsUserGroup(Rank) and Rank != "") then
  16.                 if tonumber( APromote["grp"][usrgrp]) != -1 then
  17.                         if not tobool( GetConVarNumber( "ap_auto_demote" ) ) and APromote["grp"][usrgrp] != nil
  18.                         and Hours < tonumber( APromote["grp"][usrgrp] ) then
  19.                                 return
  20.                         else
  21.                                 if ply:IsConnected() then
  22.                                         RunConsoleCommand( "ulx", "adduserid", ply:SteamID(), Rank )
  23.                                         PlayRankSound( ply )
  24.                                 end
  25.                         end
  26.                 end
  27.         end
  28. end
  29.  
  30. timer.Create("doAPUpdateTimer", 10, 0, function()
  31. if not tobool( GetConVarNumber( "ap_enabled" ) ) then return end
  32.         for k, v in pairs( player.GetAll() ) do
  33.                 if (v:IsPlayer() and v:IsValid() and !v:IsBot()) then
  34.                         ULib.queueFunctionCall( checkPlayer, v )
  35.                 end
  36.         end
  37. end)
  38.  
However, I'm not sure how to capture if a person is that rank and been demoted, or if they've never had that rank before. There may be some internal function that captures these changes, but I'm not sure.


Just realized I'm not really being helpful here, but I really am not sure as this was written a couple years ago, and not sure when it was last updated...


EDIT: There's probably a really convulted way of doing this... and just manually adding in a
Code: Lua
  1. if ply:SteamID() == "the steam id you don't want to be promoted" then return end
but you'd need to do that for a lot of them if it happens...


Another way, that's not a very good idea as it messes with core files, is edit the 'removeuser' command to add like do something like
Code: Lua
  1. SetPData( "repromote", "false" )
so then you could edit the APromote to be
Code: Lua
  1. if ply:GetPData( "repromote" ) == "false" then return end
which is a much easier way, but not a very good one because next ULX update you'd need to do it again and you're editing core files which is never a good idea.
« Last Edit: January 12, 2017, 11:58:06 am by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: How do I demote someone and not have auto promote promote them back?
« Reply #2 on: January 12, 2017, 02:00:25 pm »
instead of demoting them, why don't you just revoke the permissions they are abusing?

Say billy gets !gag as Senior Member and they are abusing it..

ulx userdeny billy "ulx gag"
ulx userdeny billy "ulx ungag"

This will deny that single user's permission without affecting the rest of the people in Senior Member, also they get to stay the rank they 'earned'

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: How do I demote someone and not have auto promote promote them back?
« Reply #3 on: January 12, 2017, 02:13:40 pm »
instead of demoting them, why don't you just revoke the permissions they are abusing?

Say billy gets !gag as Senior Member and they are abusing it..

ulx userdeny billy "ulx gag"
ulx userdeny billy "ulx ungag"

This will deny that single user's permission without affecting the rest of the people in Senior Member, also they get to stay the rank they 'earned'
Never thought of it that way, that's some good thinking [emoji108]

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline conviper30

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: How do I demote someone and not have auto promote promote them back?
« Reply #4 on: January 12, 2017, 02:33:33 pm »
not bad ideas at all, i guess it is more of the fact to demote them as a whole so they get reprimanded and lose the actual title you know? Do you guys know a way to delete their Utime in game or through the console? I was thinking that could also be another way since the Utime is the basis for determining which group they fall in.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: How do I demote someone and not have auto promote promote them back?
« Reply #5 on: January 12, 2017, 02:34:21 pm »
I know there is a 'settime' add-on out there somewhere. I have it on my server I just forget what it's called.

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline conviper30

  • Newbie
  • *
  • Posts: 3
  • Karma: 0

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: How do I demote someone and not have auto promote promote them back?
« Reply #7 on: January 12, 2017, 07:03:10 pm »
That's it.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: How do I demote someone and not have auto promote promote them back?
« Reply #8 on: January 12, 2017, 08:16:03 pm »
IMO, this question should have been asked in the autopromote release thread you're using, not the support section for ULib/ulx.
I'm not moving it at this time, because a ULX solution can be used, but, Apromote isn't recommended nor created by Team Ulysses.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: How do I demote someone and not have auto promote promote them back?
« Reply #9 on: January 12, 2017, 08:51:19 pm »
This is true, and in fact, autopromote WILL cause issues with your server and ULX down the road if you use it due to how it works and some limitations of ULX. Use at your own risk. :)

  • Print