mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
Full Distribution
This commit is contained in:
25
data/talkactions/scripts/buyprem.lua
Normal file
25
data/talkactions/scripts/buyprem.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local config = {
|
||||
days = 90,
|
||||
maxDays = 365,
|
||||
price = 10000
|
||||
}
|
||||
|
||||
function onSay(player, words, param)
|
||||
if configManager.getBoolean(configKeys.FREE_PREMIUM) then
|
||||
return true
|
||||
end
|
||||
|
||||
if player:getPremiumDays() <= config.maxDays then
|
||||
if player:removeMoney(config.price) then
|
||||
player:addPremiumDays(config.days)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought " .. config.days .." days of premium account.")
|
||||
else
|
||||
player:sendCancelMessage("You don't have enough money, " .. config.maxDays .. " days premium account costs " .. config.price .. " gold coins.")
|
||||
player:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
end
|
||||
else
|
||||
player:sendCancelMessage("You can not buy more than " .. config.maxDays .. " days of premium account.")
|
||||
player:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
end
|
||||
return false
|
||||
end
|
Reference in New Issue
Block a user