Jump to content

Dicas e Tutoriais

Encontre dicas e tutoriais sobre informática.


398 topics in this forum

    • 24 replies
    • 8.3k views
  1. Removendo Um Keylogger 1 2 3 4 5

    • 63 replies
    • 21.3k views
    • 37 replies
    • 11.4k views
    • 20 replies
    • 8.1k views
    • 37 replies
    • 15.4k views
    • 0 replies
    • 5.2k views
  2. Baiak Sexo

    • 3 replies
    • 2.8k views
  3. MELHOR HOST

    • 2 replies
    • 2.8k views
    • 3 replies
    • 2.8k views
    • 4 replies
    • 2.6k views
    • 2 replies
    • 2.9k views
    • 4 replies
    • 2.5k views
    • 0 replies
    • 3.3k views
    • 0 replies
    • 2.9k views
    • 0 replies
    • 1.5k views
  4. vps e dedicado super barata e com qualidade

    • 1 reply
    • 3.1k views
    • 2 replies
    • 2.7k views
  5. Semi-dedicado jvservers

    • 3 replies
    • 3k views
    • 2 replies
    • 3.2k views
    • 4 replies
    • 2.1k views
    • 6 replies
    • 2.1k views
    • 0 replies
    • 2.8k views
    • 0 replies
    • 2.7k views
    • 6 replies
    • 3.4k views
    • 0 replies
    • 1.6k views
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Popular Contributors

  • Topics

  • Últimos Posts

    • 1.Adicione um comando para escolher o Pokémon: Digamos que você adicione !choosepokemon para configurar o Pokémon que o jogador deseja derrotar. 2.Adapte a função resetDailyKill para usar essa escolha:   function choosePokemon(cid, pokemonName) if isPlayer(cid) then local mode = killModes[(getCatchMode(cid))] local pokemons = mode.pokemons if table.contains(pokemons, pokemonName) then local count = math.random(getPlayerLevel(cid) * 2) local day = tostring(""..getNumberDay().."-"..getNumberMonth().."-"..getNumberYear().."") setPlayerStorageValue(cid, killModes.storage, "|"..getCatchMode(cid).."|"..day.."|"..pokemonName.."|false|"..count) setPlayerStorageValue(cid, killModes.storage2, -1) setPlayerStorageValue(cid, 24003, 0) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have chosen: " .. pokemonName .. " as your daily kill target.") else doPlayerSendCancel(cid, "Invalid Pokémon. Choose from the list.") end end end 3.Implementar comando para escolha:   function onSay(cid, words, param) if param == "" then doPlayerSendCancel(cid, "Use: !choosepokemon <pokemon_name>") return true end choosePokemon(cid, param:trim()) return true end  
    • Para o comando !sell:   function onSay(cid, words, param) local config = { levelNeeded = 8, muteTime = 120, -- tempo em segundos storage = 7896 } if param == "" then doPlayerPopupFYI(cid, "Use: !sell itemName, price in GP") return true end local t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") return true end if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") return true else local itemName = t[1]:trim() local price = tonumber(t[2]) if price <= 0 then doPlayerSendCancel(cid, "Invalid price.") return true end local itemId = getItemIdByName(itemName) if getPlayerItemCount(cid, itemId) > 0 then doBroadcastMessage("Player " .. getPlayerName(cid) .. " is selling " .. itemName .. " for " .. price .. " gold coins.") setPlayerStorageValue(cid, config.storage, (os.time() + config.muteTime)) else doPlayerSendCancel(cid, "You don't have the item '" .. itemName .. "' to sell.") end end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. " can broadcast an offer.") end return true end Para o comando !buy:   function onSay(cid, words, param) local config = { levelNeeded = 8, muteTime = 120, storage = 7896 } if param == "" then doPlayerPopupFYI(cid, "Use: !buy itemName, price in GP") return true end local t = string.explode(param, ",") if not(t[1]) or not(t[2]) then doPlayerSendCancel(cid, "Command requires more than one parameter.") return true end if getPlayerLevel(cid) >= config.levelNeeded then if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()) elseif getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.") return true else local itemName = t[1]:trim() local price = tonumber(t[2]) if price <= 0 then doPlayerSendCancel(cid, "Invalid price.") return true end -- Logica de compra do item: verificar se algum jogador está vendendo o item -- e o preço condiz com a oferta. Se sim, retirar o item do vendedor e -- transferir para o comprador doBroadcastMessage("Player " .. getPlayerName(cid) .. " is buying " .. itemName .. " for " .. price .. " gold coins.") setPlayerStorageValue(cid, config.storage, (os.time() + config.muteTime)) end else doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. " can broadcast an offer.") end return true end  
    • -- Inicializar as tabelas globais para compras e vendas ativas activeBuys = activeBuys or {} activeSells = activeSells or {} -- Configuração local config = { validCurrencies = {9971, 2160, 2148, 2152, 2157, 2159}, -- Moedas válidas maxPrice = 1000000000, -- Preço máximo permitido } -- Função para verificar se uma moeda é válida local function isValidCurrency(currencyId) for _, validId in ipairs(config.validCurrencies) do if validId == currencyId then return true end end return false end -- Função para listar itens à venda function listItems(cid) if #activeSells == 0 then doPlayerSendCancel(cid, "No items are currently being sold.") return true end local message = "Items available for sale:\n" for i, sell in ipairs(activeSells) do message = message .. i .. ". " .. sell.itemName .. " (" .. sell.quantity .. "x) - Price: " .. sell.price .. " gold coins - Seller: " .. sell.seller .. "\n" end doPlayerPopupFYI(cid, message) return true end -- Função para comprar o item function buyItem(cid, itemName, quantity, price, currencyId, sellerName) -- Verificar se o item está à venda for i, sell in ipairs(activeSells) do if sell.itemName == itemName and sell.seller == sellerName then -- Calcular o preço total pelo número de itens local totalPrice = sell.price * quantity -- Verificar se o jogador tem moeda suficiente if getPlayerItemCount(cid, currencyId) < totalPrice then doPlayerSendCancel(cid, "You don't have enough currency to buy this item.") return true end -- Verificar se há quantidade suficiente do item if sell.quantity < quantity then doPlayerSendCancel(cid, "Not enough items in stock.") return true end -- Realizar a compra -- Remover o dinheiro do comprador doPlayerRemoveItem(cid, currencyId, totalPrice) -- Adicionar o item ao comprador doPlayerAddItem(cid, getItemIdByName(itemName), quantity) -- Atualizar a quantidade do item à venda activeSells[i].quantity = activeSells[i].quantity - quantity -- Informar ao jogador sobre a compra doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have successfully bought " .. quantity .. "x " .. itemName .. " from " .. sellerName .. " for " .. totalPrice .. " currency.") -- Caso o item tenha acabado, remover a venda if activeSells[i].quantity <= 0 then table.remove(activeSells, i) end return true end end doPlayerSendCancel(cid, "Item not found in the market.") return true end -- Função para vender o item function sellItem(cid, itemName, quantity, price, currencyId) -- Verificar se o jogador tem o item suficiente local itemId = getItemIdByName(itemName) if itemId == 0 or getPlayerItemCount(cid, itemId) < quantity then doPlayerSendCancel(cid, "You don't have enough of the item '" .. itemName .. "' to sell.") return true end -- Remover os itens do inventário do vendedor doPlayerRemoveItem(cid, itemId, quantity) -- Registrar a venda table.insert(activeSells, { itemName = itemName, quantity = quantity, price = price, currencyId = currencyId, seller = getPlayerName(cid), }) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your item '" .. itemName .. "' has been listed for sale.") return true end -- Função principal para lidar com os comandos function onSay(cid, words, param) if words == "!sell" then if param == "" then doPlayerSendCancel(cid, "Use: !sell itemName, quantity, price, currencyId") return true end local t = string.explode(param, ",") if #t ~= 4 then doPlayerSendCancel(cid, "Invalid parameters. Use: !sell itemName, quantity, price, currencyId") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) -- Chama a função para vender o item return sellItem(cid, itemName, quantity, price, currencyId) elseif words == "!buy" then if param == "" then doPlayerSendCancel(cid, "Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 - 2157 - 2159, sellerName") return true end -- Separar os parâmetros fornecidos local t = string.explode(param, ",") if #t ~= 5 then doPlayerSendCancel(cid, "Invalid parameters. Use: !buy itemName, quantity, price, ID's 9971 - 2160 - 2148 - 2152 - 2157 - 2159, sellerName") return true end local itemName = t[1]:trim() local quantity = tonumber(t[2]) local price = tonumber(t[3]) local currencyId = tonumber(t[4]) local sellerName = t[5]:trim() -- Chama a função para comprar o item return buyItem(cid, itemName, quantity, price, currencyId, sellerName) elseif words == "!list" then -- Exibe os itens à venda return listItems(cid) end return false end  
    • [URL=https://casualmatch.site]Explore Exciting Connections in Your Town Tonight in Your Town[/URL] [URL=https://pills.casualmatch.site] Pharmaceuticals, wholesale prices, worldwide delivery.[/URL]
    • [URL=https://datingnow.site]Looking for Fun? Connect with Women Seeking Casual Encounters in Your Town[/URL] [URL=https://drugs.casualmatch.site]Drugs - wholesale prices - worldwide shipping.[/URL]
×
×
  • Create New...