<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Ayoo Forum - Scripts TFS 1.X]]></title>
		<link>https://forum.ayoocloud.com.br/</link>
		<description><![CDATA[Ayoo Forum - https://forum.ayoocloud.com.br]]></description>
		<pubDate>Thu, 16 Apr 2026 13:28:21 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[[Actions] Item que vende loot]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Item-que-vende-loot</link>
			<pubDate>Sun, 17 Aug 2025 15:16:33 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Item-que-vende-loot</guid>
			<description><![CDATA[Com esse item pode vender loot de onde estiver sem a nescessidade de ir ate um npc.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Resumo do script:</span><br />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Função principal:</span> Permite que o jogador venda determinados itens para ganhar gold.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Itens vendáveis:</span> Definidos na tabela sellableItems com o itemid<br />
 como chave e o preço por unidade como valor. Ex.: [2472] = 150000.<br />
</li>
</ul>
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Processo de venda:</span><br />
<ol type="1" class="mycode_list"><li>O jogador usa um item específico (itemid = 10615) sobre o item que quer vender.<br />
</li>
<li>O script verifica se o item alvo está na lista de vendáveis.<br />
</li>
<li>Remove o item do inventário do jogador.<br />
</li>
<li>Adiciona o gold correspondente ao total (preço × quantidade).<br />
</li>
<li>Envia mensagem informando a venda.<br />
</li>
</ol>
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Itens vendáveis:</span> Adicionar ou remover paresitemid = preço em sellableItems.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Item de uso:</span> Alterar item.itemid ~= 10615 para outro item que servirá como "ferramenta de venda".<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mensagens:</span> Podem ser personalizadas na função sendTextMessage.<br />
</li>
</ul>
<br />
<br />
Para adicionar itens que possa ser vendido nesse codigo, basta adicionar<br />
<span style="font-weight: bold;" class="mycode_b">[id-do-item] = valor-do-item,</span><br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
local sellableItems = {<br />
    [2472] = 150000,<br />
<br />
}<br />
<br />
<br />
local function sellItem(player, item, count)<br />
    local itemId = item:getId()<br />
    local value = sellableItems[itemId]<br />
    if not value then return false end<br />
<br />
    local totalValue = value * count<br />
<br />
    -- Remove o item do inventário<br />
    player:removeItem(itemId, count)<br />
<br />
    -- Adiciona o dinheiro ao jogador<br />
    player:addMoney(totalValue)<br />
<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, string.format("You sold %dx %s for %d gold.",<br />
        count, ItemType(itemId):getName(), totalValue))<br />
<br />
    return true<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    local player = Player(cid)<br />
    if not player then return false end<br />
<br />
    -- Confirma que o item usado é o 5468<br />
    if item.itemid ~= 10615 then<br />
        return false<br />
    end<br />
<br />
    local targetItem = Item(itemEx.uid)<br />
    if not targetItem then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Invalid item.")<br />
        return true<br />
    end<br />
<br />
    local itemId = targetItem:getId()<br />
    if not sellableItems[itemId] then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "This item cannot be sold.")<br />
        return true<br />
    end<br />
<br />
    local count = targetItem:getCount()<br />
    if count &lt; 1 then count = 1 end<br />
<br />
    -- Tenta vender<br />
    if not sellItem(player, targetItem, count) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Failed to sell the item.")<br />
    end<br />
<br />
    return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo.<br />
ChatGPT.]]></description>
			<content:encoded><![CDATA[Com esse item pode vender loot de onde estiver sem a nescessidade de ir ate um npc.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Resumo do script:</span><br />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Função principal:</span> Permite que o jogador venda determinados itens para ganhar gold.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Itens vendáveis:</span> Definidos na tabela sellableItems com o itemid<br />
 como chave e o preço por unidade como valor. Ex.: [2472] = 150000.<br />
</li>
</ul>
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Processo de venda:</span><br />
<ol type="1" class="mycode_list"><li>O jogador usa um item específico (itemid = 10615) sobre o item que quer vender.<br />
</li>
<li>O script verifica se o item alvo está na lista de vendáveis.<br />
</li>
<li>Remove o item do inventário do jogador.<br />
</li>
<li>Adiciona o gold correspondente ao total (preço × quantidade).<br />
</li>
<li>Envia mensagem informando a venda.<br />
</li>
</ol>
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Itens vendáveis:</span> Adicionar ou remover paresitemid = preço em sellableItems.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Item de uso:</span> Alterar item.itemid ~= 10615 para outro item que servirá como "ferramenta de venda".<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mensagens:</span> Podem ser personalizadas na função sendTextMessage.<br />
</li>
</ul>
<br />
<br />
Para adicionar itens que possa ser vendido nesse codigo, basta adicionar<br />
<span style="font-weight: bold;" class="mycode_b">[id-do-item] = valor-do-item,</span><br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
local sellableItems = {<br />
    [2472] = 150000,<br />
<br />
}<br />
<br />
<br />
local function sellItem(player, item, count)<br />
    local itemId = item:getId()<br />
    local value = sellableItems[itemId]<br />
    if not value then return false end<br />
<br />
    local totalValue = value * count<br />
<br />
    -- Remove o item do inventário<br />
    player:removeItem(itemId, count)<br />
<br />
    -- Adiciona o dinheiro ao jogador<br />
    player:addMoney(totalValue)<br />
<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, string.format("You sold %dx %s for %d gold.",<br />
        count, ItemType(itemId):getName(), totalValue))<br />
<br />
    return true<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    local player = Player(cid)<br />
    if not player then return false end<br />
<br />
    -- Confirma que o item usado é o 5468<br />
    if item.itemid ~= 10615 then<br />
        return false<br />
    end<br />
<br />
    local targetItem = Item(itemEx.uid)<br />
    if not targetItem then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Invalid item.")<br />
        return true<br />
    end<br />
<br />
    local itemId = targetItem:getId()<br />
    if not sellableItems[itemId] then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "This item cannot be sold.")<br />
        return true<br />
    end<br />
<br />
    local count = targetItem:getCount()<br />
    if count &lt; 1 then count = 1 end<br />
<br />
    -- Tenta vender<br />
    if not sellItem(player, targetItem, count) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Failed to sell the item.")<br />
    end<br />
<br />
    return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo.<br />
ChatGPT.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] - Script de recuperar Staminia]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Script-de-recuperar-Staminia</link>
			<pubDate>Sun, 17 Aug 2025 15:12:36 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Script-de-recuperar-Staminia</guid>
			<description><![CDATA[Use o item e restaure 100% da sua staminia do jogador.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Resumo do script:</span><br />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Função principal:</span> Recarrega a stamina do jogador ao usar o item.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Stamina cheia:</span> Se o jogador já estiver com a stamina completa (stamina_full), ele recebe mensagem de aviso.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Premium obrigatório:</span> O jogador precisa ter conta premium (getPremiumDays() &gt;= 0).<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Efeito do item:</span> Define a stamina do jogador para o valor máximo (stamina_full) e remove o item usado.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mensagem:</span> Informa que a stamina foi recarregada.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li>stamina_full = 42 * 60 → altera o valor máximo de stamina (42 horas nesse exemplo).<br />
</li>
<li>Mensagens podem ser personalizadas conforme desejado.<br />
</li>
<li>Pode mudar o ITEMID no XML para definir qual item executa o script.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
-- &lt;action itemid="ITEMID" script="other/stamina_refuel.lua"/&gt; <br />
<br />
local stamina_full = 42 * 60 -- config. 42 = horas<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
 <br />
 if player:getStamina() &gt;= stamina_full then<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Sua Staminia já está cheia.")<br />
 elseif player:getPremiumDays() &lt; 0 then<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você deve ter uma conta premium.")<br />
 else<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStamina(stamina_full)<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Sua Staminia foi recarregada.")<br />
 item:remove(1)<br />
 end<br />
 <br />
 return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Estava em um otserv.]]></description>
			<content:encoded><![CDATA[Use o item e restaure 100% da sua staminia do jogador.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Resumo do script:</span><br />
<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Função principal:</span> Recarrega a stamina do jogador ao usar o item.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Stamina cheia:</span> Se o jogador já estiver com a stamina completa (stamina_full), ele recebe mensagem de aviso.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Premium obrigatório:</span> O jogador precisa ter conta premium (getPremiumDays() &gt;= 0).<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Efeito do item:</span> Define a stamina do jogador para o valor máximo (stamina_full) e remove o item usado.<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Mensagem:</span> Informa que a stamina foi recarregada.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li>stamina_full = 42 * 60 → altera o valor máximo de stamina (42 horas nesse exemplo).<br />
</li>
<li>Mensagens podem ser personalizadas conforme desejado.<br />
</li>
<li>Pode mudar o ITEMID no XML para definir qual item executa o script.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
-- &lt;action itemid="ITEMID" script="other/stamina_refuel.lua"/&gt; <br />
<br />
local stamina_full = 42 * 60 -- config. 42 = horas<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
 <br />
 if player:getStamina() &gt;= stamina_full then<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Sua Staminia já está cheia.")<br />
 elseif player:getPremiumDays() &lt; 0 then<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você deve ter uma conta premium.")<br />
 else<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStamina(stamina_full)<br />
 player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Sua Staminia foi recarregada.")<br />
 item:remove(1)<br />
 end<br />
 <br />
 return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Estava em um otserv.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] - Script Premium account 30 dias]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Script-Premium-account-30-dias</link>
			<pubDate>Sun, 17 Aug 2025 15:10:01 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Script-Premium-account-30-dias</guid>
			<description><![CDATA[Um codigo que da premium account otserv.<br />
<br />
<br />
Resumo:<br />
<br />
[*]<span style="font-weight: bold;" class="mycode_b">Função principal:</span> Ao usar o item, adiciona dias de premium para o jogador.<br />
[*]<span style="font-weight: bold;" class="mycode_b">Dias adicionados:</span> 30 (definido na variável daysToAdd).<br />
[*]<span style="font-weight: bold;" class="mycode_b">Efeitos visuais:</span> Mostra efeito mágico azul no player (CONST_ME_MAGIC_BLUE).<br />
[*]<span style="font-weight: bold;" class="mycode_b">Mensagem:</span> Informa ao jogador quantos dias premium ele recebeu.<br />
[*]<span style="font-weight: bold;" class="mycode_b">Consumo do item:</span> Remove o item usado do inventário (doRemoveItem).<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li>Alterar daysToAdd para mudar quantos dias premium o item concede.<br />
</li>
<li>Alterar CONST_ME_MAGIC_BLUE se quiser outro efeito visual.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local function doPlayerAddPremiumDays(cid, days)<br />
    local player = Player(cid)<br />
    if player then<br />
        player:addPremiumDays(days)<br />
    end<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    local daysToAdd = 30  -- Number of premium days to add<br />
    doPlayerAddPremiumDays(cid, daysToAdd)<br />
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce recebeu " .. daysToAdd .. " dias premium em sua conta.")<br />
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)<br />
    doRemoveItem(item.uid, 1)<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Credito:</span><br />
Fiapo.<br />
ChatGPT.]]></description>
			<content:encoded><![CDATA[Um codigo que da premium account otserv.<br />
<br />
<br />
Resumo:<br />
<br />
[*]<span style="font-weight: bold;" class="mycode_b">Função principal:</span> Ao usar o item, adiciona dias de premium para o jogador.<br />
[*]<span style="font-weight: bold;" class="mycode_b">Dias adicionados:</span> 30 (definido na variável daysToAdd).<br />
[*]<span style="font-weight: bold;" class="mycode_b">Efeitos visuais:</span> Mostra efeito mágico azul no player (CONST_ME_MAGIC_BLUE).<br />
[*]<span style="font-weight: bold;" class="mycode_b">Mensagem:</span> Informa ao jogador quantos dias premium ele recebeu.<br />
[*]<span style="font-weight: bold;" class="mycode_b">Consumo do item:</span> Remove o item usado do inventário (doRemoveItem).<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Configuração possível:</span><ul class="mycode_list"><li>Alterar daysToAdd para mudar quantos dias premium o item concede.<br />
</li>
<li>Alterar CONST_ME_MAGIC_BLUE se quiser outro efeito visual.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local function doPlayerAddPremiumDays(cid, days)<br />
    local player = Player(cid)<br />
    if player then<br />
        player:addPremiumDays(days)<br />
    end<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    local daysToAdd = 30  -- Number of premium days to add<br />
    doPlayerAddPremiumDays(cid, daysToAdd)<br />
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce recebeu " .. daysToAdd .. " dias premium em sua conta.")<br />
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)<br />
    doRemoveItem(item.uid, 1)<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Credito:</span><br />
Fiapo.<br />
ChatGPT.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] -Sistema de boss exclusivo em área]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Sistema-de-boss-exclusivo-em-%C3%A1rea</link>
			<pubDate>Sun, 17 Aug 2025 15:06:26 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Sistema-de-boss-exclusivo-em-%C3%A1rea</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b"><span style="font-size: medium;" class="mycode_size">O que o script faz:</span></span><br />
