I need some help with a script that i have been working on today.
Here is the script
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
Have a good day.
Hopefully someone can help me with this..
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
Have a good day.
Hopefully someone can help me with this..