Pyromaniack
New Member
- Joined
- Feb 9, 2011
- Messages
- 56
- Reaction score
- 3
I need a scrip for a door that can only pass one time
Please!!!
Please!!!
how can i do that bro?Well i dont know any scripts like that, but i guess it would perhaps work if you add a storage value when clicking on the door.
-- level doors based on actionId
-- to make door for level x create door on map and set its actionid to x+1000
function onUse(cid, item, frompos, item2, topos)
reqlevel = item.actionid - 1000 -- actionids below 100 are reserved
storage = XXXX
if reqlevel > 0 then
if getPlayerLevel(cid) >= reqlevel and if(getPlayerStorageValue(cid, storage) >= 1 then
pos = getPlayerPosition(cid)
setPlayerStorageValue(cid, storage, 1)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Stand in front of the door.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'You need level ' .. reqlevel .. ' to pass this door and not passed it before.')
end
return 1
else
return 0
end
end
thanks!!!!!!!!!!!LUA:-- level doors based on actionid -- to make door for level x create door on map and set its actionid to x+1000 function onuse(cid, item, frompos, item2, topos) reqlevel = item.actionid - 1000 -- actionids below 100 are reserved storage = xxxx if reqlevel > 0 then if getplayerlevel(cid) >= reqlevel and if(getplayerstoragevalue(cid, storage) >= 1 then pos = getplayerposition(cid) setplayerstoragevalue(cid, storage, 1) if pos.x == topos.x then if pos.y < topos.y then pos.y = topos.y + 1 else pos.y = topos.y - 1 end elseif pos.y == topos.y then if pos.x < topos.x then pos.x = topos.x + 1 else pos.x = topos.x - 1 end else doplayersendtextmessage(cid,22,'stand in front of the door.') return 1 end doteleportthing(cid,pos) dosendmagiceffect(topos,12) else doplayersendtextmessage(cid,22,'you need level ' .. Reqlevel .. ' to pass this door and not passed it before.') end return 1 else return 0 end end
[23/06/2012 12:57:06] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/passrookquest.lua:9: unexpected symbol near 'if'
[23/06/2012 12:57:06] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/passrookquest.lua)
[23/06/2012 12:57:06] data/actions/scripts/quests/passrookquest.lua:9: unexpected symbol near 'if'