<br />
<ul class="mycode_list"><li>É um <span style="font-weight: bold;" class="mycode_b">sistema de boss room exclusiva</span>.<br />
</li>
<li>O player usa um item/lever e acontece o seguinte:<br />
<ol type="1" class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Verificação de cooldown</span><ul class="mycode_list"><li>Se o boss já foi invocado recentemente (dentro de cooldownSeconds, que está em 15 minutos), o player recebe a mensagem: "Já tem alguém lutando contra o Gonka, espere ele sair."<br />
 <br />
</li>
<li>Se ainda há players dentro da área configurada (areaFrom até areaTo), também bloqueia a entrada.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Teleporte do player</span><ul class="mycode_list"><li>O player é teleportado para a posição teleportToPos.<br />
</li>
<li>Um efeito de teleporte é mostrado.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Invocação do Boss</span><ul class="mycode_list"><li>O boss configurado (bossName = "Boss Apocalypse") nasce na posição monsterSpawnPos.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Cooldown global</span><ul class="mycode_list"><li>O storage global (globalStorage) recebe o tempo atual + 15 minutos, impedindo que outro jogador inicie a luta antes do tempo.<br />
</li>
</ul>
</li>
</ol>
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local teleportToPos = Position(2017, 3262, 5)<br />
local monsterSpawnPos = Position(2017, 3249, 5)<br />
local areaFrom = Position(2009, 3246, 5)<br />
local areaTo = Position(2025, 3262, 5)<br />
local bossName = "Boss Apocalypse"<br />
local globalStorage = 15421<br />
local cooldownSeconds = 15 * 60 -- exemplo: 15 minutos (ajuste se quiser)<br />
<br />
local function getPlayersInArea(fromPos, toPos)<br />
    local players = {}<br />
    for x = fromPos.x, toPos.x do<br />
        for y = fromPos.y, toPos.y do<br />
            local pos = Position(x, y, fromPos.z)<br />
            local tile = Tile(pos)<br />
            if tile then<br />
                local creature = tile:getTopCreature()<br />
                if creature and creature:isPlayer() then<br />
                    table.insert(players, creature)<br />
                end<br />
            end<br />
        end<br />
    end<br />
    return players<br />
end<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    local playersInArea = getPlayersInArea(areaFrom, areaTo)<br />
    if #playersInArea &gt; 0 or (Game.getStorageValue(globalStorage) or 0) &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Já tem alguém lutando contra o Gonka, espere ele sair.")<br />
        return true<br />
    end<br />
<br />
    player:teleportTo(teleportToPos)<br />
    teleportToPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(CONST_ME_TELEPORT)<br />
<br />
    Game.createMonster(bossName, monsterSpawnPos)<br />
<br />
    Game.setStorageValue(globalStorage, os.time() + cooldownSeconds)<br />
<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: large;" class="mycode_size">Como configurar.</span></span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1. Posições</span><br />
Dentro do script, você tem várias Position(...) que definem onde o player vai, onde o boss vai spawnar e qual área vai ser checada. Troque pelos valores do seu mapa:<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local teleportToPos = Position(2017, 3262, 5)      -- onde o player vai ser teleportado<br />
local monsterSpawnPos = Position(2017, 3249, 5)    -- onde o boss vai nascer<br />
local areaFrom = Position(2009, 3246, 5)          -- canto superior/esquerdo da área de checagem<br />
local areaTo = Position(2025, 3262, 5)            -- canto inferior/direito da área de checagem</blockquote>
<br />
[*]<span style="font-weight: bold;" class="mycode_b">teleportToPos</span> → Onde o player é teleportado para lutar contra o boss.<br />
[*]<span style="font-weight: bold;" class="mycode_b">monsterSpawnPos</span> → Posição exata onde o boss vai spawnar.<br />
[*]<span style="font-weight: bold;" class="mycode_b">areaFrom / areaTo</span> → Definem um retângulo de checagem: se houver qualquer player dentro, não deixa iniciar outro boss.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2. Nome do boss</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local bossName = "Boss Apocalypse"</blockquote>
<br />
[*]Troque pelo <span style="font-weight: bold;" class="mycode_b">nome exato do boss</span> que você criou no monster.xml.<br />
[*]Tem que bater com o nome que o servidor reconhece.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3. Cooldown global</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local globalStorage = 15421      -- storage usado para controlar cooldown<br />
local cooldownSeconds = 15 * 60  -- tempo em segundos (ex: 15 minutos)</blockquote>
<br />
[*]<span style="font-weight: bold;" class="mycode_b">globalStorage</span> → qualquer número único, usado para armazenar o tempo do cooldown.<br />
[*]<span style="font-weight: bold;" class="mycode_b">cooldownSeconds</span> → quanto tempo precisa esperar até poder spawnar outro boss.<ul class="mycode_list"><li>Exemplo: 30 * 60para 30 minutos.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Achado em um OTSERV.]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b"><span style="font-size: medium;" class="mycode_size">O que o script faz:</span></span><br />
<br />
<ul class="mycode_list"><li>É um <span style="font-weight: bold;" class="mycode_b">sistema de boss room exclusiva</span>.<br />
</li>
<li>O player usa um item/lever e acontece o seguinte:<br />
<ol type="1" class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Verificação de cooldown</span><ul class="mycode_list"><li>Se o boss já foi invocado recentemente (dentro de cooldownSeconds, que está em 15 minutos), o player recebe a mensagem: "Já tem alguém lutando contra o Gonka, espere ele sair."<br />
 <br />
</li>
<li>Se ainda há players dentro da área configurada (areaFrom até areaTo), também bloqueia a entrada.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Teleporte do player</span><ul class="mycode_list"><li>O player é teleportado para a posição teleportToPos.<br />
</li>
<li>Um efeito de teleporte é mostrado.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Invocação do Boss</span><ul class="mycode_list"><li>O boss configurado (bossName = "Boss Apocalypse") nasce na posição monsterSpawnPos.<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Cooldown global</span><ul class="mycode_list"><li>O storage global (globalStorage) recebe o tempo atual + 15 minutos, impedindo que outro jogador inicie a luta antes do tempo.<br />
</li>
</ul>
</li>
</ol>
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local teleportToPos = Position(2017, 3262, 5)<br />
local monsterSpawnPos = Position(2017, 3249, 5)<br />
local areaFrom = Position(2009, 3246, 5)<br />
local areaTo = Position(2025, 3262, 5)<br />
local bossName = "Boss Apocalypse"<br />
local globalStorage = 15421<br />
local cooldownSeconds = 15 * 60 -- exemplo: 15 minutos (ajuste se quiser)<br />
<br />
local function getPlayersInArea(fromPos, toPos)<br />
    local players = {}<br />
    for x = fromPos.x, toPos.x do<br />
        for y = fromPos.y, toPos.y do<br />
            local pos = Position(x, y, fromPos.z)<br />
            local tile = Tile(pos)<br />
            if tile then<br />
                local creature = tile:getTopCreature()<br />
                if creature and creature:isPlayer() then<br />
                    table.insert(players, creature)<br />
                end<br />
            end<br />
        end<br />
    end<br />
    return players<br />
