HI i have one afk system and using this storage 38417
look:
now i need config my lottery script for detect afk players
look my lottrey script:
how do I get the code does not list the AFK players!!!
i reep ++ for help plxxx i need so much!!!
sry my bad inglish!
look:
Code:
local time = 3 -- Seconds
local say_events = {}
local function SayText(cid)
if isPlayer(cid) == TRUE then
if say_events[getPlayerGUID(cid)] ~= nil then
if isPlayer(cid) == TRUE then
doSendAnimatedText(getPlayerPosition(cid),"AFK!", math.random(25,35))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
end
end
return TRUE
end
local storage = 38417
function onSay(cid, words, param, channel)
local afkCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Requer parametro de comando on/off.")
return TRUE
end
if (param == "on") then
if (afkCheck == -1) then
if (isPlayer(cid) == TRUE) then
doSendAnimatedText(getPlayerPosition(cid),"AFK!", math.random(25,35))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você acaba de entrar em modo AFK.")
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ja esta em modo AFK.")
end
elseif (param == "off") then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você não esta em modo AFK!")
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
end
return TRUE
end
now i need config my lottery script for detect afk players
look my lottrey script:
Code:
-- Lottery System
local config = {
lottery_hour = "2 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message)
rewards_id = {2160}, -- ID dos Itens Sorteados na Loteria
crystal_counts = 10, -- 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(cid ,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 == 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] 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.query("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');")
end
return true
end
how do I get the code does not list the AFK players!!!
i reep ++ for help plxxx i need so much!!!
sry my bad inglish!