Postado Maio 14, 2016 9 anos Seu sistema de TV é por database, tente assim: -- Lottery System By Jeff local config = { lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "no", -- Only if you have php scripts and table `lottery` in your database! storage = 165132, -- storage do cast system do seu servidor. } function onThink(interval, lastExecution) local casting = db.executeQuery("SELECT `broadcasting` FROM `players` WHERE `id` = " ..getPlayerGUID(cid)) if casting == 1 then 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 == 2160) 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] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?") 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 end return true end Editado Maio 14, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Maio 14, 2016 9 anos Autor [Error - GlobalEvent Interface] data/globalevents/scripts/lottery.lua:onThink Description: data/globalevents/scripts/lottery.lua:12: attempt to concatenate a boolean value stack traceback: data/globalevents/scripts/lottery.lua:12: in function <data/globalevents/scripts/lottery.lua:11> [Error - GlobalEvents::think] Couldn't execute event: Lottery Corrigi um erro na linha 6 e 7 que era a virgula... Mandar a virgula da 7 pra 6 ae fecho, mas na hr de executar o system da este erro...
Postado Maio 14, 2016 9 anos -- Lottery System By Jeff local config = { lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "no" -- 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(getCastsOnline()) 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 == 2160) 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] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?") 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
Postado Maio 14, 2016 9 anos Editei o comentário com a correção, tente novamente. Editado Maio 14, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Maio 14, 2016 9 anos Autor 30 minutos atrás, Talesigorvr disse: Seu sistema de TV é por database, tente assim: -- Lottery System By Jeff local config = { lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "no", -- Only if you have php scripts and table `lottery` in your database! storage = 165132, -- storage do cast system do seu servidor. } function onThink(interval, lastExecution) local casting = db.executeQuery("SELECT `broadcasting` FROM `players` WHERE `id` = '" ..getPlayerGUID(cid).."');") if casting == 1 then 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 == 2160) 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] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?") 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 end return true end [Error - GlobalEvent Interface] data/globalevents/scripts/lottery.lua:onThink Description: (internalGetPlayerInfo) Player not found when requesting player info #18 [Error - GlobalEvent Interface] data/globalevents/scripts/lottery.lua:onThink Description: data/globalevents/scripts/lottery.lua:12: attempt to concatenate a boolean value stack traceback: data/globalevents/scripts/lottery.lua:12: in function <data/globalevents/scripts/lottery.lua:11> [Error - GlobalEvents::think] Couldn't execute event: Lottery 10 minutos atrás, MaTTch disse: -- Lottery System By Jeff local config = { lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160). website = "no" -- 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(getCastsOnline()) 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 == 2160) 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] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?") 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 [Error - GlobalEvent Interface] data/globalevents/scripts/lottery.lua:onThink Description: data/globalevents/scripts/lottery.lua:16: attempt to call global 'getCastsOnline' (a nil value) stack traceback: data/globalevents/scripts/lottery.lua:16: in function <data/globalevents/scripts/lottery.lua:10> [Error - GlobalEvents::think] Couldn't execute event: Lottery
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.