end<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    local playersInArea = getPlayersInArea(areaFrom, areaTo)<br />
    if #playersInArea &gt; 0 or (Game.getStorageValue(globalStorage) or 0) &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Já tem alguém lutando contra o Gonka, espere ele sair.")<br />
        return true<br />
    end<br />
<br />
    player:teleportTo(teleportToPos)<br />
    teleportToPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(CONST_ME_TELEPORT)<br />
<br />
    Game.createMonster(bossName, monsterSpawnPos)<br />
<br />
    Game.setStorageValue(globalStorage, os.time() + cooldownSeconds)<br />
<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: large;" class="mycode_size">Como configurar.</span></span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1. Posições</span><br />
Dentro do script, você tem várias Position(...) que definem onde o player vai, onde o boss vai spawnar e qual área vai ser checada. Troque pelos valores do seu mapa:<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local teleportToPos = Position(2017, 3262, 5)      -- onde o player vai ser teleportado<br />
local monsterSpawnPos = Position(2017, 3249, 5)    -- onde o boss vai nascer<br />
local areaFrom = Position(2009, 3246, 5)          -- canto superior/esquerdo da área de checagem<br />
local areaTo = Position(2025, 3262, 5)            -- canto inferior/direito da área de checagem</blockquote>
<br />
[*]<span style="font-weight: bold;" class="mycode_b">teleportToPos</span> → Onde o player é teleportado para lutar contra o boss.<br />
[*]<span style="font-weight: bold;" class="mycode_b">monsterSpawnPos</span> → Posição exata onde o boss vai spawnar.<br />
[*]<span style="font-weight: bold;" class="mycode_b">areaFrom / areaTo</span> → Definem um retângulo de checagem: se houver qualquer player dentro, não deixa iniciar outro boss.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2. Nome do boss</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local bossName = "Boss Apocalypse"</blockquote>
<br />
[*]Troque pelo <span style="font-weight: bold;" class="mycode_b">nome exato do boss</span> que você criou no monster.xml.<br />
[*]Tem que bater com o nome que o servidor reconhece.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3. Cooldown global</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local globalStorage = 15421      -- storage usado para controlar cooldown<br />
local cooldownSeconds = 15 * 60  -- tempo em segundos (ex: 15 minutos)</blockquote>
<br />
[*]<span style="font-weight: bold;" class="mycode_b">globalStorage</span> → qualquer número único, usado para armazenar o tempo do cooldown.<br />
[*]<span style="font-weight: bold;" class="mycode_b">cooldownSeconds</span> → quanto tempo precisa esperar até poder spawnar outro boss.<ul class="mycode_list"><li>Exemplo: 30 * 60para 30 minutos.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Achado em um OTSERV.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] - Sistema de forja (forging system)]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Sistema-de-forja-forging-system</link>
			<pubDate>Sun, 17 Aug 2025 14:56:47 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Sistema-de-forja-forging-system</guid>
			<description><![CDATA[Esse script é um <span style="font-weight: bold;" class="mycode_b">sistema de forja (forging system)</span>, ele altera alguns itens do mapa enquanto a forja esta rodando.<br />
<br />
Resumo:<ul class="mycode_list"><li>O jogador usa uma<span style="font-weight: bold;" class="mycode_b"> </span>alavanca ou outro item com actionid =<span style="font-weight: bold;" class="mycode_b"> 7787 </span>para iniciar a forja.<br />
</li>
<li>Requisitos para ativar:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">250 Crystal Coins (ID 2159)</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">1 Item especial (ID 9019)</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">5kk de gold</span><br />
</li>
</ul>
</li>
<li>Se cumprir os requisitos, os itens são removidos do jogador e o processo começa:<ul class="mycode_list"><li>Os <span style="font-weight: bold;" class="mycode_b">itens do mapa (originalItems)</span> são substituídos por suas versões forjadas (<span style="font-weight: bold;" class="mycode_b">forgedItems</span>) por <span style="font-weight: bold;" class="mycode_b">3 minutos</span>.<br />
</li>
<li>A cada 10s, é enviado um <span style="font-weight: bold;" class="mycode_b">broadcast</span> avisando que a forja está em andamento.<br />
</li>
<li>Após os 3 minutos, os itens voltam ao estado original.<br />
</li>
<li>Dois itens específicos do mapa (<span style="font-weight: bold;" class="mycode_b">toRemoveInPhase2</span>) somem por <span style="font-weight: bold;" class="mycode_b">30 segundos</span> simulando o processo.<br />
</li>
<li>Uma <span style="font-weight: bold;" class="mycode_b">nova forja visual</span> aparece no mapa (<span style="font-weight: bold;" class="mycode_b">forgeVisual</span>) e o jogador recebe a recompensa (<span style="font-weight: bold;" class="mycode_b">rewardItem</span>, Vampire Token, ID 9955) no chão em <br />
 rewardDropPos.<br />
</li>
<li>Passados 30 segundos, a forja desaparece e os itens da fase 2 são recriados.<br />
</li>
</ul>
</li>
<li>O sistema tem <span style="font-weight: bold;" class="mycode_b">cooldown global</span> para evitar que outro jogador ative a forja enquanto já está em andamento.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
local actionId = 7787<br />
local requiredItems = {<br />
    {id = 2159, count = 250},<br />
    {id = 9019, count = 1}<br />
}<br />
local requiredMoney = 5000000<br />
local rewardItem = 9955<br />
local rewardCount = 1<br />
<br />
local globalStorageForge = 90000<br />
local forgeDuration = 3 * 60 * 1000<br />
local forgeCooldown = 20 * 1000<br />
<br />
local originalItems = {<br />
    {id = 8642, pos = Position(1669, 1992, 7)},<br />
    {id = 8654, pos = Position(1670, 1992, 7)},<br />
    {id = 8661, pos = Position(1671, 1992, 7)},<br />
    {id = 8658, pos = Position(1672, 1992, 7)},<br />
    {id = 8660, pos = Position(1672, 1993, 7)},<br />
    {id = 8657, pos = Position(1671, 1993, 7)},<br />
    {id = 8659, pos = Position(1671, 1994, 7)},<br />
    {id = 8658, pos = Position(1672, 1994, 7)},<br />
    {id = 8646, pos = Position(1672, 1995, 7)},<br />
    {id = 8647, pos = Position(1672, 1996, 7)}<br />
}<br />
<br />
local forgedItems = {<br />
    {id = 8641, pos = Position(1669, 1992, 7)},<br />
 {id = 8673, pos = Position(1670, 1992, 7)},<br />
    {id = 8650, pos = Position(1670, 1992, 7)},<br />
    {id = 8667, pos = Position(1671, 1992, 7)},<br />
    {id = 8664, pos = Position(1672, 1992, 7)},<br />
    {id = 8666, pos = Position(1672, 1993, 7)},<br />
    {id = 8663, pos = Position(1671, 1993, 7)},<br />
    {id = 8665, pos = Position(1671, 1994, 7)},<br />
    {id = 8664, pos = Position(1672, 1994, 7)},<br />
    {id = 8645, pos = Position(1672, 1995, 7)},<br />
    {id = 8643, pos = Position(1672, 1996, 7)}<br />
}<br />
<br />
local toRemoveInPhase2 = {<br />
    {id = 1526, pos = Position(1670, 1997, 7)}, -- Coloque o ID real<br />
    {id = 1526, pos = Position(1670, 1998, 7)}  -- Coloque o ID real<br />
}<br />
<br />
local forgeVisual = {<br />
    id = 8670,<br />
    pos = Position(1670, 1993, 7)<br />
}<br />
<br />
local rewardDropPos = Position(1672, 1998, 7)<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    if item.actionid ~= actionId then<br />
        return true<br />
    end<br />
<br />
    local currentStorage = Game.getStorageValue(globalStorageForge) or 0<br />
    if currentStorage &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("A forja já está em andamento.")<br />
        return true<br />
    end<br />
<br />
    for _, entry in pairs(requiredItems) do<br />
        if player:getItemCount(entry.id) &lt; entry.count then<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você não possui todos os itens necessários.")<br />
            return true<br />
        end<br />
    end<br />
<br />
    if not player:removeMoney(requiredMoney) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você precisa de 1kk de gold.")<br />
        return true<br />
    end<br />
<br />
    for _, entry in pairs(requiredItems) do<br />
        player:removeItem(entry.id, entry.count)<br />
    end<br />
<br />
    for i, v in ipairs(originalItems) do<br />
        local tile = Tile(v.pos)<br />
        if tile then<br />
            local oldItem = tile:getItemById(v.id)<br />
            if oldItem then oldItem:remove() end<br />
        end<br />
    end<br />
<br />
    for _, v in ipairs(forgedItems) do<br />
        Game.createItem(v.id, 1, v.pos)<br />
    end<br />
<br />
    Game.setStorageValue(globalStorageForge, os.time() + ((forgeDuration + forgeCooldown) / 1000))<br />
<br />
    -- Broadcast a cada 10s<br />
    for i = 0, (forgeDuration - 1), 10000 do<br />
        addEvent(function()<br />
            broadcastMessage(player:getName() .. " está forjando um Vampire Token!", MESSAGE_EVENT_ADVANCE)<br />
        end, i)<br />
    end<br />
<br />
    addEvent(function()<br />
        for _, v in ipairs(forgedItems) do<br />
            local tile = Tile(v.pos)<br />
            if tile then<br />
                local tempItem = tile:getItemById(v.id)<br />
                if tempItem then tempItem:remove() end<br />
            end<br />
        end<br />
<br />
        for _, v in ipairs(originalItems) do<br />
            Game.createItem(v.id, 1, v.pos)<br />
        end<br />
<br />
        -- Remover os 2 itens da fase 2<br />
        for _, data in ipairs(toRemoveInPhase2) do<br />
            local tile = Tile(data.pos)<br />
            if tile then<br />
                local item = tile:getItemById(data.id)<br />
                if item then item:remove() end<br />
            end<br />
        end<br />
<br />
        -- Remover o item 1945 existente (visualmente) se necessário<br />
        local forgeTile = Tile(forgeVisual.pos)<br />
        local forgeItem = forgeTile and forgeTile:getItemById(forgeVisual.id)<br />
        if forgeItem then forgeItem:remove() end<br />
<br />
        -- Recriar forja<br />
        local createdForge = Game.createItem(forgeVisual.id, 1, forgeVisual.pos)<br />
<br />
        -- Entrega recompensa no chão<br />
        Game.createItem(rewardItem, rewardCount, rewardDropPos)<br />
<br />
        -- Após 30s, remove a forja e restaura os dois itens<br />
        addEvent(function()<br />
            local tile = Tile(forgeVisual.pos)<br />
            if tile then<br />
                local existing = tile:getItemById(forgeVisual.id)<br />
                if existing then existing:remove() end<br />
            end<br />
<br />
            -- Recria os 2 itens da fase 2<br />
            for _, data in ipairs(toRemoveInPhase2) do<br />
                Game.createItem(data.id, 1, data.pos)<br />
            end<br />
<br />
        end, forgeCooldown)<br />
<br />
    end, forgeDuration)<br />
<br />
    return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<br />
<img src="https://i.ibb.co/rJ0nzSd/Captura-de-tela-2025-08-17-144627.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-144627.png]" class="mycode_img" /><br />
<br />
<img src="https://i.ibb.co/BK6cxMPC/Captura-de-tela-2025-08-17-145323.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-145323.png]" class="mycode_img" /><br />
<br />
<img src="https://i.ibb.co/xq9wgb9y/Captura-de-tela-2025-08-17-145637.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-145637.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: large;" class="mycode_size">Como configurar.</span></span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1- Item de ativação</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local actionId = 7787</blockquote>
Aqui eu utilizo uma alavanca esse 7787 vai na alavanca.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2- Requisitos do jogador</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local requiredItems = {<br />
    {id = 2159, count = 250}, -- Crystal Coins<br />
    {id = 9019, count = 1}    -- Item especial<br />
}<br />
local requiredMoney = 5000000 -- Gold necessário</blockquote>
Define os <span style="font-weight: bold;" class="mycode_b">itens e dinheiro</span> que o jogador precisa para forjar.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3- Recompensa</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local rewardItem = 9955<br />
local rewardCount = 1<br />
local rewardDropPos = Position(1672, 1998, 7)</blockquote>
Item e quantidade da recompensa, e onde será criada a recompensa qual posição.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">4- Tempos de forja</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local forgeDuration = 3 * 60 * 1000 -- 3 minutos<br />
local forgeCooldown = 20 * 1000    -- 20 segundos após o fim</blockquote>
Controla quanto tempo dura a forja e quanto tempo demora para resetar totalmente.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">5- Itens do mapa alterados</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local originalItems = { ... } -- Itens normais<br />
local forgedItems  = { ... } -- Versões forjadas<br />
local toRemoveInPhase2 = { ... } -- Itens removidos temporariamente<br />
local forgeVisual = { id = 8670, pos = Position(1670, 1993, 7) } -- Aparência da forja</blockquote>
Permite trocar os itens que vão se transformar no mapa, os que somem na segunda fase e o item visual da forja.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></description>
			<content:encoded><![CDATA[Esse script é um <span style="font-weight: bold;" class="mycode_b">sistema de forja (forging system)</span>, ele altera alguns itens do mapa enquanto a forja esta rodando.<br />
<br />
Resumo:<ul class="mycode_list"><li>O jogador usa uma<span style="font-weight: bold;" class="mycode_b"> </span>alavanca ou outro item com actionid =<span style="font-weight: bold;" class="mycode_b"> 7787 </span>para iniciar a forja.<br />
</li>
<li>Requisitos para ativar:<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">250 Crystal Coins (ID 2159)</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">1 Item especial (ID 9019)</span><br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">5kk de gold</span><br />
</li>
</ul>
</li>
<li>Se cumprir os requisitos, os itens são removidos do jogador e o processo começa:<ul class="mycode_list"><li>Os <span style="font-weight: bold;" class="mycode_b">itens do mapa (originalItems)</span> são substituídos por suas versões forjadas (<span style="font-weight: bold;" class="mycode_b">forgedItems</span>) por <span style="font-weight: bold;" class="mycode_b">3 minutos</span>.<br />
</li>
<li>A cada 10s, é enviado um <span style="font-weight: bold;" class="mycode_b">broadcast</span> avisando que a forja está em andamento.<br />
</li>
<li>Após os 3 minutos, os itens voltam ao estado original.<br />
</li>
<li>Dois itens específicos do mapa (<span style="font-weight: bold;" class="mycode_b">toRemoveInPhase2</span>) somem por <span style="font-weight: bold;" class="mycode_b">30 segundos</span> simulando o processo.<br />
</li>
<li>Uma <span style="font-weight: bold;" class="mycode_b">nova forja visual</span> aparece no mapa (<span style="font-weight: bold;" class="mycode_b">forgeVisual</span>) e o jogador recebe a recompensa (<span style="font-weight: bold;" class="mycode_b">rewardItem</span>, Vampire Token, ID 9955) no chão em <br />
 rewardDropPos.<br />
</li>
<li>Passados 30 segundos, a forja desaparece e os itens da fase 2 são recriados.<br />
</li>
</ul>
</li>
<li>O sistema tem <span style="font-weight: bold;" class="mycode_b">cooldown global</span> para evitar que outro jogador ative a forja enquanto já está em andamento.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
<br />
local actionId = 7787<br />
local requiredItems = {<br />
    {id = 2159, count = 250},<br />
    {id = 9019, count = 1}<br />
}<br />
local requiredMoney = 5000000<br />
local rewardItem = 9955<br />
local rewardCount = 1<br />
<br />
local globalStorageForge = 90000<br />
local forgeDuration = 3 * 60 * 1000<br />
local forgeCooldown = 20 * 1000<br />
<br />
local originalItems = {<br />
    {id = 8642, pos = Position(1669, 1992, 7)},<br />
    {id = 8654, pos = Position(1670, 1992, 7)},<br />
    {id = 8661, pos = Position(1671, 1992, 7)},<br />
    {id = 8658, pos = Position(1672, 1992, 7)},<br />
    {id = 8660, pos = Position(1672, 1993, 7)},<br />
    {id = 8657, pos = Position(1671, 1993, 7)},<br />
    {id = 8659, pos = Position(1671, 1994, 7)},<br />
    {id = 8658, pos = Position(1672, 1994, 7)},<br />
    {id = 8646, pos = Position(1672, 1995, 7)},<br />
    {id = 8647, pos = Position(1672, 1996, 7)}<br />
}<br />
<br />
local forgedItems = {<br />
    {id = 8641, pos = Position(1669, 1992, 7)},<br />
 {id = 8673, pos = Position(1670, 1992, 7)},<br />
    {id = 8650, pos = Position(1670, 1992, 7)},<br />
    {id = 8667, pos = Position(1671, 1992, 7)},<br />
    {id = 8664, pos = Position(1672, 1992, 7)},<br />
    {id = 8666, pos = Position(1672, 1993, 7)},<br />
    {id = 8663, pos = Position(1671, 1993, 7)},<br />
    {id = 8665, pos = Position(1671, 1994, 7)},<br />
    {id = 8664, pos = Position(1672, 1994, 7)},<br />
    {id = 8645, pos = Position(1672, 1995, 7)},<br />
    {id = 8643, pos = Position(1672, 1996, 7)}<br />
}<br />
<br />
local toRemoveInPhase2 = {<br />
    {id = 1526, pos = Position(1670, 1997, 7)}, -- Coloque o ID real<br />
    {id = 1526, pos = Position(1670, 1998, 7)}  -- Coloque o ID real<br />
}<br />
<br />
local forgeVisual = {<br />
    id = 8670,<br />
    pos = Position(1670, 1993, 7)<br />
}<br />
<br />
local rewardDropPos = Position(1672, 1998, 7)<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    if item.actionid ~= actionId then<br />
        return true<br />
    end<br />
<br />
    local currentStorage = Game.getStorageValue(globalStorageForge) or 0<br />
    if currentStorage &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("A forja já está em andamento.")<br />
        return true<br />
    end<br />
<br />
    for _, entry in pairs(requiredItems) do<br />
        if player:getItemCount(entry.id) &lt; entry.count then<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você não possui todos os itens necessários.")<br />
            return true<br />
        end<br />
    end<br />
<br />
    if not player:removeMoney(requiredMoney) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você precisa de 1kk de gold.")<br />
        return true<br />
    end<br />
<br />
    for _, entry in pairs(requiredItems) do<br />
        player:removeItem(entry.id, entry.count)<br />
    end<br />
<br />
    for i, v in ipairs(originalItems) do<br />
        local tile = Tile(v.pos)<br />
        if tile then<br />
            local oldItem = tile:getItemById(v.id)<br />
            if oldItem then oldItem:remove() end<br />
        end<br />
    end<br />
<br />
    for _, v in ipairs(forgedItems) do<br />
        Game.createItem(v.id, 1, v.pos)<br />
    end<br />
<br />
    Game.setStorageValue(globalStorageForge, os.time() + ((forgeDuration + forgeCooldown) / 1000))<br />
<br />
    -- Broadcast a cada 10s<br />
    for i = 0, (forgeDuration - 1), 10000 do<br />
        addEvent(function()<br />
            broadcastMessage(player:getName() .. " está forjando um Vampire Token!", MESSAGE_EVENT_ADVANCE)<br />
        end, i)<br />
    end<br />
<br />
    addEvent(function()<br />
        for _, v in ipairs(forgedItems) do<br />
            local tile = Tile(v.pos)<br />
            if tile then<br />
                local tempItem = tile:getItemById(v.id)<br />
                if tempItem then tempItem:remove() end<br />
            end<br />
        end<br />
<br />
        for _, v in ipairs(originalItems) do<br />
            Game.createItem(v.id, 1, v.pos)<br />
        end<br />
<br />
        -- Remover os 2 itens da fase 2<br />
        for _, data in ipairs(toRemoveInPhase2) do<br />
            local tile = Tile(data.pos)<br />
            if tile then<br />
                local item = tile:getItemById(data.id)<br />
                if item then item:remove() end<br />
            end<br />
        end<br />
<br />
        -- Remover o item 1945 existente (visualmente) se necessário<br />
        local forgeTile = Tile(forgeVisual.pos)<br />
        local forgeItem = forgeTile and forgeTile:getItemById(forgeVisual.id)<br />
        if forgeItem then forgeItem:remove() end<br />
<br />
        -- Recriar forja<br />
        local createdForge = Game.createItem(forgeVisual.id, 1, forgeVisual.pos)<br />
<br />
        -- Entrega recompensa no chão<br />
        Game.createItem(rewardItem, rewardCount, rewardDropPos)<br />
<br />
        -- Após 30s, remove a forja e restaura os dois itens<br />
        addEvent(function()<br />
            local tile = Tile(forgeVisual.pos)<br />
            if tile then<br />
                local existing = tile:getItemById(forgeVisual.id)<br />
                if existing then existing:remove() end<br />
            end<br />
<br />
            -- Recria os 2 itens da fase 2<br />
            for _, data in ipairs(toRemoveInPhase2) do<br />
                Game.createItem(data.id, 1, data.pos)<br />
            end<br />
<br />
        end, forgeCooldown)<br />
<br />
    end, forgeDuration)<br />
<br />
    return true<br />
end<br />
<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<br />
<img src="https://i.ibb.co/rJ0nzSd/Captura-de-tela-2025-08-17-144627.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-144627.png]" class="mycode_img" /><br />
<br />
<img src="https://i.ibb.co/BK6cxMPC/Captura-de-tela-2025-08-17-145323.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-145323.png]" class="mycode_img" /><br />
<br />
<img src="https://i.ibb.co/xq9wgb9y/Captura-de-tela-2025-08-17-145637.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-145637.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: large;" class="mycode_size">Como configurar.</span></span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1- Item de ativação</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local actionId = 7787</blockquote>
Aqui eu utilizo uma alavanca esse 7787 vai na alavanca.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2- Requisitos do jogador</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local requiredItems = {<br />
    {id = 2159, count = 250}, -- Crystal Coins<br />
    {id = 9019, count = 1}    -- Item especial<br />
}<br />
local requiredMoney = 5000000 -- Gold necessário</blockquote>
Define os <span style="font-weight: bold;" class="mycode_b">itens e dinheiro</span> que o jogador precisa para forjar.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3- Recompensa</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local rewardItem = 9955<br />
local rewardCount = 1<br />
local rewardDropPos = Position(1672, 1998, 7)</blockquote>
Item e quantidade da recompensa, e onde será criada a recompensa qual posição.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">4- Tempos de forja</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local forgeDuration = 3 * 60 * 1000 -- 3 minutos<br />
local forgeCooldown = 20 * 1000    -- 20 segundos após o fim</blockquote>
Controla quanto tempo dura a forja e quanto tempo demora para resetar totalmente.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">5- Itens do mapa alterados</span><br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local originalItems = { ... } -- Itens normais<br />
local forgedItems  = { ... } -- Versões forjadas<br />
local toRemoveInPhase2 = { ... } -- Itens removidos temporariamente<br />
local forgeVisual = { id = 8670, pos = Position(1670, 1993, 7) } -- Aparência da forja</blockquote>
Permite trocar os itens que vão se transformar no mapa, os que somem na segunda fase e o item visual da forja.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] Cassino/slot machine]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Cassino-slot-machine</link>
			<pubDate>Sun, 17 Aug 2025 14:43:18 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Cassino-slot-machine</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">Resumo:</span><br />
<ul class="mycode_list"><li>O jogador paga <span style="font-weight: bold;" class="mycode_b">250 Event Coins</span> para jogar.<br />
</li>
<li>São sorteados <span style="font-weight: bold;" class="mycode_b">3 itens</span> com base em <span style="font-weight: bold;" class="mycode_b">probabilidades diferentes (peso)</span>.<br />
</li>
<li>Se os 3 itens saírem iguais → o jogador <span style="font-weight: bold;" class="mycode_b">ganha</span> aquele item e o servidor anuncia o prêmio em broadcast.<br />
</li>
<li>Caso contrário → o jogador <span style="font-weight: bold;" class="mycode_b">perde a aposta</span>.<br />
</li>
<li>Inclui <span style="font-weight: bold;" class="mycode_b">efeitos visuais</span> no chão, animações e cooldown (para evitar spam).<br />
</li>
<li>O sistema remove as moedas automaticamente e mostra os itens sorteados em tiles definidos no mapa.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local positions = {<br />
    {x = 1529, y = 1883, z = 9},<br />
    {x = 1531, y = 1883, z = 9},<br />
    {x = 1533, y = 1883, z = 9}<br />
}<br />
<br />
local price = 250 -- Preço em Event Coins para jogar<br />
local eventcoins = 2160 -- ID do Event Coin<br />
<br />
-- Itens com pesos diferentes (probabilidades personalizadas)<br />
local weightedItems = {<br />
    {id = 2006,  weight = 80, name = "Vial"},    -- 50% de chance (comum)<br />
    {id = 1987,  weight = 70, name = "Bag"}, -- 20% de chance (pouco raro)<br />
    {id = 2036,  weight = 52, name = "Watch"},      -- 15% de chance (raro)<br />
    {id = 1974,  weight = 45, name = "Book"},      -- 10% de chance (muito raro)<br />
    {id = 2145,  weight = 40,  name = "Small Diamound"},  -- 5% de chance (ultra raro)<br />
 {id = 12638,  weight = 30,  name = "dragonfruit"},<br />
 {id = 2157,  weight = 20,  name = "Gold Nugget"},<br />
 {id = 12640,  weight = 5,  name = "Penaut"}<br />
}<br />
<br />
-- Função para sortear um item baseado no peso<br />
local function getRandomWeightedItem()<br />
    local totalWeight = 0<br />
    for _, item in ipairs(weightedItems) do<br />
        totalWeight = totalWeight + item.weight<br />
    end<br />
    <br />
    local randomValue = math.random(1, totalWeight)<br />
    local currentWeight = 0<br />
    <br />
    for _, item in ipairs(weightedItems) do<br />
        currentWeight = currentWeight + item.weight<br />
        if randomValue &lt;= currentWeight then<br />
            return item.id, item.name<br />
        end<br />
    end<br />
    return weightedItems[1].id, weightedItems[1].name -- Fallback (nunca deve acontecer)<br />
end<br />
<br />
local function cleanTile(pos)<br />
    local tile = Tile(pos)<br />
    if not tile then return end<br />
<br />
    for _, item in ipairs(tile:getItems() or {}) do<br />
        -- Garante que não remova criaturas ou outros objetos inválidos<br />
        if item and item:isItem() then<br />
            item:remove()<br />
        end<br />
    end<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    -- Verifica se o jogador pode apostar<br />
    if getGlobalStorageValue(722404) &gt; os.time() then<br />
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")<br />
        return true<br />
    end<br />
    <br />
    -- Verifica se tem Event Coins suficientes<br />
    if getPlayerItemCount(cid, eventcoins) &lt; price then<br />
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " Event Coins para jogar.")<br />
        return true<br />
    end<br />
<br />
    -- Cooldown individual do jogador<br />
    if getPlayerStorageValue(cid, 722406) &gt; os.time() then<br />
        doPlayerSendCancel(cid, "Aguarde um pouco para jogar novamente.")<br />
        return true<br />
    end<br />
    doPlayerSetStorageValue(cid, 722406, os.time() + 6)<br />
    <br />
    -- Cooldown global (evita spam)<br />
    setGlobalStorageValue(722404, os.time() + 6)<br />
    <br />
    -- Efeitos visuais antes do sorteio<br />
    for i = 1, #positions do<br />
        doSendMagicEffect(positions[i], 22)<br />
    end<br />
    <br />
    -- Remove as Event Coins<br />
    doPlayerRemoveItem(cid, eventcoins, price)<br />
    doTransformItem(item.uid, item.itemid == 9825 and 9826 or 9825)<br />
    <br />
    -- Sorteia os 3 itens (com probabilidades diferentes)<br />
    local first, firstName = getRandomWeightedItem()<br />
    local second, secondName = getRandomWeightedItem()<br />
    local third, thirdName = getRandomWeightedItem()<br />
    <br />
    local tab = {}<br />
    <br />
    -- Cria e mostra os itens sorteados<br />
    doCreateItem(first, 1, positions[1])<br />
    doSendMagicEffect(positions[1], 26)<br />
    addEvent(doSendMagicEffect, 100, positions[1], 31)<br />
    table.insert(tab, first)<br />
    <br />
    addEvent(function()<br />
        doCreateItem(second, 1, positions[2])<br />
        doSendMagicEffect(positions[2], 26)<br />
        addEvent(doSendMagicEffect, 100, positions[2], 31)<br />
        table.insert(tab, second)<br />
    end, 1700)<br />
    <br />
    addEvent(function()<br />
        doCreateItem(third, 1, positions[3])<br />
        doSendMagicEffect(positions[3], 26)<br />
        addEvent(doSendMagicEffect, 100, positions[3], 31)<br />
        table.insert(tab, third)<br />
    end, 2000)<br />
    <br />
    -- Verifica se ganhou (3 itens iguais)<br />
    addEvent(function()<br />
        -- Limpa os itens do chão<br />
cleanTile(positions[1])<br />
cleanTile(positions[2])<br />
cleanTile(positions[3])<br />
        doSendMagicEffect(positions[1], 54)<br />
        doSendMagicEffect(positions[2], 54)<br />
        doSendMagicEffect(positions[3], 54)<br />
        <br />
        if tab[1] == tab[2] and tab[1] == tab[3] then<br />
            -- Ganhou! Recebe o item.<br />
            doPlayerAddItem(cid, tab[1], 1)<br />
            doPlayerSendTextMessage(cid, 27, "Você ganhou um(a) " .. firstName .. "! Parabéns!")<br />
            doBroadcastMessage("O jogador " .. getCreatureName(cid) .. " ganhou um(a) " .. firstName .. " no cassino!", MESSAGE_EVENT_ADVANCE)<br />
            <br />
            -- Efeitos de vitória<br />
            doSendAnimatedText(getThingPos(cid), "GANHOU!", 215)<br />
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE)<br />
            doSendMagicEffect(positions[1], CONST_ME_FIREWORK_YELLOW)<br />
            doSendMagicEffect(positions[2], CONST_ME_FIREWORK_RED)<br />
            doSendMagicEffect(positions[3], CONST_ME_FIREWORK_GREEN)<br />
        else<br />
            -- Perdeu<br />
            doSendAnimatedText(getThingPos(cid), "PERDEU!", TEXTCOLOR_RED)<br />
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)<br />
        end<br />
    end, 4200)<br />
    <br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<br />
