• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Action [0.4] Free Premium

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
22
Hello OTLanders, I'd like to post a script that may help someone with it, I know that script like this already exist in the forum, this can be used once per character ONLY.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 6945) == -1 then
if getPlayerPremiumDays(cid) < 365 then
doPlayerAddPremiumDays(cid, 3)
doCreatureSay(cid, "Premium")
doPlayerPopupFYI(cid, "We have added 3 free premium days to your account!\nEnjoy it!.")
doBroadcastMessage("Premium: Congratulation "..getCreatureName(cid).." has added 3 Free Premium days to his account.")
doRemoveItem(item.uid)
setPlayerStorageValue(cid, 6945, 1)
else
doPlayerSendCancel(cid, "You can only have 1 year of premium account or less.")
end
else
doPlayerSendCancel(cid, "You already used free Premium, sorry you can\'t use it again, it's only once per character.")
end
return true
end
This is Free Vip too if you are using Kekox VIP system it will work good with you.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 64745) == -1 then
if getPlayerVipDays(cid) < 365 then
doAddVipDays(cid, 3)
doCreatureSay(cid, "VIP")
doPlayerPopupFYI(cid, "We have added 3 free vip days to your account!\nEnjoy it!.")
doBroadcastMessage("VIP : Congratulation "..getCreatureName(cid).." has added 3 Free VIP days to his account.")
doRemoveItem(item.uid)
setPlayerStorageValue(cid, 64745, 1)
else
doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
end
else
doPlayerSendCancel(cid, "You already used free VIP, sorry you can\'t use it again, it's only once per character.")
end
return true
end
TFS 0.3.*
TESTED on TFS 0.4
 
You can already get free premium in config.
This script to give you amount of free premium days if you are using a server depends on features of premium so this will be a gift to a player once only.
 
As i said before this item once only per character because of using Storagevalue, i hope so you understood what is the aim of this script :p
@Xeraphus
 
Ah, didn't really understand it's purpose.
My bad.
 
I setup your code for you a little better. I didn't test it though.
[EDIT] Added magic effect to it lol

Code:
local config = {
cancle = "You cannot use this item!",
success = " premium days have been added to your account!\nEnjoy!",
broadcast = ", has received 3 free days of premium!",
amount = 3,
effect = {
    msg = "Premium!",
    magic = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED},
    },
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 6945) <= 1 and 365 <= getPlayerPremiumDays(cid) then
        doPlayerSendCancel(cid, config.cancle)
        return true
   end

doPlayerAddPremiumDays(cid, config.amount)
doCreatureSay(cid, config.effect.msg)
doSendMagicEffect(getPlayerPosition(cid), config.effect.magic[math.random(#config.effect.magic)])
doPlayerPopupFYI(cid, config.amount..config.success)
doBroadcastMessage(getCreatureName(cid)..config.broadcast)
doRemoveItem(item.uid)
setPlayerStorageValue(cid, 6945, 1)
end
 
Last edited:
I setup your code for you a little better. I didn't test it though.
[EDIT] Added magic effect to it lol

Code:
local config = {
cancle = "You cannot use this item!",
success = " premium days have been added to your account!\nEnjoy!",
broadcast = ", has received 3 free days of premium!",
amount = 3,
effect = {
    msg = "Premium!",
    magic = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED},
    },
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 6945) <= 1 and 365 <= getPlayerPremiumDays(cid) then
        doPlayerSendCancel(cid, config.cancle)
        return true
   end

doPlayerAddPremiumDays(cid, config.amount)
doCreatureSay(cid, config.effect.msg)
doSendMagicEffect(getPlayerPosition(cid), config.effect.magic[math.random(#config.effect.magic)])
doPlayerPopupFYI(cid, config.amount..config.success)
doBroadcastMessage(getCreatureName(cid)..config.broadcast)
doRemoveItem(item.uid)
setPlayerStorageValue(cid, 6945, 1)
end
Thanks but i like to do it like that to send a cancel for what is missed or already done like if is it 365 premium days send a cancel message with full days etc and thanks again for your work, i'll learn from it :).
 
Thanks but i like to do it like that to send a cancel for what is missed or already done like if is it 365 premium days send a cancel message with full days etc and thanks again for your work, i'll learn from it :).
Yeah I understand. I do it to learn aswell xD It is a nice promotional item.
 
Back
Top