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

Magic Door

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
My script don't work and don't show error in cosole:
Code:
 local toPos =
{
x = 1222,
y = 1029,
z = 8
}

function onUse(cid, item, fromPos)
	if getPlayerItemCount(cid, 2044) == TRUE then
	if getPlayerStorageValue(cid, 64234) == FALSE then
	   doTeleportThing(cid, toPos, TRUE)
	   setPlayerStorageValue(cid, 64234, TRUE)
	 elseif getPlayerItemCount(cid, 2044) == FALSE then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
  end
 end
  return TRUE
end
 
FALSE is not the same as -1 !

Code:
local toPos =
{
x = 1222,
y = 1029,
z = 8
}

function onUse(cid, item, fromPos)
	if getPlayerItemCount(cid, 2044) == TRUE then
	   if getPlayerStorageValue(cid, 64234) == -1 then
	      doTeleportThing(cid, toPos, TRUE)
	      setPlayerStorageValue(cid, 64234, TRUE)
           else
              doPlayerSendCancel(cid"Not able to pass.")
           end
	 elseif getPlayerItemCount(cid, 2044) == FALSE then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
         end
         return TRUE
end
 
Code:
local toPos =
{
x = 1222,
y = 1029,
z = 8
}

function onUse(cid, item, fromPos)
	[B]if getPlayerItemCount(cid, 2044) == TRUE then[/B]
	   if getPlayerStorageValue(cid, 64234) == -1 then
	      doTeleportThing(cid, toPos, TRUE)
	    [B]  setPlayerStorageValue(cid, 64234, TRUE)[/B]
           else
              doPlayerSendCancel(cid"Not able to pass.")
           end
	 [B]elseif getPlayerItemCount(cid, 2044) == FALSE then[/B]
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
         end
         return TRUE
end

I think you should use '>= 1' instead of '== TRUE'
And set values cid number beacouse this may couse script wont work

In third bolded line use '< 1' instead of == FALSE

I hope i helped :pP


***************************
Try this =]
Code:
local toPos =
{
x = 1222,
y = 1029,
z = 8
}

function onUse(cid, item, fromPos)
	if getPlayerItemCount(cid, 2044) >= 1 then
	   if getPlayerStorageValue(cid, 64234) == -1 then
	      doTeleportThing(cid, toPos, TRUE)
	      setPlayerStorageValue(cid, 64234, 1)
           else
              doPlayerSendCancel(cid"Not able to pass.")
           end
	 elseif getPlayerItemCount(cid, 2044) < 1 then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
         end
         return TRUE
end
 
Don't are working:
Code:
local toPos =
{
x = 1222,
y = 1029,
z = 8
}

function onUse(cid, item, fromPos)
	if getPlayerItemCount(cid, 2044) >= 1 then
	if getPlayerStorageValue(cid, 64234) == -1 then
	   doTeleportThing(cid, toPos, TRUE)
	   setPlayerStorageValue(cid, 64234, 1)
	 elseif getPlayerItemCount(cid, 2044) < 1 then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
  end
 end
  return TRUE
end

Code:
	<action actionid="3248" script="magi_door1.lua" />
 
Code:
function onUse(cid, item, fromPos)
	local newPos = { x = 1222, y = 1029, z = 8 }
	if getPlayerItemCount(cid, 2044) >= 1 then
		if getPlayerStorageValue(cid, 64234) == -1 then
			doTeleportThing(cid, newPos, 0)
			setPlayerStorageValue(cid, 64234, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already used the door.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have a lamp out of his house.")
	end
	return TRUE
end
 
Back
Top