bastiago 1 Postado Julho 19, 2011 Share Postado Julho 19, 2011 Bom dia xtibianos ! Estou com um script de lottery e gostaria que a lottery sortiasse qualquer item, como, por exemplo, MPA, MMS, 200k, 500k e etc .. Segue o script: -- Lottery System local config = { lottery_hour = "4 Hour", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160}, -- ID dos Itens Sorteados na Loteria crystal_counts = 20, -- Usado somente se a rewards_id for crystal coin (ID: 12620). website = "yes" -- Only if you have php scripts and table `lottery` in your database! } function onThink(interval, lastExecution) if(getWorldCreatures(0) == 0)then return true end local list = {} for i, tid in ipairs(getPlayersOnline()) do list[i] = tid end local winner = list[math.random(1, #list)] local random_item = config.rewards_id[math.random(1, #config.rewards_id)] if(random_item == 12620) then doPlayerAddItem(winner, random_item, config.crystal_counts) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") else doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") doPlayerAddItem(winner, random_item, 1) end if(config.website == "yes") then db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');") end return true end Obrigado. Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/ Compartilhar em outros sites More sharing options...
GuuhTorres 114 Postado Julho 19, 2011 Share Postado Julho 19, 2011 Já ganhou meu REP :button_ok: ,valew PS: Me ajudou muito. Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1068610 Compartilhar em outros sites More sharing options...
bastiago 1 Postado Julho 19, 2011 Autor Share Postado Julho 19, 2011 Não sei como ajudei '-' , mas fico feliz de ajudar Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1068628 Compartilhar em outros sites More sharing options...
GuuhTorres 114 Postado Julho 20, 2011 Share Postado Julho 20, 2011 Me ajudou passando o script Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1069798 Compartilhar em outros sites More sharing options...
bastiago 1 Postado Julho 25, 2011 Autor Share Postado Julho 25, 2011 Desculpe pelo flood. Estou desde à 6 dias esperando resposta e nada '-' Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1073249 Compartilhar em outros sites More sharing options...
bastiago 1 Postado Julho 31, 2011 Autor Share Postado Julho 31, 2011 (editado) Ta difícil -.- ' Editado Julho 31, 2011 por ADM Dark Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1077178 Compartilhar em outros sites More sharing options...
Mulizeu 86 Postado Julho 31, 2011 Share Postado Julho 31, 2011 Testa ae amigo Aki no caso eu fiz para ele sorte Ou mms ou mpa ou entao 200k! se nao funfa avisa -- Lottery System local config = { lottery_hour = "4 Hour", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160},{3366},{3414}, -- ID dos Itens Sorteados na Loteria crystal_counts = 20, -- Usado somente se a rewards_id for crystal coin (ID: 12620). website = "yes" -- Only if you have php scripts and table `lottery` in your database! } function onThink(interval, lastExecution) if(getWorldCreatures(0) == 0)then return true end local list = {} for i, tid in ipairs(getPlayersOnline()) do list[i] = tid end local winner = list[math.random(1, #list)] local random_item = config.rewards_id[math.random(1, #config.rewards_id)] if(random_item == 12620) then doPlayerAddItem(winner, random_item, config.crystal_counts) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") else doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") doPlayerAddItem(winner, random_item, 1) end if(config.website == "yes") then db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');") end return true end Se ajudei Rep++ Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1077355 Compartilhar em outros sites More sharing options...
bastiago 1 Postado Agosto 11, 2011 Autor Share Postado Agosto 11, 2011 Amigo eu agradeço, mas o que eu queria é que sortiasse dentre dos os itens e se caso fosse dinheiro a quantidade variava entre 200k~500k Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1083252 Compartilhar em outros sites More sharing options...
Mulizeu 86 Postado Agosto 11, 2011 Share Postado Agosto 11, 2011 Testa ae agr ele vai alem de poder ganhar os itens o dinheiro vai varear de 200k a 500k -- Edited By Mulizeu local config = { lottery_hour = "4 Hour", rewards_id = {2160},{3366},{3414}, crystal_counts = 20 or 50, website = "yes" } function onThink(interval, lastExecution) if(getWorldCreatures(0) == 0)then return true end local list = {} for i, tid in ipairs(getPlayersOnline()) do list[i] = tid end local winner = list[math.random(1, #list)] local random_item = config.rewards_id[math.random(1, #config.rewards_id)] if(random_item == 12620) then doPlayerAddItem(winner, random_item, config.crystal_counts) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") else doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")") doPlayerAddItem(winner, random_item, 1) end if(config.website == "yes") then db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');") end return true end Link para o comentário https://xtibia.com/forum/topic/162125-globalevents-lottery/#findComment-1083370 Compartilhar em outros sites More sharing options...
Posts Recomendados