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

Lua Sandra.Lua not giving the potion belt addon

LIINDI

New Member
Joined
Mar 14, 2018
Messages
78
Solutions
1
Reaction score
3
Hello!

Does anyone have a proper Sandra.Lua script?
Mine works fine until the part where you're supposed to get the potion belt.
In my case she says this but doesn't add the belt..

Code:
18:45 ADMIN [1]: deposit
18:45 Sandra: Congratulations! Here, from now on you can wear our lovely potion belt as accessory.

18:47 ADMIN [1]: mage fluid belt
18:47 Sandra: To get mage fluid belt you need give me winning lottery ticket. Do you have it with you?
18:48 ADMIN [1]: yes
Then she says no more..


Here's the Sandra.Lua im using!
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
-- OTServ event handling functions end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end

        if msgcontains(msg, 'vial') then
                npcHandler:say('We have a special offer right now for depositing vials. Are you interested in hearing it?', cid)
                talk_state = 1
      elseif msgcontains(msg, 'yes') and talk_state == 1 then
             npcHandler:say('Great! I\'ve signed you up for our bonus for lottery {ticket}. From now on, you will have the chance to win the potion belt addon!', cid)
             talk_state = 0
      elseif msgcontains(msg, 'ticket') then
             npcHandler:say('Would you like to get a lottery ticket instead of the {deposit} for your vials.', cid)
             talk_state = 1
      elseif msgcontains(msg, 'deposit') and talk_state == 1 then        
            if getPlayerItemCount(cid, 7636) >= 100 or getPlayerItemCount(cid, 7635) >= 100 or getPlayerItemCount(cid, 7634) >= 100 then
                    npcHandler:say('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', cid)
            if doPlayerRemoveItem(cid, 7636,100) or doPlayerRemoveItem(cid, 7635,100) or doPlayerRemoveItem(cid, 7634,100) then
                    doPlayerAddItem(cid, 5957, 1)
                    talk_state = 0
            else
                npcHandler:say('Sorry you need 100 empty vials to you from the lottery ticket', cid)
                talkState[talkUser] = 0
                end
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('Ok thanks.', cid)
            talk_state = 0
        end
      
      
        elseif msgcontains(msg, 'mage fluid belt') then
        npcHandler:say('To get mage fluid belt you need give me winning lottery ticket. Do you have it with you?', cid)
        talk_state = 2
        elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerStorageValue(cid,22005) == -1 then
        if isPremium(cid) then
        if getPlayerSex(cid) == 1 then
        npcHandler:say('It seems you are male isnt there you get that part of this addon!')
        elseif getPlayerSex(cid) == 0 then
        if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The mage fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,22005,1)          
            doPlayerAddOutfit(cid, 138, 1)
            talk_state = 0        
        end  
        end
        else
            npcHandler:say('You do not have all the required items.')
        end
        else
        npcHandler:say('It seems you already have this addon, don\'t you try to mock me son!')
        end


        elseif msgcontains(msg, 'summoner fluid belt') then
        npcHandler:say('To get summoner fluid belt you need give me winning lottery ticket. Do you have it with you?', cid)
        talk_state = 3
        elseif msgcontains(msg, 'yes') and talk_state == 3 and getPlayerStorageValue(cid,22011) == -1 then
        if isPremium(cid) then
        if getPlayerSex(cid) == 0 then
        npcHandler:say('It seems you are female isnt there you get that part of this addon!')
        elseif getPlayerSex(cid) == 1 then
        if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The summoner fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,22011,1)          
            doPlayerAddOutfit(cid, 133, 1)
            talk_state = 0        
        end  
        end
        else
            npcHandler:say('You do not have all the required items.')
        end
        else
        npcHandler:say('It seems you already have this addon, don\'t you try to mock me son!')
        end  
      
        return TRUE
end
end


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

Would really appreciate a working script for her!
 
Last edited:
Back
Top