<img src="https://i.ibb.co/bj3PHyJg/Captura-de-tela-2025-08-17-144206.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-144206.png]" class="mycode_img" /><br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Como Configurar.</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">1-</span> Posições dos itens exibidos.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local positions = {<br />
    {x = 1529, y = 1883, z = 9},<br />
    {x = 1531, y = 1883, z = 9},<br />
    {x = 1533, y = 1883, z = 9}<br />
}</blockquote>
Onde os 3 itens do sorteio vão aparecer no chão.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2-</span> Preço para jogar e moeda usada.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local price = 250 -- Preço em Event Coins<br />
local eventcoins = 2160 -- ID do item usado como moeda</blockquote>
Você define <span style="font-weight: bold;" class="mycode_b">quanto custa jogar</span> e <span style="font-weight: bold;" class="mycode_b">qual item será usado como moeda</span> (pode trocar por gold, tokens, etc).<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3- </span>Itens e probabilidades (peso).<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local weightedItems = {<br />
    {id = 2006, weight = 80, name = "Vial"},    <br />
    {id = 1987, weight = 70, name = "Bag"}, <br />
    {id = 2036, weight = 52, name = "Watch"},    <br />
    {id = 1974, weight = 45, name = "Book"},      <br />
    {id = 2145, weight = 40, name = "Small Diamond"},<br />
    {id = 12638, weight = 30, name = "Dragonfruit"},<br />
    {id = 2157, weight = 20, name = "Gold Nugget"},<br />
    {id = 12640, weight = 5,  name = "Peanut"}<br />
}</blockquote>
Cada item tem um <span style="font-weight: bold;" class="mycode_b">peso (probabilidade)</span>.<ul class="mycode_list"><li>Quanto <span style="font-weight: bold;" class="mycode_b">maior o weight</span>, mais fácil de sair.<br />
</li>
<li>Quanto <span style="font-weight: bold;" class="mycode_b">menor</span>, mais raro.<br />
</li>
</ul>
<br />
Exemplo: <span style="font-weight: bold;" class="mycode_b">weight = 80</span> é bem comum, <span style="font-weight: bold;" class="mycode_b">weight = 5</span> é super raro.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">4-</span> Cooldowns.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>-- Global cooldown (todos os players): 6 segundos<br />
setGlobalStorageValue(722404, os.time() + 6)<br />
<br />
-- Cooldown individual (por player): 6 segundos<br />
doPlayerSetStorageValue(cid, 722406, os.time() + 6)</blockquote>
Tempo mínimo entre apostas para evitar flood.<br />
<br />
Em resumo: você consegue configurar <span style="font-weight: bold;" class="mycode_b">onde aparece</span>, <span style="font-weight: bold;" class="mycode_b">quanto custa</span>, <span style="font-weight: bold;" class="mycode_b">qual moeda usar</span>, <span style="font-weight: bold;" class="mycode_b">quais itens podem sair</span> e suas <span style="font-weight: bold;" class="mycode_b">chances de sorteio</span>.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">Resumo:</span><br />
<ul class="mycode_list"><li>O jogador paga <span style="font-weight: bold;" class="mycode_b">250 Event Coins</span> para jogar.<br />
</li>
<li>São sorteados <span style="font-weight: bold;" class="mycode_b">3 itens</span> com base em <span style="font-weight: bold;" class="mycode_b">probabilidades diferentes (peso)</span>.<br />
</li>
<li>Se os 3 itens saírem iguais → o jogador <span style="font-weight: bold;" class="mycode_b">ganha</span> aquele item e o servidor anuncia o prêmio em broadcast.<br />
</li>
<li>Caso contrário → o jogador <span style="font-weight: bold;" class="mycode_b">perde a aposta</span>.<br />
</li>
<li>Inclui <span style="font-weight: bold;" class="mycode_b">efeitos visuais</span> no chão, animações e cooldown (para evitar spam).<br />
</li>
<li>O sistema remove as moedas automaticamente e mostra os itens sorteados em tiles definidos no mapa.<br />
</li>
</ul>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local positions = {<br />
    {x = 1529, y = 1883, z = 9},<br />
    {x = 1531, y = 1883, z = 9},<br />
    {x = 1533, y = 1883, z = 9}<br />
}<br />
<br />
local price = 250 -- Preço em Event Coins para jogar<br />
local eventcoins = 2160 -- ID do Event Coin<br />
<br />
-- Itens com pesos diferentes (probabilidades personalizadas)<br />
local weightedItems = {<br />
    {id = 2006,  weight = 80, name = "Vial"},    -- 50% de chance (comum)<br />
    {id = 1987,  weight = 70, name = "Bag"}, -- 20% de chance (pouco raro)<br />
    {id = 2036,  weight = 52, name = "Watch"},      -- 15% de chance (raro)<br />
    {id = 1974,  weight = 45, name = "Book"},      -- 10% de chance (muito raro)<br />
    {id = 2145,  weight = 40,  name = "Small Diamound"},  -- 5% de chance (ultra raro)<br />
 {id = 12638,  weight = 30,  name = "dragonfruit"},<br />
 {id = 2157,  weight = 20,  name = "Gold Nugget"},<br />
 {id = 12640,  weight = 5,  name = "Penaut"}<br />
}<br />
<br />
-- Função para sortear um item baseado no peso<br />
local function getRandomWeightedItem()<br />
    local totalWeight = 0<br />
    for _, item in ipairs(weightedItems) do<br />
        totalWeight = totalWeight + item.weight<br />
    end<br />
    <br />
    local randomValue = math.random(1, totalWeight)<br />
    local currentWeight = 0<br />
    <br />
    for _, item in ipairs(weightedItems) do<br />
        currentWeight = currentWeight + item.weight<br />
        if randomValue &lt;= currentWeight then<br />
            return item.id, item.name<br />
        end<br />
    end<br />
    return weightedItems[1].id, weightedItems[1].name -- Fallback (nunca deve acontecer)<br />
