• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

npc Uzgod lipa

Astherq

Banned User
Joined
Apr 1, 2011
Messages
77
Reaction score
5
mam takie pytanie na szybko bo mi nie wychodzi jak jest npc Uzgod od obsidian knife to na rl gracz moze wykonac tylko raz to jak dobrze wiem
a ja bede mial tyle obsidianow ile draconian steelow lipa jest a nie moge storage dodac po yes i jak to na rl jest jak drugi raz do niego przyjdziesz z draconian stelem i lancem
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local item = 'You do not have the required items.'
local done = 'Here you have it.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'help') then
		selfSay('You can here change {draconian steel} for {obsidian knife}.', cid)


		elseif msgcontains(msg, 'obsidian knife') then
			if getPlayerItemCount(cid,5889) >= 1 then
				selfSay('You bringing me draconian steel and obsidian lance in exchange for obsidian knife?', cid)
				talk_state = 2
			else
				selfSay('I need a draconian steel, to give you the obsidian knife. 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,2425) >= 1 then
					if doPlayerRemoveItem(cid,2425,1) == true then
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'draconian steel') then
			if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1then
				selfSay('You bringing me draconian steel and obsidian lance in exchange for obsidian knife?', cid)
				talk_state = 4
			else
				selfSay('I need draconian steel and obsidian lance, to give you the obsidian knife. Come back when you have them.', cid)
				talk_state = 0
			end


		elseif msgcontains(msg, 'rtyutyuoyal sttyufgeel') then
			if getPlayerItemCount(cid,2487) >= 1 then
				selfSay('Did you bring me the Crown Armor ?', cid)
				talk_state = 8
			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 == 8 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerRemoveItem(cid,2487,1) == true then
						doPlayerAddItem(cid,5887,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'helfhgl strtydeel') then
			if getPlayerItemCount(cid,2462) >= 1 then
				selfSay('Did you bring me the Devil Helmet ?', cid)
				talk_state = 9
			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 == 9 then
			talk_state = 0
			if getPlayerItemCount(cid,2462) >= 1 then
					if doPlayerRemoveItem(cid,2462,1) == true then
						doPlayerAddItem(cid,5888,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'yes') then
			if talk_state == 1 then
				if getPlayerItemCount(cid,5889) >= 1 then
					if doPlayerRemoveItem(cid,5889, 1) == TRUE then
						doPlayerAddItem(cid, 5908, 1)
					end
				end
			selfSay(done, cid)					
			elseif talk_state == 2 then
				if getPlayerItemCount(cid,5889) >= 1 then
					if doPlayerRemoveItem(cid,5889, 1) == TRUE then
						doPlayerAddItem(cid, 5908, 1)
					end
				end
				selfSay(done, cid)
			elseif talk_state == 3 then
				if getPlayerItemCount(cid,5889) >= 1 then
					if doPlayerRemoveItem(cid,5889, 1) == TRUE then
						doPlayerAddItem(cid, 5908, 1)
					end
				end
				selfSay(done, cid)
			elseif talk_state == 4 then
				if getPlayerItemCount(cid,5889) >= 1 then
					if doPlayerRemoveItem(cid,5889, 1) == TRUE then
						doPlayerAddItem(cid, 5908, 1)
					end
				end
				selfSay(done, cid)
			else
				selfSay(item, 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())
 
masz za krótki skrypt za mało rozbudowany musisz znaleść inny coś w stylu
Code:
			elseif msgcontains(msg, 'co ma gracz napisac') then
			if getPlayerItemCount(cid,id itemu potrzebnego do wymiany) >= ilosc then
				npcHandler:say('Czy posiadasz XXXXX?')
				talk_state = 1
			else
				message_greet('Musisz mi przyniesc XXXX inaczej nie dostaniesz itemu.')
				talk_state = 0
			end
			elseif msgcontains(msg, 'tak') and talk_state == 0 then
			talk_state = 0
			if getPlayerItemCount(cid,id itemu potrzebnego do wymiany) >= ilosc then
			if doPlayerRemoveItem(cid,id itemu potrzebnego do wymiany, ilosc) == TRUE then
			doPlayerAddItem(cid, co ma dac graczowi, ilosc)
                        npcHandler:say('Lap ;p')
			end
			else
				npcHandler:say(havent_item)
			end
no i jeszcze do tego dodac storage potem w npc jesli gracz ma takie storage wtedy juz wwykonales tego questa
 
naucz sie porzadnie lua i wtedy sobie poradzisz, inaczej nie bedziesz mial tego skryptu =)
 
Back
Top