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

[HELP] Having some problems with two of my npcs...

chito

Learning Lua
Joined
Apr 18, 2008
Messages
87
Reaction score
1
Location
Mexico
'end' expected (to close 'if' at line 35) near 'elseif'
Code:
function onCreatureSay(cid, type, msg)
  		if((msg == "hi") and not (isFocused(cid))) then
		selfSay("Hi..., ".. getCreatureName(cid) ..",Im dying alive i need something to get healthy.", cid, TRUE)
		addFocus(cid)
		
		queststatus = getPlayerStorageValue(cid, 30031)
		elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) and queststatus == -1 then
		selfSay("I need a magical sulphur to get healthy otherwise im going to die and no one is going to know the hidden place.", cid, TRUE)		
		selfSay("Did you have the magic sulphur that i need?.", cid)

		elseif((isFocused(cid)) and (msg == "no")) then
		selfSay("Hurry up, i need it.", cid)
		
		elseif((isFocused(cid)) and (msg == "yes")) and (doPlayerRemoveItem(cid,5904,1)) == 1 and queststatus == -1 then
				setPlayerStorageValue(cid, 30031, 1)
				setPlayerStorageValue(cid, 1979, 1)
				selfSay("Thank you..., ".. getCreatureName(cid) ..", Im going to live more years.", cid)
				selfSay("I gave you the acces to the hell, just click on the lava fountain, Good luck young adventurer.", cid)
				else
				selfSay("".. getCreatureName(cid) ..", you are not funny bring me the sulphur.", cid)
					

		elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
		selfSay("Take care, remember, the more you know the less you feel.", cid)
		removeFocus(cid)

		elseif((isFocused(cid)) and (msg == "daemon")) then
				selfSay("He is the god of the dammed.", cid)
		
		elseif((isFocused(cid)) and (msg == "herodes")) then
				selfSay("The hero of Mintwallin.", cid)
		
		end
end


And


Code:
function onCreatureSay(cid, type, msg)
  		if((msg == "hi") and not (isFocused(cid))) then
		selfSay("Welcome, ".. getCreatureName(cid) ..".What's going on?", cid, TRUE)
		addFocus(cid)

			queststatus = getPlayerStorageValue(cid, 2350)
		elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) and queststatus == -1 then
			selfSay("So you are going to do the testa mission?", cid, TRUE)
			else
			selfSay("You already finished the first mission.", cid, TRUE)

		elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) and queststatus == 1 then
			selfSay("So you are going to finish the testa mission now?", cid, TRUE)
			else
			selfSay("You already finished the last mission.", cid, TRUE)

		elseif((isFocused(cid)) and (msg == "yes")) then
			setPlayerStorageValue(cid,2350,1)
			selfSay("You got the acces to the first castle.", cid, TRUE)
			
		elseif((isFocused(cid)) and (msg == "yes")) then
			setPlayerStorageValue(cid,2350,2)
			selfSay("You got the acces to the second castle.", cid, TRUE)

		elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
			selfSay("Oh may gosh am drunken beermaster!!.", cid)
			removeFocus(cid)
		end		
end

Tell me how to improve and make them with lesser lines please. I not pretty good at this.
 
error on second one?

First script, should work:

Code:
function onCreatureSay(cid, type, msg)
 	if((msg == "hi") and not (isFocused(cid))) then
		selfSay("Hi..., ".. getCreatureName(cid) ..",Im dying alive i need something to get healthy.", cid, TRUE)
		addFocus(cid)
		queststatus = getPlayerStorageValue(cid, 30031)
	elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) and queststatus == -1 then
		selfSay("I need a magical sulphur to get healthy otherwise im going to die and no one is going to know the hidden place.", cid, TRUE)		
		selfSay("Did you have the magic sulphur that i need?.", cid)
	elseif((isFocused(cid)) and (msg == "no")) then
		selfSay("Hurry up, i need it.", cid)
	elseif((isFocused(cid)) and (msg == "yes")) and queststatus == -1 then
		if doPlayerRemoveItem(cid,5904,1) == 1 then
			setPlayerStorageValue(cid, 30031, 1)
			setPlayerStorageValue(cid, 1979, 1)
			selfSay("Thank you..., ".. getCreatureName(cid) ..", Im going to live more years.", cid)
			selfSay("I gave you the acces to the hell, just click on the lava fountain, Good luck young adventurer.", cid)
		else
			selfSay("".. getCreatureName(cid) ..", you are not funny bring me the sulphur.", cid)
		end
	elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
		selfSay("Take care, remember, the more you know the less you feel.", cid)
		removeFocus(cid)
	elseif((isFocused(cid)) and (msg == "daemon")) then
			selfSay("He is the god of the dammed.", cid)
	elseif((isFocused(cid)) and (msg == "herodes")) then
			selfSay("The hero of Mintwallin.", cid)
	end
end

Second:

Code:
function onCreatureSay(cid, type, msg)
  	if((msg == "hi") and not (isFocused(cid))) then
		selfSay("Welcome, ".. getCreatureName(cid) ..".What's going on?", cid, TRUE)
		addFocus(cid)
		queststatus = getPlayerStorageValue(cid, 2350)
	elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) then
	if queststatus == -1 then
		selfSay("So you are going to do the testa mission?", cid, TRUE)
	else
		selfSay("You already finished the first mission.", cid, TRUE)
	end
	elseif((isFocused(cid)) and (msg == "mission" or msg == "quest")) then
		if queststatus == 1 then
			selfSay("So you are going to finish the testa mission now?", cid, TRUE)
		else
			selfSay("You already finished the last mission.", cid, TRUE)
		end
	elseif((isFocused(cid)) and (msg == "yes")) then
		setPlayerStorageValue(cid,2350,1)
		selfSay("You got the acces to the first castle.", cid, TRUE)		
	elseif((isFocused(cid)) and (msg == "yes")) then
		setPlayerStorageValue(cid,2350,2)
		selfSay("You got the acces to the second castle.", cid, TRUE)
	elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
		selfSay("Oh may gosh am drunken beermaster!!.", cid)
		removeFocus(cid)
	end		
end
 
Back
Top