• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lottery System configuration ;)

Status
Not open for further replies.
Code:
  local config =
{
        lottery_hour = "24 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
        points = 15, -- how many points winner get?
        website = "yes" -- Do you have `lottery` table in your database?
}

function onTimer()
        local players, random, name = getOnlinePlayers(), math.random(1, table.maxn(getOnlinePlayers())), players[random]
       
        db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. config.points .. " WHERE `id` = " .. getAccountIdByName(name) .. ";")
        doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. name .. ", Reward: +" .. config.points .. " points to the SMS Shop! Congratulations! (Next Lottery in " .. config.lottery_hour ..")")
        if(config.website == "yes") then
                db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. name .."', '".. config.points .." premium points');")
        end
        return true
end

W tym zmieniłem na takie:
Code:
  local config =
{
        lottery_hour = "24 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
        points = 15, -- how many points winner get?
        website = "yes" -- Do you have `lottery` table in your database?
}

function onTimer()
        local players, random, name = getPlayersOnline(), math.random(1, table.maxn(getPlayersOnline())), players[random]
       
        db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. config.points .. " WHERE `id` = " .. getAccountIdByName(name) .. ";")
        doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. name .. ", Reward: +" .. config.points .. " points to the SMS Shop! Congratulations! (Next Lottery in " .. config.lottery_hour ..")")
        if(config.website == "yes") then
                db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. name .."', '".. config.points .." premium points');")
        end
        return true
end

Lecz dalej wyskakuje błąd:
hlp.png
 
Nie mam pojęcia dlaczego w timer to dajecie?

Tu powinno być OK, wklej to do GLOBALEVENTS!

Lua:
-- by vDk
-- With premium points by Samme.
local config = {
    lottery_hour = "3 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    points = 15, -- how many points winner get?
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onThink(interval, lastExecution)
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
                db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `name` = ".. getAccountByName(winner) ..";")
                doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(winner) ..', Reward: +' .. config.points ..' points to the SMS Shop! Congratulations! (Next Lottery in '.. config.lottery_hour ..')')
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. config.points .." premium points');")
                end
    return true
end
 
Samme chyba nie przeczytałeś postów up, ale zmieniłem z funkcji onThink na onTimer i działa! Kurwa działa!
Wszyscy którzy się zaangażowali w pomoc, dostają repuciki. ;)
Dzięki ludziska!

No dobra, wszystko fajnie lecz jest błąd xD
Mianowicie chodzi o to, że system wyświetla że wygrał tam ktoś i dostaje 15pkt. Na stronie też to jest, lecz gracz nie dostaje premium pointsow :/.
For this item you need 20 points. You have only 0 premium points. Please select other item or buy premium points.
Proszę o pomoc.
pozdro Boomer.
 
Last edited by a moderator:
A weź spróbuj tak, i zobacz czy zwraca nazwę konta gracza. (W broadcast będzie).

Lua:
-- by vDk
-- With premium points by Samme.
local config = {
    lottery_hour = "3 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    points = 15, -- how many points winner get?
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onThink(interval, lastExecution)
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
                db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `name` = ".. getAccountByName(winner) ..";")
                doBroadcastMessage('[LOTTERY SYSTEM] Account: '.. getAccountByName(winner) ..' Winner: '.. getCreatureName(winner) ..', Reward: +' .. config.points ..' points to the SMS Shop! Congratulations! (Next Lottery in '.. config.lottery_hour ..')')
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. config.points .." premium points');")
                end
    return true
end
 
Dalej nie działa... To samo, nie dodaje pkt. do sms shopa.

Taki bład w konsoli:
help66.png
 
Last edited:
Proszę.

Lua:
-- by vDk
-- With premium points by Samme.
local config = {
    lottery_hour = "3 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    points = 15, -- how many points winner get?
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onTimer()
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
                db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `name` = ".. getAccountByName(getCreatureName(winner)) ..";")
                doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(winner) ..', Reward: +' .. config.points ..' points to the SMS Shop! Congratulations! (Next Lottery in '.. config.lottery_hour ..')')
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. config.points .." premium points');")
                end
    return true
end
 
Dalej nie dostaje się pkt. do sms shopa.
Teraz inny bład w konsoli:
beztytulu71.png
 
Po chuj bawisz się tym paintem? Nikt Cię nie zhackuje. Weź daj cały error bo kurwa teraz nie wiem co za "unknown column" -.-...
 
Ok, jak by coś, to numer do konta to: nr, a hasło to: pass.
help43.png
 
Jestem noobem ale spróbuj tak:
Lua:
  -- by vDk
-- With premium points by Samme.
local config = {
    lottery_hour = "3 Hours", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    points = 15, -- how many points winner get?
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onTimer()
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
                db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `name` = '".. getAccountByName(getCreatureName(winner)) .."';")
                doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(winner) ..', Reward: +' .. config.points ..' points to the SMS Shop! Congratulations! (Next Lottery in '.. config.lottery_hour ..')')
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. config.points .." premium points');")
                end
    return true
end
 
Ciekawe ile ston jeszcze bedziecie sie z tym meczyc :p
 
Czy przypadkiem "getAccountByName()" nie zwraca "id" konta? ;)
 
Hahahaha! vDk i noob, żal!
Kocham cię!
Działa xD
Dziękóweczka ;p

A mam takie pytanie jeszcze co do tego skryptu, czy można zrobić tak że w loteri biorą tylko dane osoby które były chociaż 1godzinę online w ciągu jednego dnia? Albo na innej zasadzie, że tylko tych ludzi losuje maszyna którzy mają dany storagevalue?
A jak się da, to zrobiłby ktoś taką modyfikację? xD
Pozdr Boomer.
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top