GOD Wille
Excellent OT User
Hey, im trying to learn to script this;
if there is no bush on specific tile then add a bush
if there is a bush then remove the bush (if lever is 1946)
you understand!
please correct my script and tell me what i do wrong
if there is no bush on specific tile then add a bush
if there is a bush then remove the bush (if lever is 1946)
you understand!
please correct my script and tell me what i do wrong
LUA:
local config = {
bushId = 2768,
pos = {x=2424, y=946, z=7}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.id == 1945 then
if getTileItemById(config.pos, config.bushId).uid > 0 then
doTileAddItemEx(config.pos, config.bushId).uid
doCreatureSay(cid, 'You summoned a bush!', TALKTYPE_ORANGE)
elseif item.id == 1946 then
if getTileItemById(config.pos, config.bushId).uid < 0 then
doCreatureSay(cid, 'You deleted the bush!', TALKTYPE_ORANGE)
doRemoveItem(getTileItemById(config.pos, config.bushId).uid)
else
doPlayerSendCancel(cid, 'Sorry not possible')
return false
end
end
end
end
Last edited by a moderator: