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

Tell me why my script doesn't work :p

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,321
Reaction score
18
Location
Sweden - Dalarna
Why does not my script work?
Code:
local playerPos1 = {x=33225, y=31671, z=13}
local playerPos2 = {x=33224, y=31671, z=13}
local playerPos3 = {x=33223, y=31671, z=13}
local playerPos4 = {x=33222, y=31671, z=13}

local getPlayer1 = getCreaturePosition(playerPos1)
local getPlayer2 = getCreaturePosition(playerPos2)
local getPlayer3 = getCreaturePosition(playerPos3)
local getPlayer4 = getCreaturePosition(playerPos4)

local getL1 = getPlayerLevel(cid)
local getL2 = getPlayerLevel(cid)
local getL3 = getPlayerLevel(cid)
local getL4 = getPlayerLevel(cid)
				
local newPlayerPos1 = {x=33222, y=31659, z=13}
local newPlayerPos2 = {x=33221, y=31659, z=13}
local newPlayerPos3 = {x=33220, y=31659, z=13}
local newPlayerPos4 = {x=33219, y=31659, z=13}

				
local demonPos1 = {x=33224, y=31659, z=13}
local demonPos2 = {x=33223, y=31659, z=13}
local demonPos3 = {x=33221, y=31657, z=13}
local demonPos4 = {x=33219, y=31657, z=13}
local demonPos5 = {x=33220, y=31661, z=13}
local demonPos6 = {x=33222, y=31661, z=13}

			function onUse(cid, item, frompos, item2, topos)
				if item.itemid == 1945 and item.uid == 5000 then
					if getPlayer1 == 1 and getPlayer2 == 1 and getPlayer3 == 1 and getPlayer4 == 1 then
						if getL1 >= 100 and getL2 >= 100 and getL3 >= 100 and getL4 >= 100 then
							doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
							doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
							doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
							doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)
							doSummonCreature("Demon",demonPos1)
							doSummonCreature("Demon",demonPos2)
							doSummonCreature("Demon",demonPos3)
							doSummonCreature("Demon",demonPos4)
							doSummonCreature("Demon",demonPos5)
							doSummonCreature("Demon",demonPos6)
							else
							doPlayerSendCancel(cid, "You need 4 players for this quest.")
						end
						return TRUE
					end
				
		elseif item.itemid == 1946 then
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end

	return TRUE
end
 
I just get error when I /reload actions
:s
Nothing happens when I pull the lever, not even "sorry not possible"

but anyways, here's the error when I reload actions:
Code:
[24/05/2009 13:27:34] Lua Script Error: [Action Interface] 
[24/05/2009 13:27:34] data/actions/scripts/edron/anni/anni.lua

[24/05/2009 13:27:35] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:27:35] Lua Script Error: [Action Interface] 
[24/05/2009 13:27:35] data/actions/scripts/edron/anni/anni.lua

[24/05/2009 13:27:35] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:27:35] Lua Script Error: [Action Interface] 
[24/05/2009 13:27:35] data/actions/scripts/edron/anni/anni.lua

[24/05/2009 13:27:36] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:27:36] Lua Script Error: [Action Interface] 
[24/05/2009 13:27:36] data/actions/scripts/edron/anni/anni.lua

[24/05/2009 13:27:36] luaGetCreaturePosition(). Creature not found
 
Lua:
local playerPos1 = {x=33225, y=31671, z=13}
local playerPos2 = {x=33224, y=31671, z=13}
local playerPos3 = {x=33223, y=31671, z=13}
local playerPos4 = {x=33222, y=31671, z=13}

local newPlayerPos1 = {x=33222, y=31659, z=13}
local newPlayerPos2 = {x=33221, y=31659, z=13}
local newPlayerPos3 = {x=33220, y=31659, z=13}
local newPlayerPos4 = {x=33219, y=31659, z=13}

local demonPos1 = {x=33224, y=31659, z=13}
local demonPos2 = {x=33223, y=31659, z=13}
local demonPos3 = {x=33221, y=31657, z=13}
local demonPos4 = {x=33219, y=31657, z=13}
local demonPos5 = {x=33220, y=31661, z=13}
local demonPos6 = {x=33222, y=31661, z=13}

