dawnking
Member
- Joined
- Jun 23, 2016
- Messages
- 176
- Reaction score
- 22
I found a topic with this script here with this same problem, but abandoned
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?
exp_guild_login.lua
exp_guild_logout.lua
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?
Code:
<event type="login" name="ExpGuild" event="script" value="exp_guild_login.lua"/>
<event type="logout" name="ExpGuild_out" event="script" value="exp_guild_logout.lua"/>
exp_guild_login.lua
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
exp_guild_logout.lua
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 onLogout(cid)
local guild_id = getPlayerGuildId(cid)
local membros_online = table.maxn(getGuildMembersOnline(guild_id))
local tabela_membros = getGuildMembersOnline(guild_id)
local porcentagem = 1
local minimo = 1
-----------------------------------------
if guild_id >= 1 then
for var = 1, #tabela_membros do
local nomes = getCreatureByName(tabela_membros[var])
local membros_online = membros_online - 1
if membros_online <= minimo then
doPlayerSetExperienceRate(nomes, 1.0)
doPlayerSendTextMessage(nomes, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] No longer does the number of players needed to earn bonus experience - Member "..getCreatureName(cid).." left.")
end
if membros_online > minimo then
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] Experience from guild members has been adjusted to "..membros_online*porcentagem.."% - Member "..getCreatureName(cid).." left.")
end
end
end
return true
end