What's new

Skrypty & Kody TFS 1.2 - dzwignia tworzaca/usuwajaca

Pucek1993

Active User
Joined
Feb 4, 2016
Messages
71
Reaction score
1
Witam, mam pro?be - dos?ownie malutk?. Pom?g?by mi ktos wrzuci? pozycje ?cia? do tabeli? Chce zrobi?, aby skrypt usuwa? ok. 10 ?cian na raz, a by?by strasznie d?ugi.

PHP:
local pos = {x=899,  y=887,  z=12, 256}
local wall = 1304
local pos5 = {x=900,  y=887,  z=12, 256}
local level = 5
local seconds = 5
local event = 0
 
local function reset(leverPos)
        local lever = getTileItemById(leverPos, 1946).uid
   doTransformItem(lever, 1945)
   doCreateItem(wall, 1, pos)
                   doRemoveItem(getTileItemById(pos5,1481).uid)
        doPlayerSendTextMessage(cid,21,"The pass has been closed!")
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
 
          if item.itemid == 1945 and getPlayerLevel(cid) >= level then
                doRemoveItem(getTileItemById(pos,wall).uid)
				      doCreateItem(1481, 1, pos5)
                doPlayerSendTextMessage(cid,21,"You have opened the pass, Beware!")
                event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
      doTransformItem(item.uid,item.itemid+1)
   elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
      stopEvent(event)
      doPlayerSendTextMessage(cid,21,"You have closed the pass!")
      doTransformItem(item.uid,item.itemid-1)
      doCreateItem(wall, 1, pos)
end
return true
end

Pr?bowa?em tak .. local pos = {x=899, y=887, z=12, 256},{x=899, y=887, z=12, 256}

Ale nie dzia?a, s?aby jestem w te klocki. Pozdrawiam i czekam na odpowiedzi :D

Mo?e musi by? co? w stylu..

local pos = {
[1]{ x=899, y=887, z=12, 256},
[2]{x=899, y=887, z=12, 256}

Jak ju? pisa?em, cienko ! :D
 

Saiyans King

Forum friend
Joined
Feb 6, 2009
Messages
97
Reaction score
18
Odp: TFS 1.2 - dzwignia tworzaca/usuwajaca

[LUA]local config = {
level = 5,
wallId = 1304,
seconds = 5,
wallPos = {
{x=899, y=887, z=12},
{x=900, y=887, z=12},
},
}

local event = 0

local function resetWall(pid, leverPos)
local t = Tile(leverPos)
if(t) then
local lever = t:getItemById(1946)
if(lever) then
lever:transform(1945)
end
end

for _, positions in ipairs(config.wallPos) do
Game.createItem(config.wallId, 1, positions)
end

local player = Player(pid)
if(player) then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "The pass has been closed!")
end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemid = item:getId()
if(itemid == 1945 and player:getLevel() >= config.level) then
for _, positions in ipairs(config.wallPos) do
local t = Tile(positions)
if(t) then
local wall = t:getItemById(config.wallId)
if(wall) then
wall:remove()
end
end
end

player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have opened the pass, Beware!")
event = addEvent(resetWall, config.seconds * 1000, player:getId(), item:getPosition())
item:transform(itemid+1)
elseif(itemid == 1946 and player:getLevel() >= config.level) then
if(event == 0) then
return true
end

stopEvent(event)
event = 0

player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have closed the pass!")
item:transform(itemid-1)
for _, positions in ipairs(config.wallPos) do
Game.createItem(config.wallId, 1, positions)
end
end

return true
end[/LUA]
Jako ze napisa?e? i? ma to by? pod tfs 1.2 to zamieni?em ci ten obrzydliwy kod na bardziej ten z tfs 1.2.
Powinno dzia?a? ale nie mam okazji ?eby przetestowa? czy nie ma jakiej? liter?wki.
 

Pucek1993

Active User
Joined
Feb 4, 2016
Messages
71
Reaction score
1
Odp: TFS 1.2 - dzwignia tworzaca/usuwajaca

Dzi?kuj? jutro rano sprawdz?. Tak to TFS skompilowany pod 7.70. Pozdrawiam :)
 
Top