function onUse(cid, item, frompos, item2, topos)
	if item.itemid == 1945 and item.uid == 5000 then
		local getPlayer1 = getCreaturePosition(playerPos1)
		local getPlayer2 = getCreaturePosition(playerPos2)
		local getPlayer3 = getCreaturePosition(playerPos3)
		local getPlayer4 = getCreaturePosition(playerPos4)
		
		if getPlayer1 == 1 and getPlayer2 == 1 and getPlayer3 == 1 and getPlayer4 == 1 the
			local getL1 = getPlayerLevel(cid)
			local getL2 = getPlayerLevel(cid)
			local getL3 = getPlayerLevel(cid)
			local getL4 = getPlayerLevel(cid)
			if getL1 >= 100 and getL2 >= 100 and getL3 >= 100 and getL4 >= 100 then
				doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
				doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
				doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
				doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)
				doSummonCreature("Demon",demonPos1)
				doSummonCreature("Demon",demonPos2)
				doSummonCreature("Demon",demonPos3)
				doSummonCreature("Demon",demonPos4)
				doSummonCreature("Demon",demonPos5)
				doSummonCreature("Demon",demonPos6)
			else
				doPlayerSendCancel(cid, "You need 4 players for this quest.")
			end
			return TRUE
		end
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end

	return TRUE
end
 
Last edited by a moderator:
Why don't you use the default TFS annihilator script, and you place the demons in your mapeditor with the lowest respawn time?

@Rizz:

Why don't you try [ lua ] :) [ /lua ] tags for your scripts, they look better :p
 
The default annihilator script doesn't work.

EDIT;
Testing your edited version Rizz


EDIT2;
Doesn't work Rizz...
Code:
[24/05/2009 13:41:16] Lua Script Error: [Action Interface] 
[24/05/2009 13:41:16] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:41:16] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:41:16] Lua Script Error: [Action Interface] 
[24/05/2009 13:41:16] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:41:16] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:41:17] Lua Script Error: [Action Interface] 
[24/05/2009 13:41:17] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:41:17] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:41:17] Lua Script Error: [Action Interface] 
[24/05/2009 13:41:17] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:41:17] luaGetCreaturePosition(). Creature not found
 
Last edited:
REMEMBER THIS FOREVER!!

you should always put the "locals" to functions that get information from a player, after the function of the script, in this case after "function onUse."

Example:

Lua:
local playerName = getCreatureName(cid)
function onUse(cid, item, fromPosition, itemEx, toPosition)
THIS IS WRONG!!

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerName = getCreatureName(cid)
THIS IS GOOD!!!

So... put:
Lua:
local getPlayer1 = getCreaturePosition(playerPos1)
local getPlayer2 = getCreaturePosition(playerPos2)
local getPlayer3 = getCreaturePosition(playerPos3)
local getPlayer4 = getCreaturePosition(playerPos4)

After
Lua:
function onUse(cid, item, frompos, item2, topos)
 
Try it.
Lua:
function onUse(cid, item, frompos, item2, topos)
local playerPos1 = {x=33225, y=31671, z=13}
local playerPos2 = {x=33224, y=31671, z=13}
local playerPos3 = {x=33223, y=31671, z=13}
local playerPos4 = {x=33222, y=31671, z=13}

local getPlayer1 = getCreaturePosition(playerPos1)
local getPlayer2 = getCreaturePosition(playerPos2)
local getPlayer3 = getCreaturePosition(playerPos3)
local getPlayer4 = getCreaturePosition(playerPos4)

local getL1 = getPlayerLevel(getPlayer1)
local getL2 = getPlayerLevel(getPlayer2)
local getL3 = getPlayerLevel(getPlayer3)
local getL4 = getPlayerLevel(getPlayer4)
                                
local newPlayerPos1 = {x=33222, y=31659, z=13}
local newPlayerPos2 = {x=33221, y=31659, z=13}
local newPlayerPos3 = {x=33220, y=31659, z=13}
local newPlayerPos4 = {x=33219, y=31659, z=13}

                                
local demonPos1 = {x=33224, y=31659, z=13}
local demonPos2 = {x=33223, y=31659, z=13}
local demonPos3 = {x=33221, y=31657, z=13}
local demonPos4 = {x=33219, y=31657, z=13}
local demonPos5 = {x=33220, y=31661, z=13}
local demonPos6 = {x=33222, y=31661, z=13}

      if item.itemid == 1945 and item.uid == 5000 then
         if getPlayer1 == 1 and getPlayer2 == 1 and getPlayer3 == 1 and getPlayer4 == TRUE then
            if getL1 >= 100 and getL2 >= 100 and getL3 >= 100 and getL4 >= 100 then
               doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
               doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
               doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
               doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)
               doSummonCreature("Demon",demonPos1)
               doSummonCreature("Demon",demonPos2)
               doSummonCreature("Demon",demonPos3)
               doSummonCreature("Demon",demonPos4)
               doSummonCreature("Demon",demonPos5)
               doSummonCreature("Demon",demonPos6)
            else
               doPlayerSendCancel(cid, "You must be level 100 or higher.")
            end
         else
             doPlayerSendCancel(cid, "You need 4 players to do this quest.")
         end                         
         elseif item.itemid == 1946 then
            doTransformItem(item.uid, item.itemid - 1)
            doPlayerSendCancel(cid, "Try again.")
      end
      return TRUE
