• 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!

My scripts won't work.

Falu Alth

New Member
Joined
Oct 18, 2008
Messages
25
Reaction score
0
Location
Poland
Hi, im from Poland, so sorry for bad english. Also i will be online tommorow next time, i can't enter today.

At first i need script (yes, request), when player die in area selected by me, i want monsters that are there, die.

Second thing, my script won't work:
Lua:
local block = {7577,7578,7579,7580,7581,7575,1284}
local noLogoutCondition = createConditionObject(CONDITION_INFIGHT, 24*60*60*1000)
local function stop(cid)
doTeleportThing(cid,back, true)
addEvent(doCreatureChangeOutfit, 1, cid,outfitback)
doCreatureSetNoMove(cid, false)
doRemoveCondition(p.cid, CONDITION_INFIGHT)
return true
end
...

local dir = getCreatureLookDirection(cid)
					if direction == NORTH then
						local pos = {x=position.x,y=position.y-1,z=position.z-0, stackpos = 1}
					elseif direction == EAST then
						local pos = {x=position.x+1,y=position.y,z=position.z-0, stackpos = 1}
					elseif direction == SOUTH then
						local pos = {x=position.x,y=position.y+1,z=position.z-0, stackpos = 1}
					else
						local pos = {x=position.x-1,y=position.y,z=position.z-0, stackpos = 1}
					end
local a = getThingFromPos(pos)
if isInArray(block,a.itemid) == TRUE then ||THIS PART WON'T WORK||
stop(cid)
end
...

Third script, talkaction, tic-tac-toe game, my sript won't work:
Lua:
function getPlayersInRange(pos, rX, rY)
	local ret = {}
	for x = -rX, rX do
		for y = -rY, rY do
			local v = getTopCreature({x = pos.x+x, y = pos.y+y, z = pos.z}).uid
			if isPlayer(v) == TRUE then
				table.insert(ret, v)
			end
		end
	end
	return ret
end

local t = {
	from = {x=841, y=1246, z=7},
	to = {x=843, y=1252, z=7},
	storage = {
		turn = 11110,
		player = 11111,
	},
	X = 2638,
	O = 2639,
	effect = CONST_ME_FIREAREA,
	text = "Poof!",
	temple = {x=842, y=1256, z=7},
	positions = {
	{x=841, y=1248,z=7},
	{x=842, y=1248,z=7},
	{x=843, y=1248,z=7},
	{x=841, y=1249,z=7},
	{x=842, y=1249,z=7},
	{x=843, y=1249,z=7},
	{x=841, y=1250,z=7},
	{x=842, y=1250,z=7},
	{x=843, y=1250,z=7};
	}
}

function reset()
	for x = t.from.x, t.to.x do
		for y = t.from.y, t.to.y do
			local pos = {x=x,y=y,z=t.from.z}
			local i1, i2  = getTileItemById(pos, t.X).uid, getTileItemById(pos, t.O).uid
			if i1 > 0 then
				doRemoveItem(i1)
			end
			if i2 > 0 then
				doRemoveItem(i2)
			end
		end
	end
end

function onSay(cid, words, param, channel)
	local param=param
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
	
	if isInRange(getThingPos(cid), t.from, t.to) and  getPlayerStorageValue(cid, t.storage.turn)==1 then
		if getPlayerStorageValue(cid, t.storage.player)==2 then -- O
		local i1,i2 = getTileItemById(t.positions[param], t.X).uid, getTileItemById(t.positions[param], t.O).uid
			if i1>0 or i2>0 then
			return doPlayerSendCancel(cid, "Place is not empty.")
		end
		doCreateItem(t.O, 1, t.positions[param])
		setPlayerStorageValue(cid, t.storage.turn, 0)
		return true
	end
		if getPlayerStorageValue(cid, t.storage.player)==1 then -- X
		local i1,i2 = getTileItemById(t.positions[param], t.X).uid, getTileItemById(t.positions[param], t.O).uid
			if i1>0 or i2>0 then
			return doPlayerSendCancel(cid, "Place is not empty.")
		end
		doCreateItem(t.X, 1, t.positions[param])
		setPlayerStorageValue(cid, t.storage.turn, 0)
		return true
	end
	end
	
end
I cant copy errors now, sorry.

Thanks for helping :thumbup:
 
We need erros to know wats happening
eyeroll.gif
 
Ok.
So when im starting OTS, i got error:
[Error - MoveEvents Interface]
data/movements/scripts/boat.lua
Description:
(internalGetPlayerInfo) Player not found when requesting player info #7
(New boat.lua):
Lua:
local outfit = {lookType = 11, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local outfitback = {lookType = 128, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local block = {7577,7578,7576,7579,7580,7581,7575,1284}
local noLogoutCondition = createConditionObject(CONDITION_INFIGHT, 24*60*60*1000)
local back = getTownTemplePosition(getPlayerTown(cid))
local function stop(cid)
doTeleportThing(cid,back, true)
addEvent(doCreatureChangeOutfit, 1, cid,outfitback)
doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
return true
end
local function move(cid,position)
local dir = getCreatureLookDirection(cid)
					if direction == NORTH then
						local pos = {x=position.x,y=position.y-1,z=position.z-0, stackpos = 1}
					elseif direction == EAST then
						local pos = {x=position.x+1,y=position.y,z=position.z-0, stackpos = 1}
					elseif direction == SOUTH then
						local pos = {x=position.x,y=position.y+1,z=position.z-0, stackpos = 1}
					else
						local pos = {x=position.x-1,y=position.y,z=position.z-0, stackpos = 1}
					end
local a = getThingFromPos(position)
if isInArray(block,a.itemid) == TRUE then
stop(cid)
end
doMoveCreature(cid, dir)
doSendMagicEffect(getCreaturePosition(cid), 53)
addEvent(move, 100,cid,position)
return true
end
function onStepIn(cid, item, position, fromPosition)
local back = getTownTemplePosition(getPlayerTown(cid))
addEvent(move, 100,cid,position)
addEvent(doCreatureChangeOutfit, 1, cid,outfit)
doCreatureSetNoMove(cid, true)
doMoveCreature(cid, SOUTH)
return true
end
Im not getting errors with boat lua, it just dont want to stop :( Also, it change my outfit to "local outfit" but only for one second :( When i logout in boat im getting this errors:
[Error - MoveEvents Interface]
In a timer event called from:
data/movements/scripts/boat.lua:eek:nStepIn
Description:
(luaGetThingPosition) Thing not found

[Error - MoveEvents Interface]
In a timer event called from:
data/movements/scripts/boat.lua:eek:nStepIn
Description:
(luaDoCreatureChangeOutfit) Creature not found

I cant test tic-tac-toe now ( 2 players needed ;/, i cant download mc :( )

Can you write creatuscript for me, please?
Thank you for replying.

@EDIT: I saw your house building, you have to change something in source, to make it work, yes?
 
Im writing from Slovakia, other keyboard, so sorry for "errors" in text. Why you wrote "--short--"? The part "local back..." work in other script.
 
Back
Top