em lib/050-function adiciona:
function getGuildPoints(cid)
local check = db.getResult("SELECT `points` FROM `guilds` WHERE `id` = " .. getPlayerGuildId(cid) .. ";")
return check:getDataInt("points") <= 0 and 0 or check:getDataInt("points") end
function addGuildPoints(cid,amount)
db.executeQuery("UPDATE `guilds` SET `points` = "..getGuildPoints(cid).."+"..amount.." WHERE `guilds`.`id` = "..getPlayerGuildId(cid)) end
function removeGuildPoints(cid,amount)
db.executeQuery("UPDATE `guilds` SET `points` = "..getGuildPoints(cid).."-"..amount.." WHERE `guilds`.`id` = "..getPlayerGuildId(cid)) end
function setGuildPoints(cid,value)
db.executeQuery("UPDATE `guilds` SET `points` = "..value.." WHERE `guilds`.`id` = "..getPlayerGuildId(cid))end
points_guild.lua
function onSay(cid, words, param)
local t = {
[0] = {150,10},
[1] = {200,20},
[2] = {250,25}
}
if getPlayerGuildId(cid) and getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then
local count = 0
for k, v in pairs(t) do
if getGuildPoints(cid) == k then
local lista = db.getResult("SELECT `name`, `rank_id` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. getGuildId(getPlayerGuildName(cid)) .. ");")
if(lista:getID() ~= -1) then
repeat
if getPlayerLevel(getPlayerByName(lista:getDataString("name"))) >= v[1] then
count = count + 1
end
until not lista:next()
if count >= v[2] then
addGuildPoints(cid,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens,sua guild ganhou um ponto por possuir "..count.." Players level "..v[1].." ou mais.")
doBroadcastMessage("a Guild ".. getPlayerGuildName(cid) .." acabou de receber um ponto por possuir "..count.." Players level "..v[1].." ou mais")
return true
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild precisa de "..v[2].." players level "..v[1].." ou mais")
return true
end
lista:free()
end
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "você precisa ser lider de uma guild")
end
return true
end
premium points seria os pontos do site que compra os itens do site!