kimokimo
Kimo
can anyone help me i want lever that when you press it say you need "item name" to teleport to "place name"..
+REP
+REP
local config = {
itemName = 'demon helmet',
place = {x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local id = getItemIdByName(config.itemName)
if id ~= 0 then
doTeleportThing(cid, config.place)
end
return true
end
local config = {
itemName = 'demon helmet',
place = {x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local id = getItemIdByName(config.itemName)
if id ~= 0 then
doTeleportThing(cid, config.place)
else
doCreatureSay( cid , 'You need an Demon Helmet to pass!' , TALKTYPE_MONSTER_SAY )
end
return true
end
This maybe?LUA:local config = { itemName = 'demon helmet', place = {x = 100, y = 100, z = 7 } } function onUse(cid, item, fromPosition, itemEx, toPosition) local id = getItemIdByName(config.itemName) if id ~= 0 then doTeleportThing(cid, config.place) else doCreatureSay( cid , 'You need an Demon Helmet to pass!' , TALKTYPE_ORANGE_1 end return true end
local config = {
itemId = xxx,
place = {x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local item = getPlayerItemById(cid, true, config.itemId)
if item ~= 0 then
doTeleportThing(cid, config.place)
else
doCreatureSay( cid , 'You need a ' .. getItemNameById(config.itemId) .. ' to pass!' , TALKTYPE_ORANGE_1 )
end
return true
end
The problem is you both, Sweddy and Huli, have missed bracket ) after TALKTYPE_ORANGE_1. Also it should be TALKTYPE_MONSTER_SAY.
local config = {
itemId = xxx, --change to whatever
place = {x = 100, y = 100, z = 7 } --change to a position...
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveItem(cid, config.itemId, 1) then
doTeleportThing(cid, config.place)
else
doCreatureSay( cid , 'You need a ' .. getItemNameById(config.itemId) .. ' to pass!' , TALKTYPE_ORANGE_1 )
end
return true
end
local config = {
itemN = "spike sword",-- Name of the item - NOT ID! [Name MUST be exact!]
tpPlace = {x = 100, y = 100, z = 7}--Place to teleport to!
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local itemId = getItemIdByName(itemN)
if(getPlayerItemCount(cid, itemId) => 1) then
doTeleportThing(cid, config.tpPlace)
doPlayerRemoveItem(cid, itemId, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been teleported and 1x " .. config.itemN .. " has been removed from your inventory.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need a " .. config.itemN .. " to be teleported!")
end
return true
end