local promotion = player:getVocation():getPromotion()
if not promotion or promotion:getId() == 0 then
return true
end
player:setVocation(Vocation(promotion:getId()))
function onSay(cid, words, param)
local player = Player(cid)
if not player:isPremium() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You need a premium account in order to get promoted.')
return false
end
local promotion = player:getVocation():getPromotion()
if not promotion or promotion:getId() == 0 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are already promoted!')
return false
end
player:setVocation(Vocation(promotion:getId()))
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are now promoted.')
return false
end
How do I do talkaction to promote promotion 1.0 in tfs?
Ex: !Promote
Does anyone know of any script?
Ok sry.You have to write this type of threads in [Request].
Code:function onSay(cid, words, param) local player = Player(cid) if not player:isPremium() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You need a premium account in order to get promoted.') return false end local promotion = player:getVocation():getPromotion() if not promotion or promotion:getId() == 0 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are already promoted!') return false end player:setVocation(Vocation(promotion:getId())) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are now promoted.') return false end
Add this function to your global.lua, https://github.com/otland/forgottenserver/blob/master/data/global.lua#L77-79Look this error.
data/talkactions/scripts/promote.luanSay
data/talkactions/scripts/promote.lua:3: attempt to call method 'isPremium' (a nil value)
stack traceback:
[C]: in function 'isPremium'
data/talkactions/scripts/promote.lua:3: in function <data/talkactions/scripts/promote.lua:1>