Thread Tools Display Modes
01-16-12, 08:18 AM   #1
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Kick Addon [Help]

friends,

I have an addon created by me, which verifies that users are more than 30 days without logging in and kicks those.

I'd like to add the following, if the member is in a certain rank (example: Away (rank 3)) even though it is more than 30 days without logging in, will not be kicked.

In other words, skip the verification tenque rank 3 and rank that does not exclude players, someone help me?
  Reply With Quote
01-16-12, 08:43 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
ehh take a look at the 3rd return value of GetGuildRosterInfo, and otherwise show us your code
  Reply With Quote
01-16-12, 09:26 AM   #3
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
The code of my addon and this...
Code:
function KickOldFromGuild(actuallyKick)
   if not CanGuildRemove() and actuallyKick then
       return
   end
   for i=1,GetNumGuildMembers() do
       local y,m,d=GetGuildRosterLastOnline(i)
       if y then
           if y>0 or m>0 or d>29 then
               if actuallyKick then
                   GuildUninvite(GetGuildRosterInfo(i))
               else
                   print(string.format("Would kick %s, y: %d, m: %d, d: %d", GetGuildRosterInfo(i), y, m, d))
               end
           end
       end
   end
end

Last edited by Caetan0 : 01-16-12 at 09:45 PM.
  Reply With Quote
01-16-12, 07:57 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
1. Please use [code] tags around your code, so it is displayed in a monospace font, and indentation is preserved.

2. One of the return values from GetGuildRosterInfo is the guild rank.
lua Code:
  1. function KickOldFromGuild(actuallyKick)
  2.     if actuallyKick and not CanGuildRemove() then
  3.         return
  4.     end
  5.     for i = 1, GetNumGuildMembers() do
  6.         local name, _, rank = GetGuildRosterInfo(i)
  7.         if rank ~= 3 then
  8.             local y, m, d = GetGuildRosterLastOnline(i)
  9.             if (y or 0) > 0 or (m or 0) > 0 or (d or 0) > 29 then
  10.                 if actuallyKick then
  11.                     GuildUninvite(name)
  12.                 else
  13.                     print(string.format("Would kick %s, offline %dy %dm %dd.", name, y, m, d))
  14.                 end
  15.             end
  16.         end
  17.     end
  18. end
  Reply With Quote
01-16-12, 09:45 PM   #5
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
thank you my friend, but now is working perfectly.

Sorry for posting incorrect, this is the first time I have used this forum.

Thank you again.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Kick Addon [Help]


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off