• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Help with easy script

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
I got bug in this script:

PHP:
local before, after = {x = 738, y = 700, z = 7}, {x = 743, y = 696, z = 7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k = item.itemid == 1945 then
	if k then
		local thing = getThingFromPos(before, false).uid
		if isPlayer(thing) then
			doTeleportThing(thing, after, true)
			doSendMagicEffect(after, CONST_ME_ENERGYAREA)
			doSendMagicEffect(before, CONST_ME_POFF)
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

Code:
[28/01/2012 13:54:15] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/levertp1.lua:3: unexpected symbol near 'then'
[28/01/2012 13:54:15] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/levertp1.lua)
[28/01/2012 13:54:15] data/actions/scripts/quests/levertp1.lua:3: unexpected symbol near 'then'

This script should tp player when he use lever.
 
Last edited:
LUA:
local beforePos = {x = 738, y = 700, z = 7},
local afterPos = {x = 743, y = 696, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(cid, afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
end
 
LUA:
local beforePos = {x = 738, y = 700, z = 7},
local afterPos = {x = 743, y = 696, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(cid, afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
end

[29/01/2012 18:57:27] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/levertp1.lua:2: unexpected symbol near 'local'
[29/01/2012 18:57:27] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/levertp1.lua)
[29/01/2012 18:57:28] data/actions/scripts/quests/levertp1.lua:2: unexpected symbol near 'local'

can anyone help? i try do delete local in 2nd line but i got other bug in 2nd line.
 
Code:
local beforePos = {x = 738, y = 700, z = 7}[COLOR="#FF0000"],[/COLOR]
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(cid, afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
end
Remove the comma..

BTW, 600 posts!
 
Code:
local beforePos = {x = 738, y = 700, z = 7}[COLOR="#FF0000"],[/COLOR]
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(cid, afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
end
Remove the comma..

BTW, 600 posts!

Congratz on 600 posts :D
 
Code:
local beforePos = {x = 738, y = 700, z = 7}[COLOR="#FF0000"],[/COLOR]
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(cid, afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
end
Remove the comma..

BTW, 600 posts!

Thx i give you rep but it don't work that i want :(
it should tp who stand at before pos but it tp player who use lever and player who stand at before pos.
Can anyone help mi with that script for that the player who use lever dont get tp?
 
Last edited:
He means he has a lever , that should , on use , teleport a player on a pos AND also the user of the lever... you can try using the annihilator lever script but with only 2 people ,, i will edit this soon unless you get help from someone else
 
He means he has a lever , that should , on use , teleport a player on a pos AND also the user of the lever... you can try using the annihilator lever script but with only 2 people ,, i will edit this soon unless you get help from someone else

No i don't mean that.

I Mean:

Somebody Use lever to Teleport OTHER PLAYER who is on POS x. Player who use lever don't get tp, he just use lever.
Can anyone help me?
 
LUA:
local beforePos = {x = 738, y = 700, z = 7},
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(getCreaturePosition(beforePos), afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
	return true
end
 
LUA:
local beforePos = {x = 738, y = 700, z = 7},
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 and item.actionid == 1234567 then
		doTransformItem(item.uid,1946, 1)
		doTeleportThing(getCreaturePosition(beforePos), afterPos)
		doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
		doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1945, 1)
	end
	return true
end

Thx, i'll test it tommorow and give you rep tommorow ;d.
 
One question, wouldn't it save you a lot of time just to get a scripter instead of making so many requests?

I dont have paypal and don't want to paid, its to expensive because I'm from poland.
1 USD = 3.2 ZŁ
You in job got something like 2k USD i'm in job got 2k ZŁ. The same numbers but it's not fcking the same cash ;/ but this is life.

LUA:
local beforePos = {x = 738, y = 700, z = 7},
local afterPos = {x = 743, y = 696, z = 7}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 and item.actionid == 1234567 then
        doTransformItem(item.uid,1946, 1)
        doTeleportThing(getCreaturePosition(beforePos), afterPos)
        doSendMagicEffect(beforePos, CONST_ME_TELEPORT)
        doSendMagicEffect(afterPos, CONST_ME_TELEPORT)
        doTransformItem(item.uid, 1945, 1)
    end
    return true
end

[01/02/2012 00:45:54] [Error - Action Interface]
[01/02/2012 00:45:54] data/actions/scripts/quests/levertp1.lua:onUse
[01/02/2012 00:45:54] Description:
[01/02/2012 00:45:54] (luaDoTeleportThing) Thing not found

The is magic effect but it don't tp player.


sry for double post.
 
Last edited by a moderator:
Back
Top