Author Topic: Trial VIP?  (Read 1705 times)

0 Members and 2 Guests are viewing this topic.

Offline ryno893

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Trial VIP?
« on: June 20, 2014, 04:51:51 AM »
Hi, I wanted a command that would use tempadduser or anything of the sort to VIP, then after 3 hours demote them back to user. I'm still learning lua, and would love your help! With every piece of code I learn more, thanks!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Trial VIP?
« Reply #1 on: June 20, 2014, 06:00:56 AM »
Look at the code in tempadduser and the various autopromote  in the releases section of the forum for ideas?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Valgoid

  • Full Member
  • ***
  • Posts: 103
  • Karma: -15
  • Wanna Be Lua King
Re: Trial VIP?
« Reply #2 on: June 22, 2014, 01:31:08 PM »
Can you please rephrase that I don't understand.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Trial VIP?
« Reply #3 on: June 22, 2014, 10:20:43 PM »
Your first question isn't really clear either.
Do you want someone in trial VIP automatically, then automatically removed?
There are several autopromote scripts in our Releases section.
There is also a temporary add user addon.
If you want it all automated, look at both, see how they work, then mesh together.
If you simply want a tempadd user, see the release already there.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Mr Sweg

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Trial VIP?
« Reply #4 on: June 29, 2014, 11:12:40 AM »
Just made this rather quickly
You could improve upon this by recording if they've used their Trial by saving to a text file or using sqlite.
Code: [Select]
local lengthOfTrial = 60*2 //2 Hours
local textCommandForTrial = "!activateVipTrial"
function activateTrialVIP(ply, text, public)
    if IsValid(ply) and text == textCommandForTrial then
        RunConsoleCommand("ulx", "adduserid", ply:SteamID(), "VIP")
        timer.Simple(lengthOfTrial, function()
            RunConsoleCommand("ulx", "removeuser", ply:Nick())
        end)
    end
end
hook.Add("PlayerSay", "trialVIPlawlCTI", activateTrialVIP)
« Last Edit: June 29, 2014, 12:44:23 PM by Mr Sweg »