• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Limit 3 IPs for this script

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?

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
 
Any progress @dawnking ?
No :(

Now is logging script is almost working, just this problems:
When 4 player login on the same IP for him show:
Code:
[GUILD] To get bonus experience must be over 1 players online guild.
Guild of Players Online [1]

And do not show nothing to the others members...

Could you help to give a warning, exp still 3x because of limit of 3 IPs, for him and all others players from the guild ?

And when it logout show this message to the others:
Code:
11:05 [GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
11:05 [GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
11:06 [GUILD] Experience from guild members has been adjusted to 3% - Member Royal Paladin left.
11:06 [GUILD] Experience from guild members has been adjusted to 3% - Member Royal Paladin left.

bump
 
Now is logging script is almost working, just this problems:
When 4 player login on the same IP for him show:
Code:
[GUILD] To get bonus experience must be over 1 players online guild.
Guild of Players Online [1]

And do not show nothing to the others members...

Could you help to give a warning, exp still 3x because of limit of 3 IPs, for him and all others players from the guild ?

And when it logout show this message to the others:
Code:
11:05 [GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
11:05 [GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
11:06 [GUILD] Experience from guild members has been adjusted to 3% - Member Royal Paladin left.
11:06 [GUILD] Experience from guild members has been adjusted to 3% - Member Royal Paladin left.
You want this: if in guild will be more player with the same IP than 3, sctipt wont give higher exp stage to ppls in guild. Script wont send any message to other players in guild cause it knows that someone want to abuse your system.
login:
Lua:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.\nCurrently online in your guild is ".. table.maxn(getGuildMembersOnline(guild_id)) .." members ["..membros_online.." with original IP].")
       elseif 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
       end
   end
   return true
end
logout:
Lua:
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
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end  
       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
 
You want this: if in guild will be more player with the same IP than 3, sctipt wont give higher exp stage to ppls in guild. Script wont send any message to other players in guild cause it knows that someone want to abuse your system.
login:
Lua:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.\nCurrently online in your guild is ".. table.maxn(getGuildMembersOnline(guild_id)) .." members ["..membros_online.." with original IP].")
       elseif 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
       end
   end
   return true
end
logout:
Lua:
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
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end 
       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

Thank you man! I thought you guys forgotten this...

Hey man thank you so much to trying to help me...
Srry to this too late, i trough u was not here anymore...

So i used your script as a base...
Made some changes:
Code:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.")
       elseif membros_online > minimo then
          if count >= maxlimit_sameIP then
             membros_online = membros_online - count
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] You have reached the IP limit ("..maxlimit_sameIP..") of accounts to win the bonus.")
          end
          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
       end
   end
   return true
end

And it's printing on chat showing this:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +1% - Member Royal Paladin joined.

And i want to show:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +3% - Member Royal Paladin joined.

I mean, if you have 10 players on same IP still on 3%, not reset

Thanks to report this, i didn't saw this!
Is anybody know how to fix?

bump

bump

bump

bump

bump

Hey man thank you so much to trying to help me...
Srry to this too late, i trough u was not here anymore...

So i used your script as a base...
Made some changes:
Code:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.")
       elseif membros_online > minimo then
          if count >= maxlimit_sameIP then
             membros_online = membros_online - count
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] You have reached the IP limit ("..maxlimit_sameIP..") of accounts to win the bonus.")
          end
          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
       end
   end
   return true
end

And it's printing on chat showing this:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +1% - Member Royal Paladin joined.

And i want to show:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +3% - Member Royal Paladin joined.

I mean, if you have 10 players on same IP still on 3%, not reset


bump
 
Last edited by a moderator:
You want this: if in guild will be more player with the same IP than 3, sctipt wont give higher exp stage to ppls in guild. Script wont send any message to other players in guild cause it knows that someone want to abuse your system.
login:
Lua:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.\nCurrently online in your guild is ".. table.maxn(getGuildMembersOnline(guild_id)) .." members ["..membros_online.." with original IP].")
       elseif 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
       end
   end
   return true
end
logout:
Lua:
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
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if count >= maxlimit_sameIP then
           membros_online = membros_online - count
       end 
       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


Hey man thank you so much to trying to help me...
Srry to this too late, i trough u was not here anymore...

So i used your script as a base...
Made some changes:
Code:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.")
       elseif membros_online > minimo then
          if count >= maxlimit_sameIP then
             membros_online = membros_online - count
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] You have reached the IP limit ("..maxlimit_sameIP..") of accounts to win the bonus.")
          end
          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
       end
   end
   return true
end

And it's printing on chat showing this:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +1% - Member Royal Paladin joined.

And i want to show:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +3% - Member Royal Paladin joined.

I mean, if you have 10 players on same IP still on 3%, not reset

Hey man thank you so much to trying to help me...
Srry to this too late, i trough u was not here anymore...

So i used your script as a base...
Made some changes:
Code:
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.")
   elseif guild_id > 0 then
       local membros_online = table.maxn(getGuildMembersOnline(guild_id))
       local tabela_membros = getGuildMembersOnline(guild_id)
       local maxlimit_sameIP = 3
       local ips, count = {}, 0
       for _, pid in pairs(getPlayersOnline()) do
           if getPlayerGuildId(pid) == guild_id then
               table.insert(ips, getPlayerIp(pid))
           end
       end
       if #ips > 1 then
           table.sort(ips)
           for i = 1, #ips do
               if ips[i] == ips[i + 1] then
                   count = count + 1
               end
           end
       end
       if membros_online <= minimo then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] To get bonus experience must be over "..minimo.." players online with unique IP in your guild.")
       elseif membros_online > minimo then
          if count >= maxlimit_sameIP then
             membros_online = membros_online - count
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] You have reached the IP limit ("..maxlimit_sameIP..") of accounts to win the bonus.")
          end
          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
       end
   end
   return true
end

And it's printing on chat showing this:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +1% - Member Royal Paladin joined.

And i want to show:
Code:
[GUILD] To get bonus experience must be over 1 players online with unique IP in your guild.
[GUILD] The experience of the guild members was increased to +2% - Member Elite Knight joined.
[GUILD] The experience of the guild members was increased to +3% - Member Master Sorcerer joined.
[GUILD] The experience of the guild members was increased to +3% - Member Royal Paladin joined.

I mean, if you have 10 players on same IP still on 3%, not reset


bump

bump

bump
 
Last edited by a moderator:
Back
Top