Ulysses

General => Developers Corner => Topic started by: ryno893 on June 20, 2014, 04:51:51 AM

Title: Trial VIP?
Post by: ryno893 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!
Title: Re: Trial VIP?
Post by: JamminR 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?
Title: Re: Trial VIP?
Post by: Valgoid on June 22, 2014, 01:31:08 PM
Can you please rephrase that I don't understand.
Title: Re: Trial VIP?
Post by: JamminR 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.
Title: Re: Trial VIP?
Post by: Mr Sweg 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)