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

Lua please help with a door!

kaspertje100

Member
Joined
May 8, 2008
Messages
236
Reaction score
7
Hi guys,

so I get this error:

Code:
[Error - Action Interface]
data/actions/scripts/other/hellgatedoor.l
Description:
(luaGetThingPosition) Thing not found

with this script:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid,4444) == 1 then
		doTeleportThing(cid, {x=1068,y=1058,z=7}, TRUE)
		doCreatureSay(cid, "Welcome to Hell!", TALKTYPE_ORANGE_1)
		if getCreaturePosition(cid, {x=1068,y=1058,z=7}, TRUE) then
		    doTeleportThing(cid, {x=1068,y=1060,z=7}, TRUE)
		    doCreatureSay(cid, "Welcome back!", TALKTYPE_ORANGE_1)
        end			
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, Please talk to Eden first.")
	end
	return true
end

so the problem is at line 6: when the player wants to go back.. he can't;S
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 4444) == 1 then
		if fromPosition == {x=1068,y=1058,z=7} then
			doTeleportThing(cid, {x=1068,y=1060,z=7}, false)
			doCreatureSay(cid, "Welcome back!", TALKTYPE_ORANGE_1)
		elseif doTeleportThing(cid, {x=1068,y=1058,z=7}, false)
			doCreatureSay(cid, "Welcome to Hell!", TALKTYPE_ORANGE_1)
		end			
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, Please talk to Eden first.")
	end
	return true
end
no tested
I consider it a bad idea, in this way, use the door :p
 
Lua:
function onUse(cid, item, frompos, itemEx, topos)
    local cidPosition = getCreaturePosition(cid)
        if (item.actionid == 5788 and getPlayerStorageValue(cid,4444) >= 1 then
            if cidPosition.y < toPosition.y then
                doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
                                doCreatureSay(cid, "Welcome to Hell!", TALKTYPE_ORANGE_1)
            else
                doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
                        doCreatureSay(cid, "Welcome back!", TALKTYPE_ORANGE_1)
            end
            return TRUE
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, Please talk to Eden first.")
            return TRUE
    end
    return FALSE
end

Try that.
Edited...
Also for the door your using you need to change the action id to 5788. If i helped you rep me ++. And if you get an error or something msg me here ill try to see what i can do to fix it.
 
Last edited:
Hi protegy,

Thanks for helping me but i still have an little error:
when I use this code:

Lua:
function onUse(cid, item, frompos, itemEx, topos)
    local cidPosition = getCreaturePosition(cid)
        if (item.actionid == 5788 and getPlayerStorageValue(cid,4444) == 1) then
            if cidPosition.y < toPosition.y then
                doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
                                doCreatureSay(cid, "Welcome to Hell!", TALKTYPE_ORANGE_1)
            else
                doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
                        doCreatureSay(cid, "Welcome back!", TALKTYPE_ORANGE_1)
            end
            return TRUE
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, Please talk to Eden first.")
            return TRUE
    end
    return FALSE
end


Code:
[Error - Action Interface]
data/actions/scripts/other/hellgatedoor2.lua:onUse
Description:
data/actions/scripts/other/hellgatedoor2.lua:4: attempt to index global 'toPosi
ion' (a nil value)
stack traceback:
        data/actions/scripts/other/hellgatedoor2.lua:4: in function <data/actio
s/scripts/other/hellgatedoor2.lua:1>

when I use the door i get that error the server says then that the door is locked xD but that is because the server see's the action ID as an key I guess xD

Btw I added an ')' line 3 near == 1) then

I hope you can help me !!
 
Back
Top