Postado Abril 30, 2017 8 anos tenho um script que peguei aqui no TK, que quando o player usa um item, ele eh teleportado pra uma area de UP por 6 horas. eu queria que só 1 por pessoa por vez pudesse ir nessa area. alguem sabe colocar uma função que quando tiver um player em determinada area "from, to" o item cancelasse? script que eu uso: Citar function onUse(cid, item, frompos, item2, topos) local config = { timeExhausted = 24, -- tempo em horas para poder usar o item novamente. timeForUse = 6, -- tempo em horas que o player poderá entrar na cave. exhausted = 456789, storage = 789456, toKnow = 123456, effect = 27, -- efeito que dará ao usar o item. } if getPlayerStorageValue(cid, config.exhausted) < os.time() and item.itemid == 4864 and getPlayerLevel(cid) > 50000 then setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time()) setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time()) setPlayerStorageValue (cid, config.toKnow, 1) doRemoveItem(item.uid,1) doSendMagicEffect (getThingPos(cid), config.effect) doPlayerSendTextMessage (cid, 19, "Agora voce tem acesso a PayHunt por 6 horas.") elseif getPlayerStorageValue(cid, config.exhausted) > os.time() then doPlayerSendTextMessage (cid, 19, "*Voce esta exausto, aguarde 24 horas desde a ultima vez que voce usou o item.") elseif item.itemid > 4864 then doPlayerSendTextMessage (cid, 19, "*O item deve ficar dentro a backpack para usa-lo") elseif getPlayerLevel(cid) < 50000 then doPlayerSendTextMessage (cid, 19, "*Voce precisa ser level 50.000+") end return true end Editado Abril 30, 2017 8 anos por poko360 (veja o histórico de edições)
Postado Maio 1, 2017 8 anos local cfgPositions = { From = {x = 3000, y = 3000}, To = {x = 3001, y = 3000} } function onUse(cid, item, frompos, item2, topos) local config = { timeExhausted = 24, -- tempo em horas para poder usar o item novamente. timeForUse = 6, -- tempo em horas que o player poderá entrar na cave. exhausted = 456789, storage = 789456, toKnow = 123456, effect = 27, -- efeito que dará ao usar o item. } local playerPos = getThingPosition(cid) for x = cfgPositions.From.x, cfgPositions.To.x do for y = cfgPositions.From.y, cfgPositions.To.y do if (playerPos.x == x and playerPos.y == y) then doPlayerSendCancel(cid, "You can't use this item in this area.") return true end end end if getPlayerStorageValue(cid, config.exhausted) < os.time() and item.itemid == 4864 and getPlayerLevel(cid) > 50000 then setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time()) setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time()) setPlayerStorageValue (cid, config.toKnow, 1) doRemoveItem(item.uid,1) doSendMagicEffect (getThingPos(cid), config.effect) doPlayerSendTextMessage (cid, 19, "Agora voce tem acesso a PayHunt por 6 horas.") elseif getPlayerStorageValue(cid, config.exhausted) > os.time() then doPlayerSendTextMessage (cid, 19, "*Voce esta exausto, aguarde 24 horas desde a ultima vez que voce usou o item.") elseif item.itemid > 4864 then doPlayerSendTextMessage (cid, 19, "*O item deve ficar dentro a backpack para usa-lo") elseif getPlayerLevel(cid) < 50000 then doPlayerSendTextMessage (cid, 19, "*Voce precisa ser level 50.000+") end return true end https://github.com/Cjaker/ , _ , ( o o ) /'` ' `'\ ESTOU TE OBSERVANDO O_O |'''''''| |\\'''//| """
Postado Maio 1, 2017 8 anos Autor pegou nao =/ tem gente dentro do castelo e eu consegui usar o item ainda
Postado Maio 5, 2017 8 anos Spoiler local config = { timeExhausted = 24, -- tempo em horas para poder usar o item novamente. timeForUse = 6, -- tempo em horas que o player poderá entrar na cave. exhausted = 456789, storage = 789456, toKnow = 123456, effect = 27, -- efeito que dará ao usar o item. forbiddenAreas = { {from = {x = 1000, y = 1000, z = 7}, to = {x = 1500, y = 1500, z = 7}} } } function onUse(cid, item, frompos, item2, topos) for _, areas in pairs(config.forbiddenAreas) do if(isInRange(frompos, areas.from, areas.to)) then doPlayerSendCancel(cid, "You can't use this item in this area.") return false end end if(getPlayerStorageValue(cid, config.exhausted) < os.time() and item.itemid == 4864 and getPlayerLevel(cid) > 50000) then setPlayerStorageValue(cid, config.storage, config.timeForUse * 60 * 60 + os.time()) setPlayerStorageValue(cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time()) setPlayerStorageValue(cid, config.toKnow, 1) doRemoveItem(item.uid,1) doSendMagicEffect(getThingPos(cid), config.effect) doPlayerSendTextMessage(cid, 19, "Agora voce tem acesso a PayHunt por 6 horas.") return true elseif(getPlayerStorageValue(cid, config.exhausted) > os.time()) then doPlayerSendTextMessage(cid, 19, "*Voce esta exausto, aguarde 24 horas desde a ultima vez que voce usou o item.") elseif(item.itemid > 4864) then doPlayerSendTextMessage(cid, 19, "*O item deve ficar dentro a backpack para usa-lo") elseif(getPlayerLevel(cid) < 50000) then doPlayerSendTextMessage(cid, 19, "*Voce precisa ser level 50.000+") end return false end
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.