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

Script Need Help With Fixing (easy one -.-)

TriamerA

The Mystic One.
Joined
Nov 16, 2008
Messages
1,256
Reaction score
16
Location
Poland
Code:
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

	if(msgcontains(msg, 'addon') or msgcontains(msg, 'addons')) then
		selfSay('I can Give you Addon, but not for free of course!! Did you bring item and item???', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if (getPlayerItemCount(cid, 5912) > 11 and (getPlayerItemCount(cid, 5913) > 10) then
				doPlayerRemoveItem(cid, 5912, 11)
				doPlayerRemoveItem(cid, 5913, 10)
				setPlayerStorageValue(cid,6991,1)
				selfSay('Here you are.', cid)
			else
				selfSay('Sorry, you don\'t have that items.', cid)
			end
		else
			selfSay('Sorry, you don\'t have the items.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end
end

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

And It's all the time displaying that ')' is missing near then at 22 line ;/ could someone help?
 
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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(msgcontains(msg, 'addon') or msgcontains(msg, 'addons')) then
		selfSay('I can Give you Addon, but not for free of course!! Did you bring item and item???', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if (getPlayerItemCount(cid, 5912) > 11) and (getPlayerItemCount(cid, 5913) > 10) then
				doPlayerRemoveItem(cid, 5912, 11)
				doPlayerRemoveItem(cid, 5913, 10)
				setPlayerStorageValue(cid,6991,1)
				selfSay('Here you are.', cid)
			else
				selfSay('Sorry, you don\'t have that items.', cid)
			end
		else
			selfSay('Sorry, you don\'t have the items.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end
end

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

I hope it work now ;).

Regards,
Shawak
 
Back
Top