end

You got the message "sorry not possible" cuz you switch id should be 1945 and you're using 1946. I fixed it..
 
Last edited:
@up
It says I need 4 players even though there is 4 :s

EDIT; thanks for the tip Darkhaos

EDIT2; I did put
Code:
  local getPlayer1 = getCreaturePosition(playerPos1)
local getPlayer2 = getCreaturePosition(playerPos2)
local getPlayer3 = getCreaturePosition(playerPos3)
local getPlayer4 = getCreaturePosition(playerPos4) 
and
local getL1 = getPlayerLevel(getPlayer1)
local getL2 = getPlayerLevel(getPlayer2)
local getL3 = getPlayerLevel(getPlayer3)
local getL4 = getPlayerLevel(getPlayer4)
under function onUse~ now I get error when I use the lever
Code:
[24/05/2009 13:54:44] Lua Script Error: [Action Interface] 
[24/05/2009 13:54:45] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:54:45] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:54:45] Lua Script Error: [Action Interface] 
[24/05/2009 13:54:45] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:54:45] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:54:45] Lua Script Error: [Action Interface] 
[24/05/2009 13:54:46] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:54:46] luaGetCreaturePosition(). Creature not found

[24/05/2009 13:54:46] Lua Script Error: [Action Interface] 
[24/05/2009 13:54:46] data/actions/scripts/edron/anni/anni.lua:onUse

[24/05/2009 13:54:46] luaGetCreaturePosition(). Creature not found
 
Last edited:
Change all the
PHP:
playerPosX
to

PHP:
playerPosX = (cordsPartHere, stackpos = STACKPOS_TOP_CREATURE)

change all
PHP:
getCreaturePosition
to

PHP:
getThingfromPos
 
Haha.. sorry i forget explain this

add this to your script after the player positions:

Lua:
local getPlayerPos1 = getThingFromPos(playerPos1)
local getPlayerPos2 = getThingFromPos(playerPos2)
local getPlayerPos3 = getThingFromPos(playerPos3)
local getPlayerPos4 = getThingFromPos(playerPos4)

and change this
Lua:
 local getPlayer1 = getCreaturePosition(playerPos1)
local getPlayer2 = getCreaturePosition(playerPos2)
local getPlayer3 = getCreaturePosition(playerPos3)
local getPlayer4 = getCreaturePosition(playerPos4)

To
Lua:
 local getPlayer1 = getCreaturePosition(getPlayerPos1.uid)
local getPlayer2 = getCreaturePosition(getPlayerPos2.uid)
local getPlayer3 = getCreaturePosition(getPlayerPos3.uid)
local getPlayer4 = getCreaturePosition(getPlayerPos4.uid)

@UP!

