local config = {
uniqueid = 1000, -- action id that the door needs to have
frags = 100, --- how many frags to enter
direction = 1 --- 1 = up, 2 = right, 3 = down, 4 = left
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = getThingPos(cid)
if item.uniqueid == config.uniqueid then
if getPlayerFrags(cid) >= config.frags then
local pos = {{x=v.x,y=v.y-2,z=v.z},{x=v.x+2,y=v.y,z=v.z},{x=v.x,y=v.y+2,z=v.z},{x=v.x-2,y=v.y,z=v.z}}
doTeleportThing(cid,pos[config.direction],false)
return doSendMagicEffect(pos[config.direction],10)
else
doPlayerSendTextMessage(cid,20,'You need '..config.frags' frags to enter this door.')
return doSendMagicEffect(v,2)
end
end
end
try this
Code:local config = { uniqueid = 1000, -- action id that the door needs to have frags = 100, --- how many frags to enter direction = 1 --- 1 = up, 2 = right, 3 = down, 4 = left } function onUse(cid, item, fromPosition, itemEx, toPosition) local v = getThingPos(cid) if item.uniqueid == config.uniqueid then if getPlayerFrags(cid) >= config.frags then local pos = {{x=v.x,y=v.y-2,z=v.z},{x=v.x+2,y=v.y,z=v.z},{x=v.x,y=v.y+2,z=v.z},{x=v.x-2,y=v.y,z=v.z}} doTeleportThing(cid,pos[config.direction],false) return doSendMagicEffect(pos[config.direction],10) else doPlayerSendTextMessage(cid,20,'You need '..config.frags' frags to enter this door.') return doSendMagicEffect(v,2) end end end
if you add it in other you musti add it in actions
<action uniqueid="1000" event="script" value="fragdoor.lua" />
if in quests quests/fragdoor<action uniqueid="1000" event="script" value="other/fragdoor.lua" />
<action itemid="6252" event="script" value="fragdoor.lua"/>
local config = {
uniqueid = 1000, -- action id that the door needs to have
frags = 100, --- how many frags to enter
direction = 1 --- 1 = up, 2 = right, 3 = down, 4 = left
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = getThingPos(cid)
if item.uniqueid == config.uniqueid then
if getPlayerFrags(cid) >= config.frags then
local pos = {{x=v.x,y=v.y-2,z=v.z},{x=v.x+2,y=v.y,z=v.z},{x=v.x,y=v.y+2,z=v.z},{x=v.x-2,y=v.y,z=v.z}}
doTeleportThing(cid,pos[config.direction],false)
return doSendMagicEffect(pos[config.direction],10)
else
doPlayerSendTextMessage(cid,20,'You need '..config.frags' frags to enter this door.')
return doSendMagicEffect(v,2)
end
end
end
<action uniqueid="6252" event="script" value="fragdoor.lua"/>
local config = {
uniqueid = 6252, -- action id that the door needs to have
frags = 100, --- how many frags to enter
direction = 1 --- 1 = up, 2 = right, 3 = down, 4 = left
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = getThingPos(cid)
if item.uniqueid == config.uniqueid then
if getPlayerFrags(cid) >= config.frags then
local pos = {{x=v.x,y=v.y-2,z=v.z},{x=v.x+2,y=v.y,z=v.z},{x=v.x,y=v.y+2,z=v.z},{x=v.x-2,y=v.y,z=v.z}}
doTeleportThing(cid,pos[config.direction],false)
return doSendMagicEffect(pos[config.direction],10)
else
doPlayerSendTextMessage(cid,20,'You need '..config.frags' frags to enter this door.')
return doSendMagicEffect(v,2)
end
end
end