Problem z Djinem !

Status
Zamknięty.

Sinres

Active User
Zarejestrowany
Dołączył
Kwiecień 15, 2008
Posty
130
Liczba reakcji
6
M?j prbolem polega na tym ?e m?j djin, kt?ry ma za zadanie wymieni? mi np:crown armor na royal steel nie wymienia tego tzn. daje mi crown armor on go bierze a royal steela nie dostaje mam tak z ka?dym Sweaty Cyclopem lub Djinem wsadzalem ju? z 10 npc kt?rzy to robia i to samo nie otrzymuje royal steela b?dz innego przedmiotu zamienionego :(
Posiadam silnik TFS 0.3.4
Prosz? o pomoc!
Pozdrawiam.
 
Odp: Problem z Djinem !

Daj scritp tego djiina.
 
Odp: Problem z Djinem !

Kod:
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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
addon_need_premium = 'Sorry, you need a premium account to get addons.', cid
addon_have_already = 'Sorry, you already have this addon.', cid
addon_have_not_items = 'Sorry, you don\'t have these items.', cid
addon_give = 'Here you are.', cid
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
                    if msgcontains(msg, 'help') then
                    selfSay('You can here change some items for {spider silk yarn}, {chunk of crude iron}, {draconian steel}, {warrior sweat}, {magic sulpher}, {enchanted chicken wing}, {royal steel}, {hell steel}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth}, {red piece of cloth}.?', cid)
                              elseif msgcontains(msg, 'spider silk yarn') then
                              if getPlayerItemCount(cid,5879) >= 10 then
                                        selfSay('Did you bring me the 10 Giant Silks ?', cid)
                                        talk_state = 1
                              else
                                        selfSay('I need a 10 Giant Spider Silks, to give you the spider silk yarn. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                              elseif msgcontains(msg, 'yes') and talk_state == 1 then
                              talk_state = 0
                              if getPlayerItemCount(cid,5879) >= 10 then
                              if doPlayerRemoveItem(cid,5879, 10) == TRUE then
                              doPlayerAddItem(cid, 5886, 1)
                        selfSay('Here u are.', cid)
                              end
                              else
                                        selfSay(havent_item)
                              end
elseif msgcontains(msg, 'chunk of crude iron') then
if getPlayerItemCount(cid,2393) >=1 then
selfSay('Did you bring me the Giant Sword ?', cid)
talk_state = 2
else
selfSay('I need a Giant Sword to give you the chunk of crude iron. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == 1 then
selfSay(addon_give)
doPlayerAddItem(cid,5892,1)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
selfSay('Did you bring me Dragon Shield ?', cid)
talk_state = 3
else
selfSay('I need Dragon Shield, to give you the draconian steel. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == 1 then
doPlayerAddItem(cid,5889,1)
selfSay('Here u are.', cid)
end
else
selfSay(havent_item)
end
 
Odp: Problem z Djinem !

Kod:
  elseif msgcontains(msg, 'warrior sweat') then
                                        if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
                                                  selfSay('Did you bring me 4 warrior helmets?', cid)
                                                  talk_state = 4
                                        else
                                                  selfSay('I need 4 warrior helmets, to give you the warrior sweat. Come back when you have them.', cid)
                                                  talk_state = 0
                                        end
                    elseif msgcontains(msg, 'yes') and talk_state == 4 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
                                                  if doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 then
                                                            doPlayerAddItem(cid,5885,1)
                                                            selfSay('Here u are.', cid)
                                                  end
                                        else
                                        selfSay(havent_item)
                                        end
elseif msgcontains(msg, 'magic sulpher') then
if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
selfSay('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
selfSay('I need 3 fire swords, to give you the magic sulpher. Come back when you have them.', cid)
talk_state = 0
end
                    elseif msgcontains(msg, 'yes') and talk_state == 5 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
                                                  if doPlayerRemoveItem(cid,2392,1) == 1 and doPlayerRemoveItem(cid,2392,1) == 1 and doPlayerRemoveItem(cid,2392,1) == 1 then
                                                            doPlayerAddItem(cid,5904,1)
                                                            selfSay('Here u are.', cid)
                                        end
                              else
                                        selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'enchanted chicken wing') then
                              if getPlayerItemCount(cid,2195) >= 1 then
                                        selfSay('Did you bring me boots of haste?', cid)
                                        talk_state = 6
                              else
                                        selfSay('I need boots of haste, to give you the enchanted chicken wing. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 6 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2195) >= 1 then
                                                  if doPlayerRemoveItem(cid,2195,1) == 1 then
                                                            doPlayerAddItem(cid,5891,1)
                                                            selfSay('Here u are.', cid)
                                                  end
                              else
                                        selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'royal steel') then
                              if getPlayerItemCount(cid,2487) >= 1 then
                                        selfSay('Did you bring me the  Crown Armor ?', cid)
                                        talk_state = 7
                              else
                                        selfSay('I need Crown Armor, to give you the royal steel. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 7 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2487) >= 1 then
                                                  if doPlayerRemoveItem(cid,2487,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5887,1)
                                                  end
                              else
                                        selfSay('Here u are.', cid)
                              end
 elseif msgcontains(msg, 'hell steel') then
                              if getPlayerItemCount(cid,2462) >= 1 then
                                        selfSay('Did you bring me the  Devil Helmet ?', cid)
                                        talk_state = 8
                              else
                                        selfSay('I need a Devil Helmet, to give you the hell steel. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 8 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2462) >= 1 then
                                                  if doPlayerRemoveItem(cid,2462,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5888,1)
                                                  end
                              else
                                        selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'fighting spirit') then
                              if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
                                        selfSay('Did you bring me the 2 Royal Helmets?', cid)
                                        talk_state = 10
                              else
                                        selfSay('I need a 2 Royal Helmets, to give you the Fighting Spirit. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 10 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
                                                  if doPlayerRemoveItem(cid,2498,1) == 1 and doPlayerRemoveItem(cid,2498,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5884,1)
                                                  end
                              else
                                       selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'blue piece of cloth') then
                              if getPlayerItemCount(cid,2663) >= 1 then
                                        selfSay('Did you bring me the Mystic Turban ?', cid)
                                        talk_state = 12
                              else
                                        selfSay('I need a Mystic Turban, to give you the Blue Piece of Cloth. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 12 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2663) >= 1 then
                                                  if doPlayerRemoveItem(cid,2663,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5912,1)
                                                  end
                              else
                                        selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'green piece of cloth') then
                              if getPlayerItemCount(cid,2652) >= 1 then
                                        selfSay('Did you bring me the Green Tunic ?', cid)
                                        talk_state = 13
                              else
                                        selfSay('I need a Green Tunic, to give you the Green Piece of Cloth. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 13 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2652) >= 1 then
                                                  if doPlayerRemoveItem(cid,2652,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5910,1)
                                                  end
                              else
                                        selfSay('Here u are.', cid)
                              end
                    elseif msgcontains(msg, 'red piece of cloth') then
                              if getPlayerItemCount(cid,2655) >= 1 then
                                        selfSay('Did you bring me the Red Robe ?', cid)
                                        talk_state = 14
                              else
                                        selfSay('I need a Red Robe, to give you the Red Piece of Cloth. Come back when you have them.', cid)
                                        talk_state = 0
                              end
                    elseif msgcontains(msg, 'yes') and talk_state == 14 then
                              talk_state = 0
                              if getPlayerItemCount(cid,2655) >= 1 then
                                                  if doPlayerRemoveItem(cid,2655,1) == 1 then
                                                            selfSay('Here u are.', cid)
                                                            doPlayerAddItem(cid,5911,1)
                              end
                              else
                                        selfSay('Here u are.', cid)
                              end
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end
    -- 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.
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Odp: Problem z Djinem !

elseif msgcontains(msg, 'warrior sweat') then
if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
selfSay('Did you bring me 4 warrior helmets?', cid)
talk_state = 4
else
selfSay('I need 4 warrior helmets, to give you the warrior sweat. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 4 then
talk_state = 0
if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
if doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 and doPlayerRemoveItem(cid,2475,1) == 1 then
doPlayerAddItem(cid,5885,1)
selfSay('Here u are.', cid)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'magic sulpher') then
if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
selfSay('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
selfSay('I need 3 fire swords, to give you the magic sulpher. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 5 then
talk_state = 0
if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
if doPlayerRemoveItem(cid,2392,1) == 1 and doPlayerRemoveItem(cid,2392,1) == 1 and doPlayerRemoveItem(cid,2392,1) == 1 then
doPlayerAddItem(cid,5904,1)
selfSay('Here u are.', cid)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'enchanted chicken wing') then
if getPlayerItemCount(cid,2195) >= 1 then
selfSay('Did you bring me boots of haste?', cid)
talk_state = 6
else
selfSay('I need boots of haste, to give you the enchanted chicken wing. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 6 then
talk_state = 0
if getPlayerItemCount(cid,2195) >= 1 then
if doPlayerRemoveItem(cid,2195,1) == 1 then
doPlayerAddItem(cid,5891,1)
selfSay('Here u are.', cid)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'royal steel') then
if getPlayerItemCount(cid,2487) >= 1 then
selfSay('Did you bring me the Crown Armor ?', cid)
talk_state = 7
else
selfSay('I need Crown Armor, to give you the royal steel. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 7 then
talk_state = 0
if getPlayerItemCount(cid,2487) >= 1 then
if doPlayerRemoveItem(cid,2487,1) == 1 then
doPlayerAddItem(cid,5887,1)
selfSay('Here u are.', cid)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'hell steel') then
if getPlayerItemCount(cid,2462) >= 1 then
selfSay('Did you bring me the Devil Helmet ?', cid)
talk_state = 8
else
selfSay('I need a Devil Helmet, to give you the hell steel. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 8 then
talk_state = 0
if getPlayerItemCount(cid,2462) >= 1 then
if doPlayerRemoveItem(cid,2462,1) == 1 then
selfSay('Here u are.', cid)
doPlayerAddItem(cid,5888,1)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'fighting spirit') then
if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
selfSay('Did you bring me the 2 Royal Helmets?', cid)
talk_state = 10
else
selfSay('I need a 2 Royal Helmets, to give you the Fighting Spirit. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 10 then
talk_state = 0
if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
if doPlayerRemoveItem(cid,2498,1) == 1 and doPlayerRemoveItem(cid,2498,1) == 1 then
selfSay('Here u are.', cid)
doPlayerAddItem(cid,5884,1)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'blue piece of cloth') then
if getPlayerItemCount(cid,2663) >= 1 then
selfSay('Did you bring me the Mystic Turban ?', cid)
talk_state = 12
else
selfSay('I need a Mystic Turban, to give you the Blue Piece of Cloth. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 12 then
talk_state = 0
if getPlayerItemCount(cid,2663) >= 1 then
if doPlayerRemoveItem(cid,2663,1) == 1 then
selfSay('Here u are.', cid)
doPlayerAddItem(cid,5912,1)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'green piece of cloth') then
if getPlayerItemCount(cid,2652) >= 1 then
selfSay('Did you bring me the Green Tunic ?', cid)
talk_state = 13
else
selfSay('I need a Green Tunic, to give you the Green Piece of Cloth. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 13 then
talk_state = 0
if getPlayerItemCount(cid,2652) >= 1 then
if doPlayerRemoveItem(cid,2652,1) == 1 then
selfSay('Here u are.', cid)
doPlayerAddItem(cid,5910,1)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'red piece of cloth') then
if getPlayerItemCount(cid,2655) >= 1 then
selfSay('Did you bring me the Red Robe ?', cid)
talk_state = 14
else
selfSay('I need a Red Robe, to give you the Red Piece of Cloth. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 14 then
talk_state = 0
if getPlayerItemCount(cid,2655) >= 1 then
if doPlayerRemoveItem(cid,2655,1) == 1 then
selfSay('Here u are.', cid)
doPlayerAddItem(cid,5911,1)
end
else
selfSay('Here u are.', cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Wklej to Sprobuj moze cos to da niewiem bo wydaje mi sie ze dobrze jest
 
Status
Zamknięty.
Back
Do góry