end<br />
<br />
local function cleanTile(pos)<br />
    local tile = Tile(pos)<br />
    if not tile then return end<br />
<br />
    for _, item in ipairs(tile:getItems() or {}) do<br />
        -- Garante que não remova criaturas ou outros objetos inválidos<br />
        if item and item:isItem() then<br />
            item:remove()<br />
        end<br />
    end<br />
end<br />
<br />
function onUse(cid, item, fromPosition, itemEx, toPosition)<br />
    -- Verifica se o jogador pode apostar<br />
    if getGlobalStorageValue(722404) &gt; os.time() then<br />
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")<br />
        return true<br />
    end<br />
    <br />
    -- Verifica se tem Event Coins suficientes<br />
    if getPlayerItemCount(cid, eventcoins) &lt; price then<br />
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " Event Coins para jogar.")<br />
        return true<br />
    end<br />
<br />
    -- Cooldown individual do jogador<br />
    if getPlayerStorageValue(cid, 722406) &gt; os.time() then<br />
        doPlayerSendCancel(cid, "Aguarde um pouco para jogar novamente.")<br />
        return true<br />
    end<br />
    doPlayerSetStorageValue(cid, 722406, os.time() + 6)<br />
    <br />
    -- Cooldown global (evita spam)<br />
    setGlobalStorageValue(722404, os.time() + 6)<br />
    <br />
    -- Efeitos visuais antes do sorteio<br />
    for i = 1, #positions do<br />
        doSendMagicEffect(positions[i], 22)<br />
    end<br />
    <br />
    -- Remove as Event Coins<br />
    doPlayerRemoveItem(cid, eventcoins, price)<br />
    doTransformItem(item.uid, item.itemid == 9825 and 9826 or 9825)<br />
    <br />
    -- Sorteia os 3 itens (com probabilidades diferentes)<br />
    local first, firstName = getRandomWeightedItem()<br />
    local second, secondName = getRandomWeightedItem()<br />
    local third, thirdName = getRandomWeightedItem()<br />
    <br />
    local tab = {}<br />
    <br />
    -- Cria e mostra os itens sorteados<br />
    doCreateItem(first, 1, positions[1])<br />
    doSendMagicEffect(positions[1], 26)<br />
    addEvent(doSendMagicEffect, 100, positions[1], 31)<br />
    table.insert(tab, first)<br />
    <br />
    addEvent(function()<br />
        doCreateItem(second, 1, positions[2])<br />
        doSendMagicEffect(positions[2], 26)<br />
        addEvent(doSendMagicEffect, 100, positions[2], 31)<br />
        table.insert(tab, second)<br />
    end, 1700)<br />
    <br />
    addEvent(function()<br />
        doCreateItem(third, 1, positions[3])<br />
        doSendMagicEffect(positions[3], 26)<br />
        addEvent(doSendMagicEffect, 100, positions[3], 31)<br />
        table.insert(tab, third)<br />
    end, 2000)<br />
    <br />
    -- Verifica se ganhou (3 itens iguais)<br />
    addEvent(function()<br />
        -- Limpa os itens do chão<br />
cleanTile(positions[1])<br />
cleanTile(positions[2])<br />
cleanTile(positions[3])<br />
        doSendMagicEffect(positions[1], 54)<br />
        doSendMagicEffect(positions[2], 54)<br />
        doSendMagicEffect(positions[3], 54)<br />
        <br />
        if tab[1] == tab[2] and tab[1] == tab[3] then<br />
            -- Ganhou! Recebe o item.<br />
            doPlayerAddItem(cid, tab[1], 1)<br />
            doPlayerSendTextMessage(cid, 27, "Você ganhou um(a) " .. firstName .. "! Parabéns!")<br />
            doBroadcastMessage("O jogador " .. getCreatureName(cid) .. " ganhou um(a) " .. firstName .. " no cassino!", MESSAGE_EVENT_ADVANCE)<br />
            <br />
            -- Efeitos de vitória<br />
            doSendAnimatedText(getThingPos(cid), "GANHOU!", 215)<br />
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE)<br />
            doSendMagicEffect(positions[1], CONST_ME_FIREWORK_YELLOW)<br />
            doSendMagicEffect(positions[2], CONST_ME_FIREWORK_RED)<br />
            doSendMagicEffect(positions[3], CONST_ME_FIREWORK_GREEN)<br />
        else<br />
            -- Perdeu<br />
            doSendAnimatedText(getThingPos(cid), "PERDEU!", TEXTCOLOR_RED)<br />
            doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)<br />
        end<br />
    end, 4200)<br />
    <br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<br />
