• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Movement script

SasirO

Banned User
Joined
Apr 30, 2009
Messages
559
Reaction score
0
Greetings, i need a script so if a player step in on a certain tile then it checks if on the position is a stone, if theres a stone then notthing happends, but if theres no stone then it creates the stone and sends the player a message.

I got something like this
Code:
function onStepIn(cid, item, pos)
stone = 1304
 local stone_pos = {x=32225, y=32282, z=9}
 ret = getThingfromPos(stone_pos)

    if item.actionid == 43119 and isPlayer(cid) == TRUE and item.stone == ret then 
		 doPlayerSendTextMessage(cid,22, "You hear a rumbling from far away.")
		 else
		 doPlayerSendTextMessage (cid,22, "Theres already a stone.")
        end
		end
 
PHP:
function onStepIn(cid, item, pos)
stone = 1304
 local stone_pos = {x=32225, y=32282, z=9}
 ret = getTileItemById(stone_pos,stone)

    if item.actionid == 43119 then 
if ret.itemid == stone then
		 doPlayerSendTextMessage(cid,22, "You hear a rumbling from far away.")
		 else
		 doPlayerSendTextMessage (cid,22, "Theres already a stone.")
end
        end
		end
 
i've tried here this script:
Code:
function onStepIn(cid, item, pos)
stone = 1304
 local stone_pos = {x=32225, y=32282, z=9}
 ret = getTileItemById(stone_pos,stone)

    if item.actionid == 43119 then 
if ret.itemid == stone then
         doPlayerSendTextMessage(cid,22, "You hear a rumbling from far away.")
		 doCreateItem(1304,1,stone_pos)
         else
         doPlayerSendTextMessage (cid,22, "Theres already a stone.")
end
        end
        end


Theres no stone on the position but i still get the message : Theres already a stone.
 
Lua:
function onStepIn(cid, item, position, fromPosition)

local config = {
	stonePos = { x=100, y=100, z=7, stackpos=1 },
	getItem = getThingFromPos(stonePos),
	stoneId = 1304
}

		if(isPlayer(cid) == TRUE and config.getItem.itemid == config.stoneId) then
			doPlayerSendTextMessage(cid, 22, "There\'s already a stone!")
		else
			doPlayerSendTextMessage (cid,22, "Stone has been created")
			doCreateItem(config.stoneId, 1, config.stonePos)
			end
		return TRUE
	end
 
Last edited:
;/
Code:
attempt to index a nil value
[30/06/2009 17:19:55] stack traceback:
[30/06/2009 17:19:55] 	[C]: in function 'getThingFromPos'
 
kkz, try
Lua:
function onStepIn(cid, item, position, fromPosition)
 
local stonePos = { x=100, y=100, z=7, stackpos=1 }
local getItem = getThingFromPos(stonePos)
local stoneId = 1304

                if(isPlayer(cid) == TRUE and getItem.itemid == stoneId) then
                        doPlayerSendTextMessage(cid, 22, "There\'s already a stone!")
                else
                        doPlayerSendTextMessage (cid,22, "Stone has been created")
                        doCreateItem(stoneId, 1, stonePos)
                        end
                return TRUE
        end
 
Great, works ;] rep++

also i want to add one more thing into this script,
Theres a lever at position x=32850, y=32268, z=10, id of this lever is 1946

I want the lever doTransform into 1945 after i stepin on the tile, also the lever transforms only if i create the stone while steping on the tile
 
Lua:
function onStepIn(cid, item, position, fromPosition)
 
local stonePos = { x=100, y=100, z=7, stackpos=1 }
local getItem = getThingFromPos(stonePos)
local stoneId = 1304
local leverPos = { x=100, y=100, z=7, stackpos=1 } -- change to the lever id
local getLever = getThingFromPos(leverPos)

                if(isPlayer(cid) == TRUE and getItem.itemid == stoneId) then
                        doPlayerSendTextMessage(cid, 22, "There\'s already a stone!")
                else
                        doPlayerSendTextMessage (cid,22, "Stone has been created")
                        doCreateItem(stoneId, 1, stonePos)
			doTransformItem(getLever.uid, item.itemid -1)
                        end
                return TRUE
        end

Maybe ^_^
 
Back
Top