General > Developers Corner

Trial VIP?

(1/1)

ryno893:
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!

JamminR:
Look at the code in tempadduser and the various autopromote  in the releases section of the forum for ideas?

Valgoid:
Can you please rephrase that I don't understand.

JamminR:
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.

Mr Sweg:
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: ---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)

--- End code ---

Navigation

[0] Message Index

Go to full version