<img src="https://i.ibb.co/bj3PHyJg/Captura-de-tela-2025-08-17-144206.png" loading="lazy"  alt="[Imagem: Captura-de-tela-2025-08-17-144206.png]" class="mycode_img" /><br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Como Configurar.</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">1-</span> Posições dos itens exibidos.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local positions = {<br />
    {x = 1529, y = 1883, z = 9},<br />
    {x = 1531, y = 1883, z = 9},<br />
    {x = 1533, y = 1883, z = 9}<br />
}</blockquote>
Onde os 3 itens do sorteio vão aparecer no chão.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2-</span> Preço para jogar e moeda usada.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local price = 250 -- Preço em Event Coins<br />
local eventcoins = 2160 -- ID do item usado como moeda</blockquote>
Você define <span style="font-weight: bold;" class="mycode_b">quanto custa jogar</span> e <span style="font-weight: bold;" class="mycode_b">qual item será usado como moeda</span> (pode trocar por gold, tokens, etc).<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">3- </span>Itens e probabilidades (peso).<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>local weightedItems = {<br />
    {id = 2006, weight = 80, name = "Vial"},    <br />
    {id = 1987, weight = 70, name = "Bag"}, <br />
    {id = 2036, weight = 52, name = "Watch"},    <br />
    {id = 1974, weight = 45, name = "Book"},      <br />
    {id = 2145, weight = 40, name = "Small Diamond"},<br />
    {id = 12638, weight = 30, name = "Dragonfruit"},<br />
    {id = 2157, weight = 20, name = "Gold Nugget"},<br />
    {id = 12640, weight = 5,  name = "Peanut"}<br />
}</blockquote>
Cada item tem um <span style="font-weight: bold;" class="mycode_b">peso (probabilidade)</span>.<ul class="mycode_list"><li>Quanto <span style="font-weight: bold;" class="mycode_b">maior o weight</span>, mais fácil de sair.<br />
</li>
<li>Quanto <span style="font-weight: bold;" class="mycode_b">menor</span>, mais raro.<br />
</li>
</ul>
<br />
Exemplo: <span style="font-weight: bold;" class="mycode_b">weight = 80</span> é bem comum, <span style="font-weight: bold;" class="mycode_b">weight = 5</span> é super raro.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">4-</span> Cooldowns.<br />
<blockquote class="mycode_quote"><cite>Citação:</cite>-- Global cooldown (todos os players): 6 segundos<br />
setGlobalStorageValue(722404, os.time() + 6)<br />
<br />
-- Cooldown individual (por player): 6 segundos<br />
doPlayerSetStorageValue(cid, 722406, os.time() + 6)</blockquote>
Tempo mínimo entre apostas para evitar flood.<br />
<br />
Em resumo: você consegue configurar <span style="font-weight: bold;" class="mycode_b">onde aparece</span>, <span style="font-weight: bold;" class="mycode_b">quanto custa</span>, <span style="font-weight: bold;" class="mycode_b">qual moeda usar</span>, <span style="font-weight: bold;" class="mycode_b">quais itens podem sair</span> e suas <span style="font-weight: bold;" class="mycode_b">chances de sorteio</span>.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Actions] Rojão explosivo]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-Roj%C3%A3o-explosivo</link>
			<pubDate>Sun, 17 Aug 2025 14:35:20 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-Roj%C3%A3o-explosivo</guid>
			<description><![CDATA[Esse script cria um <span style="font-weight: bold;" class="mycode_b">item explosivo (rojão/bomba)</span> no OTServ.<br />
<br />
<br />
Resumo:<ul class="mycode_list"><li>O jogador usa um item especial que <span style="font-weight: bold;" class="mycode_b">joga um rojão no chão kkkk</span>.<br />
</li>
<li>Após <span style="font-weight: bold;" class="mycode_b">2 segundos</span>, a o rojão explode causando <span style="font-weight: bold;" class="mycode_b">de 8k a 15k de dano em área.</span><br />
</li>
<li>A explosão <span style="font-weight: bold;" class="mycode_b">não afeta áreas de proteção (PZ)</span>.<br />
</li>
<li>Possui <span style="font-weight: bold;" class="mycode_b">efeitos visuais</span> tanto ao plantar quanto ao explodir.<br />
</li>
<li>O item é consumido ao usar.<br />
</li>
<li>Tem um <span style="font-weight: bold;" class="mycode_b">tempo de recarga de 180 segundos (3 minutos)</span> por jogador antes de poder usar novamente.<br />
</li>
<li>Ao plantar, o servidor anuncia em broadcast quem usou a bomba.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Pasta:</span> Data/Actions/<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local bomb = {<br />
    itemId = 6576,<br />
    plantedItemId = 8058, -- ID do item que representa a bomba plantada (exemplo: uma dinamite acesa)<br />
    effectPlace = 3, -- efeito ao plantar a bomba<br />
    effectExplosion = 7, -- efeito de explosão<br />
    minDamage = 8000,<br />
    maxDamage = 15000,<br />
    delay = 2000, -- tempo em milissegundos para a explosão<br />
    cooldown = 180,<br />
    explosionRange = {<br />
        {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},<br />
        {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},<br />
        {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},<br />
        {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},<br />
        {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}<br />
    }<br />
}<br />
<br />
local lastUse = {}<br />
<br />
local function explodeBomb(plantPos)<br />
    local plantedItem = Tile(plantPos):getItemById(bomb.plantedItemId)<br />
    if plantedItem then<br />
        plantedItem:remove() -- Remove o item de indicador da bomba antes da explosão<br />
    end<br />
<br />
    for x, row in ipairs(bomb.explosionRange) do<br />
        for y, value in ipairs(row) do<br />
            if value == 1 then<br />
                local explosionPos = Position(plantPos.x + x - 6, plantPos.y + y - 6, plantPos.z)<br />
                local tile = Tile(explosionPos)<br />
<br />
                -- Verifica se o tile não é uma zona de proteção<br />
                if tile and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then<br />
                    explosionPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(bomb.effectExplosion)<br />
<br />
                    local creatures = tile:getCreatures()<br />
                    if creatures then<br />
                        for _, creature in ipairs(creatures) do<br />
                            -- Aplica dano a jogadores e criaturas<br />
                            local damage = math.random(bomb.minDamage, bomb.maxDamage)<br />
                            creature:addHealth(-damage)<br />
                        end<br />
                    end<br />
                end<br />
            end<br />
        end<br />
    end<br />
end<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    -- Verifica se o item está na backpack do jogador<br />
    local itemParent = item:getParent()<br />
    if not itemParent or itemParent:isTile() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você só pode usar este item se ele estiver na sua mochila.")<br />
        return true<br />
    end<br />
<br />
    local playerId = player:getId()<br />
    local currentTime = os.time()<br />
    local lastUseTime = player:getStorageValue(1000) -- ID arbitrário para o cooldown<br />
<br />
    if lastUseTime &gt; 0 and currentTime &lt; lastUseTime + bomb.cooldown then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Aguarde antes de usar o rojao explosivo novamente.")<br />
        return true<br />
    end<br />
<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, currentTime) -- Atualiza o cooldown no storage<br />
    local plantPos = player:getPosition()<br />
<br />
    -- Remove o item corretamente<br />
    if not player:removeItem(bomb.itemId, 1) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você precisa ter um rojao explosivo na sua backpack para joga-lo.")<br />
        return true<br />
    end<br />
<br />
    plantPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(bomb.effectPlace)<br />
    Game.broadcastMessage(player:getName() .. " jogou um rojao explosivo!", MESSAGE_EVENT_ADVANCE)<br />
<br />
    -- Cria o item indicador da bomba<br />
    Game.createItem(bomb.plantedItemId, 1, plantPos)<br />
<br />
    -- Agenda a explosão<br />
    addEvent(explodeBomb, bomb.delay, plantPos)<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<img src="https://i.ibb.co/VcHtDdpY/rojao.png" loading="lazy"  alt="[Imagem: rojao.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></description>
			<content:encoded><![CDATA[Esse script cria um <span style="font-weight: bold;" class="mycode_b">item explosivo (rojão/bomba)</span> no OTServ.<br />
<br />
<br />
Resumo:<ul class="mycode_list"><li>O jogador usa um item especial que <span style="font-weight: bold;" class="mycode_b">joga um rojão no chão kkkk</span>.<br />
</li>
<li>Após <span style="font-weight: bold;" class="mycode_b">2 segundos</span>, a o rojão explode causando <span style="font-weight: bold;" class="mycode_b">de 8k a 15k de dano em área.</span><br />
</li>
<li>A explosão <span style="font-weight: bold;" class="mycode_b">não afeta áreas de proteção (PZ)</span>.<br />
</li>
<li>Possui <span style="font-weight: bold;" class="mycode_b">efeitos visuais</span> tanto ao plantar quanto ao explodir.<br />
</li>
<li>O item é consumido ao usar.<br />
</li>
<li>Tem um <span style="font-weight: bold;" class="mycode_b">tempo de recarga de 180 segundos (3 minutos)</span> por jogador antes de poder usar novamente.<br />
</li>
<li>Ao plantar, o servidor anuncia em broadcast quem usou a bomba.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Pasta:</span> Data/Actions/<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local bomb = {<br />
    itemId = 6576,<br />
    plantedItemId = 8058, -- ID do item que representa a bomba plantada (exemplo: uma dinamite acesa)<br />
    effectPlace = 3, -- efeito ao plantar a bomba<br />
    effectExplosion = 7, -- efeito de explosão<br />
    minDamage = 8000,<br />
    maxDamage = 15000,<br />
    delay = 2000, -- tempo em milissegundos para a explosão<br />
    cooldown = 180,<br />
    explosionRange = {<br />
        {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},<br />
        {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},<br />
        {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},<br />
        {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},<br />
        {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},<br />
        {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}<br />
    }<br />
}<br />
<br />
local lastUse = {}<br />
<br />
local function explodeBomb(plantPos)<br />
    local plantedItem = Tile(plantPos):getItemById(bomb.plantedItemId)<br />
    if plantedItem then<br />
        plantedItem:remove() -- Remove o item de indicador da bomba antes da explosão<br />
    end<br />
<br />
    for x, row in ipairs(bomb.explosionRange) do<br />
        for y, value in ipairs(row) do<br />
            if value == 1 then<br />
                local explosionPos = Position(plantPos.x + x - 6, plantPos.y + y - 6, plantPos.z)<br />
                local tile = Tile(explosionPos)<br />
<br />
                -- Verifica se o tile não é uma zona de proteção<br />
                if tile and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then<br />
                    explosionPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(bomb.effectExplosion)<br />
<br />
                    local creatures = tile:getCreatures()<br />
                    if creatures then<br />
                        for _, creature in ipairs(creatures) do<br />
                            -- Aplica dano a jogadores e criaturas<br />
                            local damage = math.random(bomb.minDamage, bomb.maxDamage)<br />
                            creature:addHealth(-damage)<br />
                        end<br />
                    end<br />
                end<br />
            end<br />
        end<br />
    end<br />
end<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    -- Verifica se o item está na backpack do jogador<br />
    local itemParent = item:getParent()<br />
    if not itemParent or itemParent:isTile() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você só pode usar este item se ele estiver na sua mochila.")<br />
        return true<br />
    end<br />
<br />
    local playerId = player:getId()<br />
    local currentTime = os.time()<br />
    local lastUseTime = player:getStorageValue(1000) -- ID arbitrário para o cooldown<br />
<br />
    if lastUseTime &gt; 0 and currentTime &lt; lastUseTime + bomb.cooldown then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Aguarde antes de usar o rojao explosivo novamente.")<br />
        return true<br />
    end<br />
<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, currentTime) -- Atualiza o cooldown no storage<br />
    local plantPos = player:getPosition()<br />
<br />
    -- Remove o item corretamente<br />
    if not player:removeItem(bomb.itemId, 1) then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endCancelMessage("Você precisa ter um rojao explosivo na sua backpack para joga-lo.")<br />
        return true<br />
    end<br />
<br />
    plantPos<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endMagicEffect(bomb.effectPlace)<br />
    Game.broadcastMessage(player:getName() .. " jogou um rojao explosivo!", MESSAGE_EVENT_ADVANCE)<br />
<br />
    -- Cria o item indicador da bomba<br />
    Game.createItem(bomb.plantedItemId, 1, plantPos)<br />
<br />
    -- Agenda a explosão<br />
    addEvent(explodeBomb, bomb.delay, plantPos)<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Foto:</span><br />
<img src="https://i.ibb.co/VcHtDdpY/rojao.png" loading="lazy"  alt="[Imagem: rojao.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Fiapo]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Actions - Bônus temporário de capacidade (cap)]]></title>
			<link>https://forum.ayoocloud.com.br/Thread-Actions-B%C3%B4nus-tempor%C3%A1rio-de-capacidade-cap</link>
			<pubDate>Sun, 17 Aug 2025 13:42:24 -0300</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.ayoocloud.com.br/member.php?action=profile&uid=1">paulim78</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.ayoocloud.com.br/Thread-Actions-B%C3%B4nus-tempor%C3%A1rio-de-capacidade-cap</guid>
			<description><![CDATA[Esse script cria um <span style="font-weight: bold;" class="mycode_b">item consumível</span> que aumenta temporariamente a <span style="font-weight: bold;" class="mycode_b">capacidade de carga (cap)</span> do jogador em <span style="font-weight: bold;" class="mycode_b">+2500</span> por <span style="font-weight: bold;" class="mycode_b">1 hora</span>.<br />
<ul class="mycode_list"><li>Se o jogador já estiver com o bônus ativo, não pode usar outro.<br />
</li>
<li>O item é removido após o uso.<br />
</li>
<li>Ao final da duração, a capacidade extra desaparece automaticamente e o jogador recebe uma mensagem de aviso.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Arquivo:</span>data/actions/<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local config = {<br />
    capacityToAdd = 2500,  -- Quantidade de capacidade a ser adicionada<br />
    duration = 60 * 60 * 1000  -- Duração do efeito em milissegundos (1 hora)<br />
}<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    -- Verifica se o jogador já tem o efeito ativo<br />
    if player:getStorageValue(1000) &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Você já tem um aumento de capacidade ativo.")<br />
        return true<br />
    end<br />
<br />
    -- Adiciona a capacidade ao jogador<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etCapacity(player:getCapacity() + config.capacityToAdd)<br />
<br />
    -- Define o tempo de expiração do efeito<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, os.time() + config.duration / 1000)<br />
<br />
    -- Remove o item após o uso<br />
    item:remove(1)<br />
<br />
    -- Mensagem de sucesso<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Sua capacidade foi aumentada em " .. config.capacityToAdd .. " por " .. config.duration / 1000 / 60 .. " minutos.")<br />
<br />
    -- Agenda a remoção da capacidade após o tempo determinado<br />
    addEvent(function()<br />
        if player:getStorageValue(1000) &gt; os.time() then<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etCapacity(player:getCapacity() - config.capacityToAdd)<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Your capacity boost has ended.")<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, 0)<br />
        end<br />
    end, config.duration)<br />
<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Não sei quem e o criador]]></description>
			<content:encoded><![CDATA[Esse script cria um <span style="font-weight: bold;" class="mycode_b">item consumível</span> que aumenta temporariamente a <span style="font-weight: bold;" class="mycode_b">capacidade de carga (cap)</span> do jogador em <span style="font-weight: bold;" class="mycode_b">+2500</span> por <span style="font-weight: bold;" class="mycode_b">1 hora</span>.<br />
<ul class="mycode_list"><li>Se o jogador já estiver com o bônus ativo, não pode usar outro.<br />
</li>
<li>O item é removido após o uso.<br />
</li>
<li>Ao final da duração, a capacidade extra desaparece automaticamente e o jogador recebe uma mensagem de aviso.<br />
</li>
</ul>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Arquivo:</span>data/actions/<br />
<span style="font-weight: bold;" class="mycode_b">Codigo:</span><br />
<br />
<div class="spoiler">
			<div class="spoiler_title"><span class="spoiler_button" onclick="javascript: if(parentNode.parentNode.getElementsByTagName('div')[1].style.display == 'block'){ parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerHTML='Show Content'; } else { parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block'; this.innerHTML='Hide Content'; }">Show Content</span></div>
			<div class="spoiler_content" style="display: none;"><span class="spoiler_content_title">Spoiler</span><br />
<br />
local config = {<br />
    capacityToAdd = 2500,  -- Quantidade de capacidade a ser adicionada<br />
    duration = 60 * 60 * 1000  -- Duração do efeito em milissegundos (1 hora)<br />
}<br />
<br />
function onUse(player, item, fromPosition, target, toPosition, isHotkey)<br />
    -- Verifica se o jogador já tem o efeito ativo<br />
    if player:getStorageValue(1000) &gt; os.time() then<br />
        player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Você já tem um aumento de capacidade ativo.")<br />
        return true<br />
    end<br />
<br />
    -- Adiciona a capacidade ao jogador<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etCapacity(player:getCapacity() + config.capacityToAdd)<br />
<br />
    -- Define o tempo de expiração do efeito<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, os.time() + config.duration / 1000)<br />
<br />
    -- Remove o item após o uso<br />
    item:remove(1)<br />
<br />
    -- Mensagem de sucesso<br />
    player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Sua capacidade foi aumentada em " .. config.capacityToAdd .. " por " .. config.duration / 1000 / 60 .. " minutos.")<br />
<br />
    -- Agenda a remoção da capacidade após o tempo determinado<br />
    addEvent(function()<br />
        if player:getStorageValue(1000) &gt; os.time() then<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etCapacity(player:getCapacity() - config.capacityToAdd)<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />endTextMessage(MESSAGE_INFO_DESCR, "Your capacity boost has ended.")<br />
            player<img src="https://forum.ayoocloud.com.br/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />etStorageValue(1000, 0)<br />
        end<br />
    end, config.duration)<br />
<br />
    return true<br />
end<br />
<br />
</div>
		</div>
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Creditos:</span><br />
Não sei quem e o criador]]></content:encoded>
		</item>
	</channel>
</rss>