Today everybody is more faster than me :(
 
EDIT; ops forgot stackpos thingy.

EDIT2; still doesn't work, now it says "You need to be 4 players"~~ even though it is 4 players above 100. No errors
the script now;
Lua:
 function onUse(cid, item, frompos, item2, topos)
						
		local playerPos1 = {x=33225, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
		local playerPos2 = {x=33224, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
		local playerPos3 = {x=33223, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
		local playerPos4 = {x=33222, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
								
		local getPlayerPos1 = getThingFromPos(playerPos1)
		local getPlayerPos2 = getThingFromPos(playerPos2)
		local getPlayerPos3 = getThingFromPos(playerPos3)
		local getPlayerPos4 = getThingFromPos(playerPos4) 
								
		local getPlayer1 = getCreaturePosition(getPlayerPos1.uid)
		local getPlayer2 = getCreaturePosition(getPlayerPos2.uid)
		local getPlayer3 = getCreaturePosition(getPlayerPos3.uid)
		local getPlayer4 = getCreaturePosition(getPlayerPos4.uid)
								
		local getL1 = getPlayerLevel(getPlayer1)
		local getL2 = getPlayerLevel(getPlayer2)
		local getL3 = getPlayerLevel(getPlayer3)
		local getL4 = getPlayerLevel(getPlayer4)
                               
		local newPlayerPos1 = {x=33222, y=31659, z=13}
		local newPlayerPos2 = {x=33221, y=31659, z=13}
		local newPlayerPos3 = {x=33220, y=31659, z=13}
		local newPlayerPos4 = {x=33219, y=31659, z=13}

                               
		local demonPos1 = {x=33224, y=31659, z=13}
		local demonPos2 = {x=33223, y=31659, z=13}
		local demonPos3 = {x=33221, y=31657, z=13}
		local demonPos4 = {x=33219, y=31657, z=13}
		local demonPos5 = {x=33220, y=31661, z=13}
		local demonPos6 = {x=33222, y=31661, z=13}
								
		 if item.itemid == 1945 and item.uid == 5000 then
             if getPlayer1 == TRUE and getPlayer2 == TRUE and getPlayer3 == TRUE and getPlayer4 == TRUE then
                if getL1 >= 100 and getL2 >= 100 and getL3 >= 100 and getL4 >= 100 then
                    doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
                    doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
                    doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
                    doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)
                    doSummonCreature("Demon",demonPos1)
                    doSummonCreature("Demon",demonPos2)
                    doSummonCreature("Demon",demonPos3)
                    doSummonCreature("Demon",demonPos4)
                    doSummonCreature("Demon",demonPos5)
                    doSummonCreature("Demon",demonPos6)
                    else
						doPlayerSendCancel(cid, "You must be level 100 or higher.")
                    end
						else
                            doPlayerSendCancel(cid, "You need 4 players to do this quest.")
                        end    
                        
                elseif item.itemid == 1946 then
                    doTransformItem(item.uid, item.itemid - 1)
                    doPlayerSendCancel(cid, "Try again.")
                end
                return TRUE
            end
 
Change:
Lua:
                local getL1 = getPlayerLevel(getPlayer1)
                local getL2 = getPlayerLevel(getPlayer2)
                local getL3 = getPlayerLevel(getPlayer3)
                local getL4 = getPlayerLevel(getPlayer4)

To
Lua:
                local getL1 = getPlayerLevel(getPlayer1.uid)
                local getL2 = getPlayerLevel(getPlayer2.uid)
                local getL3 = getPlayerLevel(getPlayer3.uid)
                local getL4 = getPlayerLevel(getPlayer4.uid)

Change:
Lua:
if getPlayer1 == TRUE and getPlayer2 == TRUE and getPlayer3 == TRUE and getPlayer4 == TRUE then

To:
Lua:
if getPlayer1.itemid > 0 and getPlayer2.itemid > 0 and getPlayer3.itemid > 0 and getPlayer4.itemid > 0 then

Change:
Lua:
                    doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
                    doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
                    doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
                    doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)

To:
Lua:
                    doTeleportThing(getPlayer1.uid, newPlayerPos1, TRUE)
                    doTeleportThing(getPlayer2.uid, newPlayerPos2, TRUE)
                    doTeleportThing(getPlayer3.uid, newPlayerPos3, TRUE)
                    doTeleportThing(getPlayer4.uid, newPlayerPos4, TRUE)
 
Lua:
local playerPos1 = {x=33225, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
local playerPos2 = {x=33224, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
local playerPos3 = {x=33223, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}
local playerPos4 = {x=33222, y=31671, z=13, stackpos = STACKPOS_TOP_CREATURE}

local newPlayerPos1 = {x=33222, y=31659, z=13}
local newPlayerPos2 = {x=33221, y=31659, z=13}
local newPlayerPos3 = {x=33220, y=31659, z=13}
local newPlayerPos4 = {x=33219, y=31659, z=13}

local demonPos1 = {x=33224, y=31659, z=13}
local demonPos2 = {x=33223, y=31659, z=13}
local demonPos3 = {x=33221, y=31657, z=13}
local demonPos4 = {x=33219, y=31657, z=13}
local demonPos5 = {x=33220, y=31661, z=13}
local demonPos6 = {x=33222, y=31661, z=13}

function onUse(cid, item, frompos, item2, topos)

	local getPlayer1 = getThingFromPos(playerPos1)
	local getPlayer2 = getThingfromPos(playerPos2)
	local getPlayer3 = getThingFromPos(playerPos3)
	local getPlayer4 = getThingFromPos(playerPos4)
	
	local getL1 = getPlayerLevel(getPlayer1.uid)
	local getL2 = getPlayerLevel(getPlayer2.uid)
	local getL3 = getPlayerLevel(getPlayer3.uid)
	local getL4 = getPlayerLevel(getPlayer4.uid)
	
	if item.itemid == 1945 and item.uid == 5000 then
		if isPlayer(getL1) == TRUE and isPlayer(getL2) == TRUE and isPlayer(getL3) == TRUE and isPlayer(getL4) == TRUE then
			if getL1 >= 100 and getL2 >= 100 and getL3 >= 100 and getL4 >= 100 then
				doTeleportThing(playerPos1.uid, newPlayerPos1, TRUE)
				doTeleportThing(playerPos2.uid, newPlayerPos2, TRUE)
				doTeleportThing(playerPos3.uid, newPlayerPos3, TRUE)
				doTeleportThing(playerPos4.uid, newPlayerPos4, TRUE)
				doSummonCreature("Demon",demonPos1)
				doSummonCreature("Demon",demonPos2)
				doSummonCreature("Demon",demonPos3)
				doSummonCreature("Demon",demonPos4)
				doSummonCreature("Demon",demonPos5)
				doSummonCreature("Demon",demonPos6)
			else
				doPlayerSendCancel(cid, "You must be level 100 or higher.")
			end
		else
			doPlayerSendCancel(cid, "You need 4 players to do this quest.")
		end
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
		doPlayerSendCancel(cid, "Try again.")
	end
	return TRUE
end

Should be working and is correctly tabbed.
 
Use the TFS aniihilator script

Lua:
local playerPosition =
{
	{x = 247, y = 659, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 660, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 661, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 662, z = 13, stackpos = STACKPOS_TOP_CREATURE}
}

local newPosition =
{
	{x = 189, y = 650, z = 13},
 	{x = 189, y = 651, z = 13},
	{x = 189, y = 652, z = 13},
	{x = 189, y = 653, z = 13}
}

local demonPosition =
{
	{x = 247, y = 659, z = 12},
	{x = 247, y = 660, z = 12},
	{x = 247, y = 661, z = 12},
	{x = 247, y = 662, z = 12}
}

-- Do not modify the declaration lines below.
local player = {0, 0, 0, 0}
local failed = TRUE

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for i = 1, 4 do
			player[i] = getThingfromPos(playerPosition[i])
			if player[i].itemid > 0 then
				if isPlayer(player[i].uid) == TRUE then
					if getPlayerStorageValue(player[i].uid, 30015) == nil then
						if getPlayerLevel(player[i].uid) >= 100 then
							failed = FALSE
						end
					end
				end
			end

			if failed == TRUE then
				doPlayerSendCancel(cid, "Sorry, not possible.")
				return TRUE
			end

			failed = TRUE
		end

		for i = 1, 4 do
			doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
			doTeleportThing(player[i].uid, newPosition[i], FALSE)
			doSummonCreature("Demon", demonPosition[i])
			doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 then
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end

	return TRUE
end
 
TFS annih
Lua:
local playerPosition =
{
	{x = 247, y = 659, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 660, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 661, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 247, y = 662, z = 13, stackpos = STACKPOS_TOP_CREATURE}
}

local newPosition =
{
	{x = 189, y = 650, z = 13},
 	{x = 189, y = 651, z = 13},
	{x = 189, y = 652, z = 13},
	{x = 189, y = 653, z = 13}
}

-- Do not modify the declaration lines below.
local player = {0, 0, 0, 0}
local failed = TRUE

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for i = 1, 4 do
			player[i] = getThingfromPos(playerPosition[i])
			if player[i].itemid > 0 then
				if isPlayer(player[i].uid) == TRUE then
					if getPlayerStorageValue(player[i].uid, 30015) == -1 then
						if getPlayerLevel(player[i].uid) >= 100 then
							failed = FALSE
						end
					end
				end
			end

			if failed == TRUE then
				doPlayerSendCancel(cid, "Sorry, not possible.")
				return TRUE
			end

			failed = TRUE
		end

		for i = 1, 4 do
			doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
			doTeleportThing(player[i].uid, newPosition[i], FALSE)
			doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 then
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end

	return TRUE
end
 
Back
Top