Galera eu tenho instalado no meu server GuildShop system esta tudo certo porem a hora que o player executa o comando !guildpoints ele não recebe os points recebe uma mensagem assim 0 Players received points, ja testei varios scripts e o unico que não da erro na distro é este porem não entrega os points oque pode ser?
GuildPointsConfigs =
{
ExecuteIntervalHours = 24,
NeedPlayersOnline = 10,
NeedDiferentIps = 6,
MinLevel = 80,
AddPointsForAcc = 15
}
function getGuildPlayersValidAccIDS(GuildID, MinLevel)
local RanksIDS, AccsID, ValidAccsID = {}, {}, {}
local q = db.storeQuery("SELECT `id` FROM `guild_ranks` WHERE guild_id = '".. GuildID .."';")
if q then
return ValidAccsID
end
while true do
table.insert(RanksIDS, result.getDataInt(q, "id"))
if not result.next(q) then
break
end
end
local q = db.storeQuery("SELECT `account_id` FROM `players` WHERE `rank_id` IN (".. table.concat(RanksIDS, ', ') ..") AND `level` >= ".. MinLevel ..";")
if q then
return ValidAccsID
end
while true do
local AccID = result.getDataInt(q, "account_id")
if #AccsID > 0 then
for k = 1, #AccsID do
if AccID == AccsID[k] then
AddAccList = false
break
end
AddAccList = true
end
if AddAccList then
table.insert(AccsID, AccID)
end
else
table.insert(AccsID, AccID)
end
if not result.next(q) then
break
end
end
local q = db.storeQuery("SELECT `id` FROM `accounts` WHERE `guild_points_stats` = 0 AND `id` IN (".. table.concat(AccsID, ', ') ..");")
if q then
return ValidAccsID
end
while true do
local AccID = result.getDataInt(q, "id")
if #ValidAccsID > 0 then
for k = 1, #ValidAccsID do
if AccID == ValidAccsID[k] then
AddAccList = false
break
end
AddAccList = true
end
if AddAccList then
table.insert(ValidAccsID, AccID)
end
else
table.insert(ValidAccsID, AccID)
end
if not result.next(q) then
break
end
end
return ValidAccsID
end
function onSay(cid, words, param, channel)
if(getPlayerGuildLevel(cid) == 3) then
local GuildID = getPlayerGuildId(cid)
local q = db.storeQuery("SELECT `last_execute_points` FROM `guilds` WHERE id = '".. GuildID .."';")
if not q then
return true
end
if result.getDataInt(q, "last_execute_points") < os.time() then
local GuildMembers = {}
local GuildMembersOnline = {}
local PlayersOnline = getPlayersOnline()
for i, pid in ipairs(PlayersOnline) do
if getPlayerGuildId(pid) == GuildID then
if getPlayerLevel(pid) >= GuildPointsConfigs.MinLevel then
table.insert(GuildMembersOnline, pid)
end
end
end
if #GuildMembersOnline >= GuildPointsConfigs.NeedPlayersOnline then
local IPS = {}
for i, pid in ipairs(GuildMembersOnline) do
local PlayerIP = getPlayerIp(pid)
if #IPS > 0 then
for k = 1, #IPS do
if PlayerIP == IPS[k] then
AddIPList = false
break
end
AddIPList = true
end
if AddIPList then
table.insert(IPS, PlayerIP)
end
else
table.insert(IPS, PlayerIP)
end
end
if #IPS >= GuildPointsConfigs.NeedDiferentIps then
local ValidAccounts = getGuildPlayersValidAccIDS(GuildID, GuildPointsConfigs.MinLevel)
db.query("UPDATE `guilds` SET `last_execute_points` = ".. os.time() +(GuildPointsConfigs.ExecuteIntervalHours * 3600) .." WHERE `guilds`.`id` = ".. GuildID ..";")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "".. #ValidAccounts .." Players received points")
if #ValidAccounts > 0 then
db.query("UPDATE `accounts` SET `guild_points` = `guild_points` + " ..GuildPointsConfigs.AddPointsForAcc .. ", `guild_points_stats` = ".. os.time() .." WHERE `id` IN (" .. table.concat(ValidAccounts, ',') ..");")
for i, pid in ipairs(GuildMembersOnline) do
local PlayerMSGAccID = getPlayerAccountId(pid)
for k = 1, #ValidAccounts do
if PlayerMSGAccID == ValidAccounts[k] then
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "You received "..GuildPointsConfigs.AddPointsForAcc .." guild points.")
break
end
end
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only ".. #IPS .." players are valid, you need ".. GuildPointsConfigs.NeedDiferentIps .." players with different ips.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Has only ".. #GuildMembersOnline .." players online you need ".. GuildPointsConfigs.NeedPlayersOnline .." players online at least from level ".. GuildPointsConfigs.MinLevel ..".")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The command can only be run once every "..GuildPointsConfigs.ExecuteIntervalHours .." hours.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.")
end
return true
end