Postado Maio 16, 2022 3 anos Tenho Este Script Aqui De Plantação: Spoiler -- Plantation System created by Vítor Bertolucci - Killua -- 02/04/2014 local usableDirt = 103 -- Dirt to seed local mustBeInHouse = true -- Is it only enabled inside houses? [true/false] local fruits = {2682, 5097, 8838, 2685, 2674} -- Fruits that can grow local failChance = 0 -- Fail chance in % function transformIt(pos, id) -- Seeds the ground pos.stackpos = 0 return doTransformItem(getThingFromPos(pos).uid, id) end function getUnwantedItem(pos) -- Checks for unwanted items for i = 1, 5 do pos.stackpos = i if getThingFromPos(pos).itemid > 0 and getThingFromPos(pos).itemid ~= 7732 then return true end end return false end function transformTo(pos, fromid, toid) -- Makes the plants grow for s = 1, 5 do pos.stackpos = s local item = getThingFromPos(pos) if item.itemid == fromid then doTransformItem(item.uid, toid) end end end function doRemoveMe(pos, id) -- Removes weeds for stackpos = 1, 5 do pos.stackpos = stackpos local item = getThingFromPos(pos) if item.itemid == id then doRemoveItem(item.uid) end end end function onUse(cid, item, fromPosition, itemEx, toPosition) if mustBeInHouse and not getHouseFromPos(toPosition) then return doPlayerSendCancel(cid, "You can only plant inside houses.") end toPosition.stackpos = 0 local tile = getThingFromPos(toPosition) if tile.itemid == usableDirt and not getUnwantedItem(toPosition) and itemEx.itemid ~= 7732 then if item.itemid == 2552 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have plowed the ground.") doTransformItem(tile.uid, 804) addEvent(transformIt, math.random(44600, 48600), toPosition, usableDirt) end elseif item.itemid == 7732 and tile.itemid == 804 and not getUnwantedItem(toPosition) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have planted the seed.") doRemoveItem(item.uid, 1) doCreateItem(6216, 1, toPosition) doSendMagicEffect(toPosition, CONST_ME_SMALLPLANTS) local chance = math.random(1, 100) local time1 = math.random(8500, 12600) local time2 = math.random(24500, 28600) if chance <= failChance then addEvent(transformTo, time1, toPosition, 6216, 2784) addEvent(doSendMagicEffect, time1, toPosition, 7) addEvent(doRemoveMe, time2, toPosition, 2784) addEvent(doSendMagicEffect, time2, toPosition, CONST_ME_POFF) else addEvent(transformTo, time1, toPosition, 6216, 2779) addEvent(doSendMagicEffect, time1, toPosition, CONST_ME_SMALLPLANTS) addEvent(doSendMagicEffect, time2, toPosition, CONST_ME_PLANTATTACK) addEvent(transformTo, time2, toPosition, 2779, fruits[math.random(1, #fruits)]) end elseif itemEx.itemid == 2784 or itemEx.itemid == 2779 then if tile.itemid == 804 or tile.itemid == 103 then doRemoveItem(itemEx.uid, 1) doSendMagicEffect(toPosition, 3) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have removed the plant.") end else doPlayerSendCancel(cid, "You cannot plow this ground.") end return true end Como deu para reparar, ele é um action, e não achei muito viável dele ser um action pois estou sempre dando reload nos actions e acaba travando o sistema, gostaria de saber se tem como muda-lo para Movemevents Ou Globalevents Ou Creaturescript. caso não dê se pudesse ver alguma forma de não interromper o script sempre que eu desse reload nos actions, oque interrompe é o time sempre que eu dou reload e a a plantação da pessoa ainda esta em tempo de crescimento o sistema interrompe e não cresce nem muda nada, até o chão que o script muda, se ele for interrompido no meio o chão não volta ele fica sempre "arado" ao inves de voltar ao normal depois de um tempo rep+++
Postado Maio 22, 2022 3 anos Em 16/05/2022 em 20:33, Thony D. Serv disse: Tenho Este Script Aqui De Plantação: Ocultar conteúdo -- Plantation System created by Vítor Bertolucci - Killua -- 02/04/2014 local usableDirt = 103 -- Dirt to seed local mustBeInHouse = true -- Is it only enabled inside houses? [true/false] local fruits = {2682, 5097, 8838, 2685, 2674} -- Fruits that can grow local failChance = 0 -- Fail chance in % function transformIt(pos, id) -- Seeds the ground pos.stackpos = 0 return doTransformItem(getThingFromPos(pos).uid, id) end function getUnwantedItem(pos) -- Checks for unwanted items for i = 1, 5 do pos.stackpos = i if getThingFromPos(pos).itemid > 0 and getThingFromPos(pos).itemid ~= 7732 then return true end end return false end function transformTo(pos, fromid, toid) -- Makes the plants grow for s = 1, 5 do pos.stackpos = s local item = getThingFromPos(pos) if item.itemid == fromid then doTransformItem(item.uid, toid) end end end function doRemoveMe(pos, id) -- Removes weeds for stackpos = 1, 5 do pos.stackpos = stackpos local item = getThingFromPos(pos) if item.itemid == id then doRemoveItem(item.uid) end end end function onUse(cid, item, fromPosition, itemEx, toPosition) if mustBeInHouse and not getHouseFromPos(toPosition) then return doPlayerSendCancel(cid, "You can only plant inside houses.") end toPosition.stackpos = 0 local tile = getThingFromPos(toPosition) if tile.itemid == usableDirt and not getUnwantedItem(toPosition) and itemEx.itemid ~= 7732 then if item.itemid == 2552 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have plowed the ground.") doTransformItem(tile.uid, 804) addEvent(transformIt, math.random(44600, 48600), toPosition, usableDirt) end elseif item.itemid == 7732 and tile.itemid == 804 and not getUnwantedItem(toPosition) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have planted the seed.") doRemoveItem(item.uid, 1) doCreateItem(6216, 1, toPosition) doSendMagicEffect(toPosition, CONST_ME_SMALLPLANTS) local chance = math.random(1, 100) local time1 = math.random(8500, 12600) local time2 = math.random(24500, 28600) if chance <= failChance then addEvent(transformTo, time1, toPosition, 6216, 2784) addEvent(doSendMagicEffect, time1, toPosition, 7) addEvent(doRemoveMe, time2, toPosition, 2784) addEvent(doSendMagicEffect, time2, toPosition, CONST_ME_POFF) else addEvent(transformTo, time1, toPosition, 6216, 2779) addEvent(doSendMagicEffect, time1, toPosition, CONST_ME_SMALLPLANTS) addEvent(doSendMagicEffect, time2, toPosition, CONST_ME_PLANTATTACK) addEvent(transformTo, time2, toPosition, 2779, fruits[math.random(1, #fruits)]) end elseif itemEx.itemid == 2784 or itemEx.itemid == 2779 then if tile.itemid == 804 or tile.itemid == 103 then doRemoveItem(itemEx.uid, 1) doSendMagicEffect(toPosition, 3) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have removed the plant.") end else doPlayerSendCancel(cid, "You cannot plow this ground.") end return true end Como deu para reparar, ele é um action, e não achei muito viável dele ser um action pois estou sempre dando reload nos actions e acaba travando o sistema, gostaria de saber se tem como muda-lo para Movemevents Ou Globalevents Ou Creaturescript. caso não dê se pudesse ver alguma forma de não interromper o script sempre que eu desse reload nos actions, oque interrompe é o time sempre que eu dou reload e a a plantação da pessoa ainda esta em tempo de crescimento o sistema interrompe e não cresce nem muda nada, até o chão que o script muda, se ele for interrompido no meio o chão não volta ele fica sempre "arado" ao inves de voltar ao normal depois de um tempo rep+++ qual rev tu usa? Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Maio 27, 2022 3 anos melhor metodo seria criar uma db + globalevents, ai n teria como cancelar o event, ja que o time seria salvo na propria db... é mta plantação? [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.