willdu
Active Member
- Joined
- Mar 11, 2017
- Messages
- 91
- Reaction score
- 25
I found this script to encourage players to make guilds, invite their friends, makers and get a bonus
But what is happen: Some players create their own guild invite 10 mc's and let this 10 mc's open to get bonus alone...
Anybody know a way to if have more then 3 characters on the same IP stop to count?
But what is happen: Some players create their own guild invite 10 mc's and let this 10 mc's open to get bonus alone...
Anybody know a way to if have more then 3 characters on the same IP stop to count?
Code:
function getGuildMembersOnline(GuildId)
local players = {}
for _, pid in pairs(getPlayersOnline()) do
if getPlayerGuildId(pid) == tonumber(GuildId) then
table.insert(players, getPlayerName(pid))
end
end
return #players > 0 and players or false
end
function onLogin(cid)
local guild_id = getPlayerGuildId(cid)
local minimo = 1
local max = 10
local porcentagem = 1
-----------------------------------------
doPlayerSetExperienceRate(cid, 1)
if guild_id <= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] Join a guild to have experience bonus.")
return true
end
if guild_id > 0 then
local membros_online = table.maxn(getGuildMembersOnline(guild_id))
local tabela_membros = getGuildMembersOnline(guild_id)
if membros_online <= minimo then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online guild.\nGuild of Players Online ["..membros_online.."]")
return true
end
if membros_online > minimo then
for var = 1, #tabela_membros do
local nomes = getCreatureByName(tabela_membros[var])
local XP = (membros_online <= 10) and (membros_online / 100) + 1.00 or (10/100) + 1.00
doPlayerSetExperienceRate(nomes, XP)
doPlayerSendTextMessage(nomes, MESSAGE_STATUS_CONSOLE_RED, "[GUILD] The experience of the guild members was increased to +"..membros_online*porcentagem.."% - Member "..getCreatureName(cid).." joined.")
end
return true
end
end
end