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

Don't know what i should call this. Help please :)

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
I need some help with a script that i have been working on today.

Here is the script

Code:
local tile1pos = {x=592, y=1419, z=14, stackpos=0}
local tile2pos = {x=593, y=1419, z=14, stackpos=0}
local tile3pos = {x=592, y=1418, z=14, stackpos=0}
local tile4pos = {x=593, y=1418, z=14, stackpos=0}
local lever1pos = {x=596, y=1424, z=14, stackpos=1}
local lever2pos = {x=589, y=1416, z=14, stackpos=1}

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

local tile1 = getThingfromPos(tile1pos)
local tile2 = getThingfromPos(tile2pos)
local tile3 = getThingfromPos(tile3pos)
local tile4 = getThingfromPos(tile4pos)
local lever1 = getThingfromPos(lever1pos)
local lever2 = getThingfromPos(lever2pos)

local newpos1 = {x = 592, y = 1420, z = 14}
local playerpos1 = getTopCreature(tile1pos).uid
local playerpos2 = getTopCreature(tile2pos).uid
local playerpos3 = getTopCreature(tile3pos).uid
local playerpos4 = getTopCreature(tile4pos).uid




if (item.itemid == 1945 and tile1.itemid == 598 and tile2.itemid == 598 and tile3.itemid == 598 and tile4.itemid == 598) then
	doRemoveItem(tile1.uid,598)
		doCreateItem(407,1,tile1pos)
	doRemoveItem(tile2.uid,598)
		doCreateItem(407,1,tile2pos)
	doRemoveItem(tile3.uid,598)
		doCreateItem(407,1,tile3pos)
	doRemoveItem(tile4.uid,598)
		doCreateItem(407,1,tile4pos)

doTransformItem(lever1.uid,1946)
doTransformItem(lever2.uid,1946)

[COLOR="Red"]elseif (item.itemid == 1946 and tile1.itemid == 407 and tile2.itemid == 407 and tile3.itemid == 407 and tile4.itemid == 407) then

	if playerpos1 or playerpos2 or playerpos3 or playerpos4 then

			doTeleportThing(playerpos1, newpos1)
			doTeleportThing(playerpos2, newpos1)
			doTeleportThing(playerpos3, newpos1)
			doTeleportThing(playerpos4, newpos1)

	doRemoveItem(tile1.uid,407)
		doCreateItem(598,1,tile1pos)
	doRemoveItem(tile2.uid,407)
		doCreateItem(598,1,tile2pos)
	doRemoveItem(tile3.uid,407)
		doCreateItem(598,1,tile3pos)
	doRemoveItem(tile4.uid,407)
		doCreateItem(598,1,tile4pos)

doTransformItem(lever1.uid,1945)
doTransformItem(lever2.uid,1945)[/COLOR]
else 
doPlayerSendCancel(cid,"Sorry, not possible.") 
end
end
return 1
end

The red part is where i need help. I should be like this...
If a player is standing on one of the playerpos when the switch is used the player should be teleportet to newpos and tiles should be removed and new should be created.
If no players is on playerspos1,2,3 and 4 then just remove tiles and add new..
Holy shit this explanation is so bad, hopefully someone understands....
Btw there should be 2 newposes instead of just one.
So it works like this.
Playerpos 1 and 3 teleports to newpos1.
Playerpos 2 and 4 teleports to newpos2.

Sorry for my english and bad explanation but im tired and stressed :p

Have a good day.
Hopefully someone can help me with this..
 
Is that like LMS (Last Man standing) Many player standing on tiles and when you switch all player tps to Arena ? or
 
Hmmm, I can't see where is something like

Code:
{x=xxxx,y=yyyy,z=z}
for playerpos'es.. Am I blind or you missed that ?xD


local tile1pos = {x=592, y=1419, z=14, stackpos=0}
local tile2pos = {x=593, y=1419, z=14, stackpos=0}
local tile3pos = {x=592, y=1418, z=14, stackpos=0}
local tile4pos = {x=593, y=1418, z=14, stackpos=0}

local playerpos1 = getTopCreature(tile1pos).uid
local playerpos2 = getTopCreature(tile2pos).uid
local playerpos3 = getTopCreature(tile3pos).uid
local playerpos4 = getTopCreature(tile4pos).uid

Better now? The script is pretty complicated. I didn't make the whole script. Just edited some and trying to get it work.. :p
 
local tile1pos = {x=592, y=1419, z=14, stackpos=0}
local tile2pos = {x=593, y=1419, z=14, stackpos=0}
local tile3pos = {x=592, y=1418, z=14, stackpos=0}
local tile4pos = {x=593, y=1418, z=14, stackpos=0}

local playerpos1 = getTopCreature(tile1pos).uid
local playerpos2 = getTopCreature(tile2pos).uid
local playerpos3 = getTopCreature(tile3pos).uid
local playerpos4 = getTopCreature(tile4pos).uid

Better now? The script is pretty complicated. I didn't make the whole script. Just edited some and trying to get it work.. :p
if these tiles are for players teleporting they must have stackpos = 253
 
Is that like LMS (Last Man standing) Many player standing on tiles and when you switch all player tps to Arena ? or

I mean that if a players is standing on some of the playerspos and lever id is 1946 he should be moved, cause if the player doesn't get moved he will stand on lava if you lever is used.
 
if these tiles are for players teleporting they must have stackpos = 253
Not if you're using getTopCreature, only with getThingfromPos :p
I mean that if a players is standing on some of the playerspos and lever id is 1946 he should be moved, cause if the player doesn't get moved he will stand on lava if you lever is used.
Code:
	//doRelocate(pos, posTo[, creatures = true])
	//Moves all moveable objects from pos to posTo
:p
 
I don't know how in 0.4, but in 0.3.6 you have a 'doc' folder near 'data' folder(in ur OTS directory). Try to find LUAFUNCTIONS.


(If not try to get source - as Cyko said :))
 
Back
Top