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

[Help] Demonoak.lua crashes server.

Slife

Scripter
Joined
May 19, 2008
Messages
17
Reaction score
0
I had edited a Demon Oak script to fit my necessities and when I enter it goes well, i can kill demon oak. But when I exit, the server crashes.
What's the problem (here's the code):
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
treepos = {x=32716, y=32345, z=7, stackpos=2}
treepoe = {x=32716, y=32345, z=7, stackpos=1}
treepos2 = {x=32714, y=32350, z=7, stackpos=1} --- position of left arm
treepos3 = {x=32716, y=32349, z=7, stackpos=1} --- position of crow
treepos4 = {x=32716, y=32352, z=7, stackpos=1} --- position of mouth
monster1 = {x=32718, y=32347, z=7}
monster2 = {x=32725, y=32348, z=7}
monster3 = {x=32717, y=32353, z=7}
monster4 = {x=32725, y=32353, z=7}
tree = getThingfromPos(treepos).uid
trex = getThingfromPos(treepoe).uid
tree2 = getThingfromPos(treepos2).uid
tree3 = getThingfromPos(treepos3).uid
tree4 = getThingfromPos(treepos4).uid
playerPos = getCreaturePosition(cid)
local randomizer = math.random(1,6)
queststatus = getPlayerStorageValue(cid,8181)
queststatus2 = getPlayerStorageValue(cid,8282)
queststatus3 = getPlayerStorageValue(cid,8383)
queststatus4 = getPlayerStorageValue(cid,8484)
Level = getPlayerLevel(cid)
local pos1= getPlayerPosition(cid)
local exitPos = {x=32716, y=32345, z=7}
local EnterPos = {x=32716, y=32346, z=7}

	if getPlayerStorageValue(cid, 15200) == 4 and itemEx.itemid == 2709 and itemEx.actionid == 7788 and Level >= 120 then

		doRemoveItem(tree)
		doTeleportThing(cid, EnterPos, TRUE)
		setPlayerStorageValue(cid,8181,1)

	elseif getPlayerStorageValue(cid, 15200) == -1 and itemEx.itemid == 2709 and itemEx.actionid == 7788 and Level >= 120 then

		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You haven't talked to Oldrak.")
		
	elseif getPlayerStorageValue(cid, 15200) == 4 and getPlayerStorageValue(cid, 8181) == -1 and itemEx.itemid == 2709 and itemEx.actionid == 7787 then
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "A player is already doing this quest.")

	elseif getPlayerStorageValue(cid, 15200) == 4 and getPlayerStorageValue(cid, 8181) >= 1 and getPlayerStorageValue(cid, 8585) == -1 and itemEx.itemid == 2709 and itemEx.actionid == 7788 then
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You try to kill Demon Oak and you die, and with you, your reward.")

	elseif getPlayerStorageValue(cid, 15200) == 4 and getPlayerStorageValue(cid, 8181) >= 1 and getPlayerStorageValue(cid, 8585) == 1 and itemEx.itemid == 2709 and itemEx.actionid == 7788 then
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You had defeated Demon Oak.")
	end

	if itemEx.itemid == 8289 and itemEx.actionid == 8181 and (randomizer == 1) and queststatus == 1 then
		doSummonCreature("Crypt Shambler", monster1)
		doSummonCreature("Crypt Shambler", monster2)
		doSummonCreature("Crypt Shambler", monster3)
		doSummonCreature("Crypt Shambler", monster4)
	elseif itemEx.itemid == 8289 and itemEx.actionid == 8181 and (randomizer == 2) and queststatus == 1 then
		doSummonCreature("Bone Beast", monster1)
		doSummonCreature("Bone Beast", monster2)
		doSummonCreature("Bone Beast", monster3)
		doSummonCreature("Bone Beast", monster4)
	elseif itemEx.itemid == 8289 and itemEx.actionid == 8181 and (randomizer == 3) and queststatus == 1 then
		doSummonCreature("Betrayed Wraith", monster1)
		doSummonCreature("Lost Soul", monster2)
		setPlayerStorageValue(cid,8181,-1)
		setPlayerStorageValue(cid,8282,1)
	elseif itemEx.itemid == 8289 and itemEx.actionid == 8181 and (randomizer >= 4) and queststatus == 1 then
		doSendMagicEffect(playerPos, 45)
		doCreatureAddHealth(cid, -300)
		doSendAnimatedText(playerPos, '300', TEXTCOLOR_LIGHTGREEN)
		end
	if itemEx.itemid == 8289 and itemEx.actionid == 8181 and queststatus == -1 then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		end
	if itemEx.itemid == 8288 and itemEx.actionid == 8282 and (randomizer == 1) and queststatus2 == 1 then
		doSummonCreature("Crypt Shambler", monster1)
		doSummonCreature("Mummy", monster2)
		doSummonCreature("Mummy", monster3)
		doSummonCreature("Crypt Shambler", monster4)
	elseif itemEx.itemid == 8288 and itemEx.actionid == 8282 and (randomizer == 2) and queststatus2 == 1 then
		doSummonCreature("Giant Spider", monster1)
		doSummonCreature("Giant Spider", monster4)
	elseif itemEx.itemid == 8288 and itemEx.actionid == 8282 and (randomizer == 3) and queststatus2 == 1 then
		doSummonCreature("Blightwalker", monster1)
	      doSummonCreature("Lost Soul", monster2)
		setPlayerStorageValue(cid,8282,-1)
		setPlayerStorageValue(cid,8383,1)
	elseif itemEx.itemid == 8288 and itemEx.actionid == 8282 and (randomizer >= 4) and queststatus2 == 1 then
		doSendMagicEffect(playerPos, 45)
		doCreatureAddHealth(cid, -300)
		doSendAnimatedText(playerPos, '300', TEXTCOLOR_LIGHTGREEN)
		end
	if itemEx.itemid == 8288 and itemEx.actionid == 8282 and queststatus2 == -1 then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		end
	if itemEx.itemid == 8290 and itemEx.actionid == 8383 and (randomizer == 1) and queststatus3 == 1 then
		doSummonCreature("Crypt Shambler", monster1)
		doSummonCreature("Crypt Shambler", monster2)
		doSummonCreature("Crypt Shambler", monster3)
		doSummonCreature("Crypt Shambler", monster4)
	elseif itemEx.itemid == 8290 and itemEx.actionid == 8383 and (randomizer == 2) and queststatus3 == 1 then
		doSummonCreature("Lich", monster1)
		doSummonCreature("Lich", monster2)
		doSummonCreature("Lich", monster3)
		doSummonCreature("Lich", monster4)
	elseif itemEx.itemid == 8290 and itemEx.actionid == 8383 and (randomizer == 3) and queststatus3 == 1 then
		doSummonCreature("Plaguesmith", monster1)
	      doSummonCreature("Plaguesmith", monster2)
		setPlayerStorageValue(cid,8383,-1)
		setPlayerStorageValue(cid,8484,1)
	elseif itemEx.itemid == 8290 and itemEx.actionid == 8383 and (randomizer >= 4) and queststatus3 == 1 then
		doSendMagicEffect(playerPos, 45)
		doCreatureAddHealth(cid, -300)
		doSendAnimatedText(playerPos, '300', TEXTCOLOR_LIGHTGREEN)
		end
	if itemEx.itemid == 8290 and itemEx.actionid == 8383 and queststatus3 == -1 then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		end
	if itemEx.itemid == 8291 and itemEx.actionid == 8484 and (randomizer == 1) and queststatus4 == 1 then
		doSummonCreature("Nightmare", monster1)
		doSummonCreature("Mummy", monster2)
		doSummonCreature("Mummy", monster3)
		doSummonCreature("Nightmare", monster4)
	elseif itemEx.itemid == 8291 and itemEx.actionid == 8484 and (randomizer == 2) and queststatus4 == 1 then
		doSummonCreature("Giant spider", monster1)
		doSummonCreature("Undead Dragon", monster2)
		doSummonCreature("Giant Spider", monster2)
		doSummonCreature("Giant Spider", monster3)
	elseif itemEx.itemid == 8291 and itemEx.actionid == 8484 and (randomizer == 3) and queststatus4 == 1 then
		doSummonCreature("Demon", monster1)
		doSummonCreature("Juggernaut", monster2)
		setPlayerStorageValue(cid,8484,-1)
		setPlayerStorageValue(cid,8585,1)
		doCreatureSayWithDistance(cid, pos1, "Argh!!!... You really damaged me! Leaveeee or dieeeee!",TALKTYPE_ORANGE_1 )

	elseif itemEx.itemid == 8291 and itemEx.actionid == 8484 and (randomizer >= 4) and queststatus4 == 1 then
		doSendMagicEffect(playerPos, 45)
		doCreatureAddHealth(cid, -300)
		doSendAnimatedText(playerPos, '300', TEXTCOLOR_LIGHTGREEN)
		end
	if itemEx.itemid == 8291 and itemEx.actionid == 8484 and queststatus4 == -1 then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		end

if getPlayerStorageValue(cid, 8585) == 1 and itemEx.itemid == 2709 and itemEx.actionid == 7787 then

		doRemoveItem(trex)
		doTeleportThing(cid, exitPos, TRUE)

	elseif getPlayerStorageValue(cid, 8585) == -1 and itemEx.itemid == 2709 and itemEx.actionid == 7787 then

		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You haven't defeated Demon Oak.")
		end

end
 
Last edited:
Thx I'm going to test it, if work i'll rep++ you

P.D: I'm a bit noob in the forum so, how can I give rep++?? :P
 
Last edited:
Back
Top