
Histórico de Curtidas
-
Babilonia recebeu reputação de Marcio Santos em [TFS 1.x] Mount Dollmuito bom ta bugado pra compra pelo gesior aki n chega isso me salvo reputado vlwss!!!
Otimo Cara me ajudo muito vou ajuda tbm ae
codigo atualizado versao 10.96
local mounts = { --["mount"] = {id = x}, ["widow queen"] = {id = 1}, ["racing bird"] = {id = 2}, ["war bear"] = {id = 3}, ["black sheep"] = {id = 4}, ["midnight panther"] = {id = 5}, ["draptor"] = {id = 6}, ["titanica"] = {id = 7}, ["tin lizzard"] = {id = 8}, ["blazebringer"] = {id = 9}, ["rapid boar"] = {id = 10}, ["stampor"] = {id = 11}, ["undead cavebear"] = {id = 12}, ["donkey"] = {id = 13}, ["tiger slug"] = {id = 14}, ["uniwheel"] = {id = 15}, ["crystal wolf"] = {id = 16}, ["war horse"] = {id = 17}, ["kingly deer"] = {id = 18}, ["tamed panda"] = {id = 19}, ["dromedary"] = {id = 20}, ["scorpion king"] = {id = 21}, ["rented horse"] = {id = 22}, ["armoured war horse"] = {id = 23}, ["shadow draptor"] = {id = 24}, ["rented horse"] = {id = 26}, ["lady bug"] = {id = 27}, ["manta ray"] = {id = 28}, ["ironblight"] = {id = 29}, ["magma crawler"] = {id = 30}, ["dragonling"] = {id = 31}, ["gnarlhound"] = {id = 32}, ["crimson ray"] = {id = 33}, ["steelbeak"] = {id = 34}, ["water buffalo"] = {id = 35}, ["armoured scorpion"] = {id = 36}, ["armoured dragonling"] = {id = 37}, ["ursagrodon"] = {id = 38}, ["hellgrip"] = {id = 39}, ["noble lion"] = {id = 40}, ["desert king"] = {id = 41}, ["shock head"] = {id = 42}, ["walker"] = {id = 43}, ["azudocus"] = {id = 44}, ["carpacosaurus"] = {id = 45}, ["death crawler"] = {id = 46}, ["flamesteed"] = {id = 47}, ["jade lion"] = {id = 48}, ["jade pincer"] = {id = 49}, ["nethersteed"] = {id = 50}, ["tempest"] = {id = 51}, ["winter king"] = {id = 52}, ["doombringer"] = {id = 53}, ["woodland prince"] = {id = 54}, ["hailtorm fury"] = {id = 55}, ["siegebreaker"] = {id = 56}, ["poisonbane"] = {id = 57}, ["blackpelt"] = {id = 58}, ["golden dragonfly"] = {id = 59}, ["steel bee"] = {id = 60}, ["copper fly"] = {id = 61}, ["tundra rambler"] = {id = 62}, ["highland yak"] = {id = 63}, ["glacier vagabond"] = {id = 64}, ["flying divan"] = {id = 65}, ["magic carpet"] = {id = 66}, ["floating kashmir"] = {id = 67}, ["ringtail waccoon"] = {id = 68}, ["night waccoon"] = {id = 69}, ["emerald waccoon"] = {id = 70}, ["glooth glider"] = {id = 71}, ["shadow hart"] = {id = 72}, ["black stag"] = {id = 73}, ["emperor deer"] = {id = 74}, ["flitterkatzen"] = {id = 75}, ["venompaw"] = {id = 76}, ["batcat"] = {id = 77}, ["sea devil"] = {id = 78}, ["coralripper"] = {id = 79}, ["plumfish"] = {id = 80}, ["gorongra"] = {id = 81}, ["noctungra"] = {id = 82}, ["silverneck"] = {id = 83}, ["slagsnare"] = {id = 84}, ["nightstinger"] = {id = 85}, ["razorcreep"] = {id = 86}, ["rift runner"] = {id = 87}, ["nightweller"] = {id = 88}, ["frostflare"] = {id = 89}, ["cinderhoof"] = {id = 90}, ["mouldpincer"] = {id = 91}, ["bloodcurl"] = {id = 92}, ["leafscuttler"] = {id = 93}, ["sparkion"] = {id = 94}, ["neon sparkid"] = {id = 95}, ["vortexion"] = {id = 96} } function onSay(player, words, param) local word = mounts[string.lower(param)] local mountdoll_id = 9019 -- id do mount doll if (player:getItemCount(mountdoll_id) > 0) then if (param ~= "" and word) then if(word and not player:hasMount(word.id)) then player:removeItem(mountdoll_id, 1) player:sendTextMessage(MESSAGE_INFO_DESCR, "Sua mount foi adicionada!") player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) player:addMount(word.id) else player:sendCancelMessage("Voce ja tem esta mount.") end else player:sendCancelMessage("Digite novamente, algo está errado!") end else player:sendCancelMessage("Voce não tem um mount doll!") end return true end espero que ajude.
vc tem que decha tudo ate o letra minúscula ai vai roda manin ou pega o codigo que editei abaixo vlw!!!
-
Babilonia deu reputação a murilao em OtherWorld [MAP]Opa e ai @malucooo ? Vai disponibilizar ou o que? :D
-
Babilonia deu reputação a murilao em Alguem pode me ajudar a compilar um sistema tfs 1.2
-
Babilonia deu reputação a Bodak Reborn em [pedido] Regen Stamina TrainerEu esqueci de colocar uma tag.
Aqui:
<movevent type="StepOut" actionid="actiond_id" event="script" value="nome_arquivo.lua" />
-
Babilonia deu reputação a Bodak Reborn em (Resolvido)Usar item só se tiver tal storage.local stor = {30023, 4} local storage = 657489 function onUse(cid, item, fromPos, toPos) if getPlayerStorageValue(cid, stor[1]) ~= stor[2] then return doPlayerSendCancel(cid, 'You can\'t use this item.') and false end if getPlayerStorageValue (cid, storage) == 1 then return true end doRemoveItem(item.uid, 2415) doPlayerSetVocation(cid, 525) doCreatureChangeOutfit(cid, {lookType = 462}) doSendMagicEffect(toPos, 32) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Agora voce foi promovido.') setPlayerStorageValue (cid, storage, 1) doRemoveItem(item.uid) return true end
-
Babilonia recebeu reputação de Lucas Barreto em [v32] GlobalFull 11/12 - New Asuras, Falcons, Warzones 4,5,6 . (Updates Frequentes)Copila outro qu ta disponivel na otland ou retire o sistema.
Mesmo procedimento pra colocar online basta vc colocar seu ip ipv4 no config.lua
como saber o ipv4 aperte win+r digite cmd depois que abrir digite ipconfig ira aparecer o ip que vc de usar o ipv4
o resto é do processo xamp site mesmo processo como se fosse por online pesquise aqui no tk vc vai achar.
-
Babilonia deu reputação a murilao em [v32] GlobalFull 11/12 - New Asuras, Falcons, Warzones 4,5,6 . (Updates Frequentes)Não tem ninguem disponibilizou.
-
Babilonia deu reputação a Bruxo Ots em (Gesior 2012) Pagina Addons 10.90Boa noite pagina simples de addons ,para quem precisa.
Em layout.php add
em htdocs\pages crie um arquivo chamado addon(fica no teu critério )
em \htdocs\images extraia, o arquivo addons são todas imagens de addons em .gif
Addons
Creditos:Sekk(pela pasta com os addons)
Creditos:Para o cara que criou a pagina de mounts.
Creditos:Para eu :D por modificar e colocar os addons.
-
Babilonia deu reputação a murilao em Ajuda Npc de viaje ta com um bugVai no data/npcs/script/Captain Free.lua
e troca por esse abaixo e da reload. Foi testado no tfs 1.2 e deu certo :D
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- OTServ -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Yalahar. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32817, y=31270, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Thais. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32310,y=32209,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Carlin. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32387,y=31821,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Venore. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32962,y=32021,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Port Hope. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32535,y=32783,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Darashia. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33289, y=32481, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Liberty Bay. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32298,y=32900,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Svargrond. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32342,y=31108,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Edron,. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33176,y=31764,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Ankrahmun. Is that ok with you?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33092,y=32883,z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'}) keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Welcome on board, free |PLAYERNAME|. I can bring you to {Thais}, {Carlin}, {Venore}, {Port Hope}, {Darashia}, {Liberty Bay}, {Svargrond}, {Edron}, {Ankrahmun} or {Yalahar} .'}) keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Welcome on board, noble |PLAYERNAME|. I can bring you to {Thais}, {Carlin}, {Venore}, {Port Hope}, {Darashia}, {Liberty Bay}, {Svargrond}, {Edron}, {Ankrahmun} or {Yalahar} .'}) keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'}) keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'}) npcHandler:addModule(FocusModule:new())
-
Babilonia deu reputação a luanluciano93 em Addon DollOlá pessoal, para quem não sabe esse script funciona da seguinte maneira, você escolhe um X item, e se o player tiver esse X item, e falar !addon "[nome do addon] ele ganha o addon full que ele escolheu.
Crie um arquivo com o nome addondoll.lua em talkactions/scripts e coloque isso dentro:
local outfits = { --[outfit] = {id_female, id_male} ["citizen"] = {136, 128}, ["hunter"] = {137, 129}, ["mage"] = {138, 130}, ["knight"] = {139, 131}, ["noblewoman"] = {140, 132}, ["summoner"] = {141, 133}, ["warrior"] = {142, 134}, ["barbarian"] = {147, 143}, ["druid"] = {148, 144}, ["wizard"] = {149, 145}, ["oriental"] = {150, 146}, ["pirate"] = {155, 151}, ["assassin"] = {156, 152}, ["beggar"] = {157, 153}, ["shaman"] = {158, 154}, ["norsewoman"] = {252, 251}, ["nightmare"] = {269, 268}, ["jester"] = {270, 273}, ["brotherhood"] = {279, 278}, ["demonhunter"] = {288, 289}, ["yalaharian"] = {324, 325}, ["warmaster"] = {336, 335}, ["wayfarer"] = {366, 367}, ["afflicted"] = {431, 430}, ["elementalist"] = {433, 432}, ["deepling"] = {464, 463}, ["insectoid"] = {466, 465}, ["red baron"] = {471, 472}, ["crystal warlord"] = {513, 512}, ["soil guardian"] = {514, 516}, ["demon"] = {542, 541} } function onSay(player, words, param) local addondoll_id = 9693 if player:getItemCount(addondoll_id) > 0 then local word = outfits[string.lower(param)] if param ~= "" and word then if (not player:hasOutfit(word[1], 3) or not player:hasOutfit(word[2], 3)) and player:removeItem(addondoll_id, 1) then player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) player:addOutfitAddon(word[1], 3) player:addOutfitAddon(word[2], 3) player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu Addon full foi adicionado!") else player:sendCancelMessage("Voce ja tem este addon") end else player:sendCancelMessage("Digite novamente, algo esta errado!") end else player:sendCancelMessage("Voce nao tem addon doll!") end return true end
E em talkactions.xml adcione a tag:
<talkaction words="!addon" script="addondoll.lua"/> Para editar é fácil, nesta parte:
local addondoll_id = 9693
Você escolhe o id do item que será o addon doll.
E caso queira adicionar algum addon novo que não esteja configurado adicione ele na tabela male e female em sequencia aos outros.
Exemplo: local
--[outfit] = {id_female, id_male}
Para usar no servidor é só usar o comando !addon "nomedoaddon
Bem simples né pessoal ?! Espero ter ajudado, abraços!
-
Babilonia deu reputação a luanluciano93 em [TFS 1.x] Mount DollOlá pessoal, para quem não sabe esse script funciona da seguinte maneira, você escolhe um X item, e se o player tiver esse X item, e falar !mount [nome da mount] ele ganha a mount que ele escolheu.
Crie um arquivo com o nome mountdoll.lua em talkactions/scripts e coloque isso dentro:
local mounts = { --["mount"] = {id = x}, ["widow queen"] = {id = 1} } function onSay(player, words, param) local word = mounts[string.lower(param)] local mountdoll_id = 9019 -- id do mount doll if player:getItemCount(mountdoll_id) > 0 then if param ~= "" and word then if not player:hasMount(word.id) and player:removeItem(mountdoll_id, 1) then player:sendTextMessage(MESSAGE_INFO_DESCR, "You got your mount!") player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) player:addMount(word.id) else player:sendCancelMessage("You already have this mount.") end else player:sendCancelMessage("This mount does not exist.") end else player:sendCancelMessage("You must have a mount doll in your backpack!") end return true end
E em talkactions.xml adcione a tag:
<talkaction words="!mount" script="mountdoll.lua"/> Para editar é fácil, nesta parte:
local mountdoll_id = 9019 -- id do mount doll
Você escolhe o id do item que será o mount doll.
E caso queira adicionar alguma mount nova que não esteja configurado adicione ele na tabela em sequencia aos outros igual o exemplo:
-- ["mount"] = {id = x},
Eu deixei configurei apenas 1 mount, basta pegar os ids das mount e fazer igual o exemplo.
Para usar no servidor é só usar o comando !mount "mountname
Bem simples né pessoal ?! Espero ter ajudado, abraços!
-
Babilonia deu reputação a llucas75 em (Resolvido)[BUG SCRIPT] Double xp potion socorroEntão tente esse sistema
em actions exp.lua
tag
só mude if item.itemid == 9930 then para itemid desejada e <action itemid="9930" script="exp.lua"/> para item desejado também
e apague esse seu mod.. deve resolver...
-
Babilonia deu reputação a MaXwEllDeN em Poll System - Enquetes no seu servidor .-.post_pattern = { author = "Maxwell Denisson(MaXwEllDeN)", developed_in = "The Forgotten Server 0.3.6", code_version = 1.0 } Introdução Com esse sistema, você pode criar enquetes no seu servidor, para saber a opniao de seus players. Instalação Abra a pasta creatureevents, dentro da pasta scripts copie qualquer arquivo com extenção .lua, renomeie para PollMaX, abra com algum editor de texto, apague tudo que tiver dentro e cole o seguinte conteúdo: --[[ Poll System Author: Maxwell Denisson(MaXwEllDeN) Version: 1.0 ]] local POLL = _POLL_SYS function onLogin(cid) if (POLL.on) then local PVotes = string.explode(POLL.func.playerGetVotes (cid), ", ") for _, a in pairs(PVotes) do if not (POLL.func.hasPoll(a)) then POLL.func.removePlayerVote(cid, a) end end local kyz = 0 local polls = {} local msgeX = "MaX Poll System:\nParticipe de nossa(s) enquete(s) -> " for _, a in pairs(POLL.func.getPolls()) do kyz = 1 table.insert(polls, a[1]) msgeX = msgeX .. a[1] .. ", " end if (kyz ~= 0) then doPlayerSendTextMessage(cid, 27, msgeX:sub(1, #msgeX-2)) end end return true end Abra a pasta lib na sua pasta data, copie qualquer arquivo com extenção .lua, renomeie para PollMaX, abra com algum editor de texto, apague tudo que tiver dentro e cole o seguinte conteúdo: --[[ Poll System Author: Maxwell Denisson(MaXwEllDeN) Version: 1.0 ]] _POLL_SYS = { func = {}, VotdSto = 42873, on = true } local InStalled = false function printTableSI(aff) -- BETA ~ By MaXwEllDeN local s = "{" for a, b in pairs(aff) do local index = "[".. a .. "]" if (type(a) == "string") then index = '["'.. a ..'"]' end if (type(b) == "table") then value = printTableSI(b) elseif (type(b) == "string") then value = '"'.. b .. '"' else value = b end s = s .. index .. " = " .. value .. ", " end s = "{" .. s:sub(2, #s) return (#s < 3) and "{}" or (s:sub(1, #s-2) .. "}") end _POLL_SYS.func.install = function () return (db.getResult("ALTER TABLE `server_config` ADD COLUMN `polls` VARCHAR( 255 ) NOT NULL DEFAULT ('{}');")) and true or false end _POLL_SYS.func.getPolls = function () local get = db.getResult("SELECT `polls` FROM `server_config` WHERE `config` = 'db_version';") local resultado = get:getDataString('polls') return (resultado) and loadstring("return " .. resultado)() or nil end _POLL_SYS.func.setPolls = function (newpoll) return (db.getResult("UPDATE `server_config` SET `polls` = '".. newpoll .."' WHERE `config` = `db_version`;")) and true or false end _POLL_SYS.func.addPoll = function (poll, options) local Apoll = _POLL_SYS.func.getPolls() table.insert(Apoll, {poll, options}) return _POLL_SYS.func.setPolls(printTableSI(Apoll)) end _POLL_SYS.func.removePoll = function (poll) local Apoll = _POLL_SYS.func.getPolls() local Npoll = {} for _, b in pairs(Apoll) do if (b[1]:lower() ~= poll:lower()) then table.insert(Npoll, b) end end local Npoll = printTableSI(Npoll) return _POLL_SYS.func.setPolls(Npoll) end _POLL_SYS.func.hasPoll = function (poll) local polls = _POLL_SYS.func.getPolls() for _, b in pairs(polls) do if (b[1]:lower() == poll:lower()) then return true end end return false end _POLL_SYS.func.hasPollOption = function (poll, option) local polls = _POLL_SYS.func.getPolls() for _, b in pairs(polls) do if (b[1]:lower() == poll:lower()) then if (b[2][option:lower()]) then return true end end end return false end _POLL_SYS.func.playerSetVotes = function (player, votes) return setPlayerStorageValue(player, 77734, votes) end _POLL_SYS.func.playerGetVotes = function (player) if (getPlayerStorageValue(player, 77734) == -1) then setPlayerStorageValue(player, 77734, "") end return getPlayerStorageValue(player, 77734) end _POLL_SYS.func.playerAddVote = function (player, poll) return setPlayerStorageValue(player, 77734, getPlayerStorageValue(player, 77734) .. ", ".. poll .. "") end _POLL_SYS.func.hasPlayerVote = function (player, poll) local _, votes = _POLL_SYS.func.playerGetVotes(player):gsub(poll:lower(), "fuu") return (votes > 0) and true or false end _POLL_SYS.func.removePlayerVote = function (player, poll) local _, votes = _POLL_SYS.func.playerGetVotes(player):gsub(poll:lower(), " ") return (votes > 0) and _POLL_SYS.func.playerSetVotes(player, _) or false end _POLL_SYS.func.removeAllPlayersVote = function (poll) for _, cid in pairs(getOnlinePlayers()) do local cid = getPlayerByNameWildcard(cid) _POLL_SYS.func.removePlayerVote(cid, poll) end end _POLL_SYS.func.addVote = function (poll, option, player) local polls = _POLL_SYS.func.getPolls () for _, b in pairs(polls) do if (b[1]:lower() == poll:lower()) then print(UHU) for a, _ in pairs(b[2]) do if (a:lower() == option:lower()) then b[2][a] = _ + 1 _POLL_SYS.func.playerAddVote (player, poll) _POLL_SYS.func.setPolls (printTableSI(polls)) return true end end end end return false end _POLL_SYS.func.getPollHighestValue = function (poll) local value = "" local polls = _POLL_SYS.func.getPolls() for _, a in pairs(polls) do if (a[1]:lower() == poll:lower()) then for b, c in pairs(a[2]) do for _, d in pairs(a[2]) do if (_ ~= b) then if (c > d) then value = b end end end end end end return value end if not(InStalled) then local file = io.open("data/lib/PollSystem.lua", "r") local content = file:read("*all") local content, _ = content:gsub("In".. string.upper("s") .."talled = false", "InStalled = true") file:close() local file = io.open("data/lib/PollSystem.lua", "w+") file:write(content) file:close() return _POLL_SYS.func.install() end Abra a pasta talkactions, dentro da pasta scripts copie qualquer arquivo com extenção .lua, renomeie para PollMaX, abra com algum editor de texto, apague tudo que tiver dentro e cole o seguinte conteúdo: --[[ Poll System Author: Maxwell Denisson(MaXwEllDeN) Version: 1.0 ]] function onSay(cid, words, param) local funcs = {"add", "result", "finalize", "list", "vote"} local POLL = _POLL_SYS if not(POLL.on) then return false end local paramCHECK = param:lower() local param = param:lower() local params = string.explode(param, ";") local param = params[1] local helpE = "Max Poll System Help: \n \n * vote - serve para votar em uma enquete. \n" local helpE = helpE .." Exemplo de uso: " .. words .. " vote; enquete; opção " .. words .. " vote; Quem é o mais gato?; Maxwell\n" local helpE = helpE .."\n * list - lista as enquetes existentes. \n" local helpE = helpE .." Exemplo de uso: " .. words .. " list" if (getPlayerAccess(cid) >= 4) then helpE = helpE .. "\n\n * add - serve para adicionar uma enquete. \n Exemplo de uso: " .. words .. " add; Você votaria no sim?; {'Não', 'Sim'}\n" helpE = helpE .. "\nVocê votaria no sim? é a enquete, o que estiver dentro de {} são as opções, ATENÇÃO: TODAS OPÇÕES DEVEM SER FEITAS DENTRO DE \'\', E SEPARADAS POR VIRGULA!" helpE = helpE .. "\n\n * finalize - serve para finalizar uma enquete. \n Exemplo de uso: ".. words .. " finalize; Você votaria no sim?\n\nVocê votaria no sim é a enquete que você deseja finalizar." end if not(isInArray(funcs, param)) then return doShowTextDialog(cid, 1953, helpE) end if (param == "add") and (getPlayerAccess(cid) >= 4) then if not(params[3]) then return doShowTextDialog(cid, 1953, helpE) end local optionS = loadstring("return " .. params[3]:lower())() if (type(optionS) ~= "table") then return doShowTextDialog(cid, 1953, helpE) end local _, paramCHECK = paramCHECK:gsub(";", "a") if (paramCHECK > 2) then return doPlayerSendTextMessage(cid, 27, "Você não pode usar \";\" nas opções") end if not (optionS[2]) then return doPlayerSendTextMessage(cid, 27, "Sua enquete deve ter no mínimo 2 opções") end local Opt = {} for _, b in pairs(optionS) do Opt[b] = 0 end if (POLL.func.hasPoll(params[2])) then return doPlayerSendTextMessage(cid, 27, "Já existe uma enquete nomeada ".. params[2]) end POLL.func.addPoll(''..params[2]..'', Opt) doPlayerSendTextMessage(cid, 27, "A enquete ".. params[2] .." foi adicionada com as opções: ".. params[3]:lower() ..".") elseif (param == "finalize") and (getPlayerAccess(cid) >= 4) then if not (params[2]) then return doShowTextDialog(cid, 1953, helpE) end if not (POLL.func.hasPoll(params[2])) then return doPlayerSendTextMessage(cid, 27, "Não existe nenhum enquete no banco de dados nomeada ".. params[2] .. "!") end local HValue = POLL.func.getPollHighestValue(params[2]) if (HValue == "") then doBroadcastMessage("A enquete " .. params[2] .. " foi finalizada, sem opções vencedoras!") else doBroadcastMessage("A enquete " .. params[2] .. " foi finalizada, e a opção que recebeu mais votos foi: ".. HValue ..".") end doPlayerSendTextMessage(cid, 27, "A enquete ".. params[2] .." foi finalizada.") POLL.func.removePoll (params[2]) POLL.func.removeAllPlayersVote (params[2]) elseif (param == "list") then local polls = POLL.func.getPolls() local kizizim = 0 mszi = "MaX Poll System:\n\nEnquetes Ativas:\n" local function getPollsOptions(poll) local fukZz = "" for _, b in pairs(polls) do if (b[1] == poll:lower()) then for c, _ in pairs(b[2]) do fukZz = fukZz .. "\n " .. c end return fukZz end end end for a, b in pairs(polls) do kizizim = 1 mszi = mszi .. "\n * ".. b[1] .. getPollsOptions(b[1]) end mszi = mszi .. "\n~-~-~-~-~-~-~-~-~-~-~-~-~-" if (kizizim == 0) then return doPlayerSendTextMessage(cid, 27, "Não existe nenhuma enquete no momento!") end doShowTextDialog(cid, 1953, mszi) elseif (param == "vote") then if not (params[3]) then return doShowTextDialog(cid, 1953, helpE) end if not (POLL.func.hasPoll(params[2])) then return doPlayerSendTextMessage(cid, 27, "Não existe nenhum enquete nomeada \"".. params[2] .. "\"! Para ver a lista das enquetes disponíveis digite: ".. words .. " list") end if (POLL.func.hasPlayerVote(cid, params[2])) then return doPlayerSendTextMessage(cid, 27, "Você já votou nesta enquete.") end if not(POLL.func.hasPollOption(params[2], params[3])) then return doPlayerSendTextMessage(cid, 27, "A enquete ".. params[2] .. " não tem nenhuma opção nomeada ".. params[3] .. "! Para ver a lista das enquetes e suas opções disponíveis digite: ".. words .. " list") end POLL.func.addVote(params[2], params[3], cid) doPlayerSendTextMessage(cid, 27, "Obrigado por participar da enqute ".. params[2] .. ".") elseif (param == "result") then local polls = POLL.func.getPolls() local kizizim = 0 mszi = "MaX Poll System:\n\nResultado das enquetes:\n" local function getPollsOptions(poll) local fukZz = "" for _, b in pairs(polls) do if (b[1] == poll:lower()) then for c, d in pairs(b[2]) do fukZz = fukZz .. "\n " .. c .. " - ".. d .. " voto(s)." end return fukZz end end end for a, b in pairs(polls) do kizizim = 1 mszi = mszi .. "\n * ".. b[1] .. getPollsOptions(b[1]) end mszi = mszi .. "\n~-~-~-~-~-~-~-~-~-~-~-~-~" if (kizizim == 0) then return doPlayerSendTextMessage(cid, 27, "Não existe nenhuma enquete no momento!") end doShowTextDialog(cid, 1953, mszi) end return true end Depois instale as seguintes Tags: #Creatureevents.xml <event type="login" name="PollLogin" event="script" value="PollMax.lua"/> <!-- Poll System By MaXwEllDeN --> #Talkactions.xml <talkaction words="!polls" event="script" value="PollMax.lua"/> <!-- Poll System By MaXwEllDeN -->
Condiderações Finais
Faz tempo que eu fiz esse sistema, por isso pode conter vários bugs, quem encontrar faça o favor de reportar!