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

Use Door Once

Gzuz

New Member
Joined
Jul 2, 2009
Messages
12
Reaction score
0
Hi! i'm a complete newbie so i dont know too much about scripting (almost anything)
i would like a script so you can use a door only once.

this is the script i tried to make (copied from arenaquest doors)

function onUse(cid, item, fromPosition, itemEx, toPosition)
local cidPosition = getCreaturePosition(cid)
if item.actionid ~= 35532 then
if (item.actionid == 35532 and getPlayerStorageValue(cid,6667) == -1)

then
if cidPosition.x < toPosition.x then
doTeleportThing(cid,

{x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
else
doTeleportThing(cid,

{x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
end
return TRUE


else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not

enter room.")
return TRUE
end
elseif (item.actionid == 35532 and getPlayerStorageValue(cid,6667) == -1) then
if cidPosition.x < toPosition.x then
doTeleportThing(cid,

{x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
else
doTeleportThing(cid,

{x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
end
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must pay

first.")
return TRUE
end
return FALSE
end

and i though to put something like this somewhere but IDK --setPlayerStorageValue(cid,6667,1)--

Thanks For Helping
 
WRONG SECTION. but nvm...

PHP:
function onUse(cid, item, frompos, item2, topos)

if getPlayerStorageValue(cid,10067) == 2 then
doPlayerSendTextMessage(cid,22,"Sorry, you cannot pass there anymore than once time.")	


elseif getPlayerStorageValue(cid,10067) == 1 then
npos = {x=YOUR X, y=YOUR Y, z=YOUR Z}
doTeleportThing(cid, npos)
setPlayerStorageValue(cid,10067,2)


end
end

Dont forget to change npos = {x=YOUR X, y=YOUR Y, z=YOUR Z}
and put this script in actions.xml:
PHP:
<action actionid="YOUR ACTIONID" event="script" value="NAME OF SCRIPT.lua"/>

after done that, you need put ActionID on door by mapeditor (PPM on door and write your actionID that you put in line of actions.xml of this script).
 
Back
Top