• 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!

TFS 0.X 8.60 0.4 NPC Promotion with VIP coin price ID: 11192 Amount: 100 script no function

Enderlop

Banned User
Joined
Jan 10, 2024
Messages
93
Reaction score
16
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
    if (not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = cid
    msg = string.lower(msg)
    local vocations = {5, 6, 7, 8}
    local level = 717217

    if isInArray({"promotion", "promote", "promo"}, msg) then
        selfSay('You need to have 100 VIP COINS and be at level 717217!', cid)
        talkState[talkUser] = 1
    elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
        if isInArray(vocations, getPlayerVocation(cid):getId()) then
            if getPlayerLevel(cid) >= level then
                if getPlayerItemCount(cid, 11192) >= 100 then
                    doRemoveItem(cid, 11192, 100)
                    local newVocationId = getPlayerVocation(cid):getId() + 4
                    local newVocation = Vocation(newVocationId)
                    doPlayerSetVocation(cid, newVocation)
                    doSendMagicEffect(getPlayerPosition(cid), 12)
                    selfSay("Congratulations, you have been promoted!", cid)
                else
                    selfSay("You don't have enough VIP COINS to be promoted.", cid)
                end
            else
                selfSay("Sorry, you need to be at level " .. level .. " or above to be promoted!", cid)
            end
        else
            selfSay("Sorry, you cannot receive promotion.", cid)
        end
        talkState[talkUser] = 0
    elseif msg == "no" and talkState[talkUser] >= 1 then
        selfSay("Goodbye then.", cid)
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

local vocation = {
    [2] = 6,
    [3] = 7,
    [4] = 8
}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
    if (not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = cid
    msg = string.lower(msg)
    local level = 717217

    if isInArray({"promotion", "promote", "promo"}, msg) then
        selfSay("You need to have 100 VIP COINS and be at level 717217!", cid)
        talkState[talkUser] = 1
    elseif msg == "yes" and talkState[talkUser] == 1 then
        local playerVocation = getPlayerVocation(cid)
        if vocation[playerVocation] then
            if getPlayerLevel(cid) >= level then
                if getPlayerItemCount(cid, 11192) >= 100 then
                    doPlayerRemoveItem(cid, 11192, 100)
                    local newVocationId = vocation[playerVocation]
                    doPlayerSetVocation(cid, newVocationId)
                    doSendMagicEffect(getPlayerPosition(cid), 12)
                    selfSay("Congratulations, you've been promoted!", cid)
                else
                    selfSay("You do not have enough VIP COINS to be promoted.", cid)
                end
            else
                selfSay("Sorry, you need to be at level " .. level .. " or above to be promoted!", cid)
            end
        else
            selfSay("Sorry, you cannot receive promotion.", cid)
        end
        talkState[talkUser] = 0
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top