Teddy
SweStream.se
Code:
[25/12/2008 09:16:13] Lua Script Error: [Action Interface]
[25/12/2008 09:16:13] data/actions/scripts/booths/training/west.lua:onUse
[25/12/2008 09:16:13] luaDoRemoveCreature(). Creature not found
Script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Define positions.
local charPos = getCreaturePosition(cid)
local doorPos = getThingPos(item.uid)
local monkOne = {x = doorPos.x - 2, y = doorPos.y - 1, z = doorPos.z}
local monkTwo = {x = doorPos.x - 2, y = doorPos.y + 1, z = doorPos.z}
local checkPlayer = {x = doorPos.x - 1, y = doorPos.y, z = doorPos.z, stackpos = 253}
-- Define directions.
local newDir = 3
local oldDir = 1
-- Check where the player is located at.
if ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
-- Check if someone already uses the training booth.
if isPlayer(getThingfromPos(checkPlayer).uid) == TRUE then
doPlayerSendTextMessage(cid, 24, "Someone is already using this booth.")
doSendMagicEffect(getCreaturePos(cid), 2)
else
-- Teleport player.
doTeleportThing(cid, doorPos)
doMoveCreature(cid, newDir)
-- Summon training monks.
doSummonCreature("Trainer", monkOne)
doSummonCreature("Trainer", monkTwo)
end
else
-- Teleport player.
doTeleportThing(cid, doorPos)
doMoveCreature(cid, oldDir)
-- Remove training monks.
doRemoveCreature(getThingfromPos({x = monkOne.x, y = monkOne.y, z = monkOne.z, stackpos = 253}).uid)
doRemoveCreature(getThingfromPos({x = monkTwo.x, y = monkTwo.y, z = monkTwo.z, stackpos = 253}).uid)
-- Send magic effect.
doSendMagicEffect(monkOne, 2)
doSendMagicEffect(monkTwo, 2)
end
return TRUE
end
Last edited: