Skip to content

Commit

Permalink
chore: small adjustments to VIP functions
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Apr 17, 2024
1 parent 62a20ca commit 4c7afba
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions data/libs/systems/vip.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
local config = {
activationMessage = "You have received %s VIP days.",
activationMessageType = MESSAGE_EVENT_ADVANCE,

expirationMessage = "Your VIP days ran out.",
expirationMessageType = MESSAGE_ADMINISTRATOR,
expirationMessage = "Your VIP days have expired.",
vipDaysInfiniteMessage = "You have an infinite amount of VIP days remaining.",
noVipStatusMessage = "You do not have VIP status on your account.",
vipTimeRemainingMessage = "You have %s of VIP time remaining.",

outfits = {},
mounts = {},
}

function Player.onRemoveVip(self)
self:sendTextMessage(config.expirationMessageType, config.expirationMessage)
self:sendTextMessage(MESSAGE_ADMINISTRATOR, config.expirationMessage)

for _, outfit in ipairs(config.outfits) do
self:removeOutfit(outfit)
Expand All @@ -28,6 +28,7 @@ function Player.onRemoveVip(self)
playerOutfit.lookType = 128
end
playerOutfit.lookAddons = 0

self:setOutfit(playerOutfit)
end

Expand All @@ -36,7 +37,7 @@ end

function Player.onAddVip(self, days, silent)
if not silent then
self:sendTextMessage(config.activationMessageType, string.format(config.activationMessage, days))
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(config.activationMessage, days))
end

for _, outfit in ipairs(config.outfits) do
Expand All @@ -52,16 +53,15 @@ end

function CheckPremiumAndPrint(player, msgType)
if player:getVipDays() == 0xFFFF then
player:sendTextMessage(msgType, "You have infinite amount of VIP days left.")
player:sendTextMessage(msgType, config.vipDaysInfiniteMessage)
return true
end

local playerVipTime = player:getVipTime()
if playerVipTime < os.time() then
local msg = "You do not have VIP on your account."
player:sendTextMessage(msgType, msg)
player:sendTextMessage(msgType, config.noVipStatusMessage)
return true
end

player:sendTextMessage(msgType, string.format("You have %s of VIP time left.", getFormattedTimeRemaining(playerVipTime)))
player:sendTextMessage(msgType, string.format(config.vipTimeRemainingMessage, getFormattedTimeRemaining(playerVipTime)))
end

0 comments on commit 4c7afba

Please sign in to comment.