Ir para conteúdo
  • 0

GUILD POINT'S


Luquinh4

Pergunta

Eu tenho um sistema aqui de guild points,mas eu não sei configurar

 

 

Olha ele ai

 

 

local playersNeeded = 8
local ipsNeeded = 6
local minimumLevel = 50
local storageId = 41578
local pointsForPlayer = 20

local function sendPlayersList(cid, list)
for i, pid in ipairs(list) do
local level = getPlayerLevel(pid) < minimumLevel and " - " .. getPlayerLevel(cid) .. " level " or ""
local valid = getCreatureStorage(pid, storageId) > 1 and " - already received!" or ""
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. level)
end
end

function onSay(cid, words, param, channel)
if(getPlayerGuildLevel(cid) == 3) then
local leaderGuild = getPlayerGuildId(cid)
local players = getPlayersOnline()
local guildMembersValid = {}
local guildMembersInvalid = {}
for i, pid in ipairs(players) do
if(leaderGuild == getPlayerGuildId(pid)) then
if(getPlayerLevel(pid) >= minimumLevel and tonumber(getCreatureStorage(pid, storageId)) < 2) then
table.insert(guildMembersValid, pid)
else
table.insert(guildMembersInvalid, pid)
end
end
end

if(#guildMembersValid >= playersNeeded) then
local IPs = {}
for i, pid in ipairs(guildMembersValid) do
local ip = getPlayerIp(pid)
if(IPs[ip] == nil) then
IPs[ip] = ip
end
end
if(#IPs >= ipsNeeded) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that received points:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that did not receive points:")
sendPlayersList(cid, guildMembersInvalid)
local accounts = {}
for i, pid in ipairs(guildMembersValid) do
table.insert(accounts, getPlayerAccountId(pid))
doCreatureSetStorage(pid, storageId, os.time())
end
db.executeQuery("UPDATE `accounts` SET `guild_points` = `guild_points`+" .. pointsForPlayer .. " WHERE `id` IN (" .. table.concat(accounts, ',') .. ");")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid (" .. playersNeeded .. " required), but you have together only " .. #IPs .. " IPs (" .. ipsNeeded .. " required)")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")
sendPlayersList(cid, guildMembersInvalid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid, " .. playersNeeded .. " required. Minimum level required is " .. minimumLevel)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")
sendPlayersList(cid, guildMembersInvalid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.")
end
return true
end

 

 

Queria saber como por para ganhar os pontos só quando tiver 10 player on na guild, e aceitar apenas 2 mc's

Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Tenta:

 

 

local playersNeeded = 10

local ipsNeeded = 2

local minimumLevel = 50

local storageId = 41578

local pointsForPlayer = 20

local function sendPlayersList(cid, list)

for i, pid in ipairs(list) do

local level = getPlayerLevel(pid) < minimumLevel and " - " .. getPlayerLevel(cid) .. " level " or ""

local valid = getCreatureStorage(pid, storageId) > 1 and " - already received!" or ""

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. level)

end

end

function onSay(cid, words, param, channel)

if(getPlayerGuildLevel(cid) == 3) then

local leaderGuild = getPlayerGuildId(cid)

local players = getPlayersOnline()

local guildMembersValid = {}

local guildMembersInvalid = {}

for i, pid in ipairs(players) do

if(leaderGuild == getPlayerGuildId(pid)) then

if(getPlayerLevel(pid) >= minimumLevel and tonumber(getCreatureStorage(pid, storageId)) < 2) then

table.insert(guildMembersValid, pid)

else

table.insert(guildMembersInvalid, pid)

end

end

end

if(#guildMembersValid >= playersNeeded) then

local IPs = {}

for i, pid in ipairs(guildMembersValid) do

local ip = getPlayerIp(pid)

if(IPs[ip] == nil) then

IPs[ip] = ip

end

end

if(#IPs >= ipsNeeded) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that received points:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that did not receive points:")

sendPlayersList(cid, guildMembersInvalid)

local accounts = {}

for i, pid in ipairs(guildMembersValid) do

table.insert(accounts, getPlayerAccountId(pid))

doCreatureSetStorage(pid, storageId, os.time())

end

db.executeQuery("UPDATE `accounts` SET `guild_points` = `guild_points`+" .. pointsForPlayer .. " WHERE `id` IN (" .. table.concat(accounts, ',') .. ");")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid (" .. playersNeeded .. " required), but you have together only " .. #IPs .. " IPs (" .. ipsNeeded .. " required)")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")

sendPlayersList(cid, guildMembersInvalid)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid, " .. playersNeeded .. " required. Minimum level required is " .. minimumLevel)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")

sendPlayersList(cid, guildMembersInvalid)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.")

end

return true

end

 

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta:

 

 

local playersNeeded = 10

local ipsNeeded = 2

local minimumLevel = 50

local storageId = 41578

local pointsForPlayer = 20

local function sendPlayersList(cid, list)

for i, pid in ipairs(list) do

local level = getPlayerLevel(pid) < minimumLevel and " - " .. getPlayerLevel(cid) .. " level " or ""

local valid = getCreatureStorage(pid, storageId) > 1 and " - already received!" or ""

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. level)

end

end

function onSay(cid, words, param, channel)

if(getPlayerGuildLevel(cid) == 3) then

local leaderGuild = getPlayerGuildId(cid)

local players = getPlayersOnline()

local guildMembersValid = {}

local guildMembersInvalid = {}

for i, pid in ipairs(players) do

if(leaderGuild == getPlayerGuildId(pid)) then

if(getPlayerLevel(pid) >= minimumLevel and tonumber(getCreatureStorage(pid, storageId)) < 2) then

table.insert(guildMembersValid, pid)

else

table.insert(guildMembersInvalid, pid)

end

end

end

if(#guildMembersValid >= playersNeeded) then

local IPs = {}

for i, pid in ipairs(guildMembersValid) do

local ip = getPlayerIp(pid)

if(IPs[ip] == nil) then

IPs[ip] = ip

end

end

if(#IPs >= ipsNeeded) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that received points:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that did not receive points:")

sendPlayersList(cid, guildMembersInvalid)

local accounts = {}

for i, pid in ipairs(guildMembersValid) do

table.insert(accounts, getPlayerAccountId(pid))

doCreatureSetStorage(pid, storageId, os.time())

end

db.executeQuery("UPDATE `accounts` SET `guild_points` = `guild_points`+" .. pointsForPlayer .. " WHERE `id` IN (" .. table.concat(accounts, ',') .. ");")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid (" .. playersNeeded .. " required), but you have together only " .. #IPs .. " IPs (" .. ipsNeeded .. " required)")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")

sendPlayersList(cid, guildMembersInvalid)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid, " .. playersNeeded .. " required. Minimum level required is " .. minimumLevel)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")

sendPlayersList(cid, guildMembersValid)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")

sendPlayersList(cid, guildMembersInvalid)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.")

end

return true

end

 

Tipo, vai ser dificil eu testa porque to editano o ot ainda, mas pelo que eu saiba..

 

Mas você tem certeza que dá?

Link para o comentário
Compartilhar em outros sites

  • 0

Duvida sanada

reportado

Tópico movido para pedidos e dúvidas resolvidos.

 

Quando é o SkyLigh que faz esse tipo de comment você não fala/faz nada né? Mas quando é com o ThiagoBjiW você já vem querer reclamar, só reclama com o ThiagoBjiW porque ele é membro? Por favor, o skyligh só ta de estagiário desse fórum por que tem membros nesse forum, logo ele é um membro como qualquer outro aqui..

Editado por Gears
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...