User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 7 of 8

Thread: ban announcer lua

  1. #1
    Member
    Join Date
    Sep 2016
    Posts
    21
    XP
    230
    Level
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    ban announcer lua

    I am looking for an LUA Mute,Kick,Ban announcer

  2. #2
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,433
    XP
    20,133,659
    Level
    500
    Thanks
    1,069
    Thanked 322 Times in 206 Posts
    cant you set announcements for those in the config file?
    I know kicked announcement has a config.

    but your thread lack the info/details .
    what do you want announced?
    who did the action?
    the action was for who?
    why the action?

    what do you want it to announce other than just `x got y'd by z.`
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  3. #3
    Original Poster
    Member
    Join Date
    Sep 2016
    Posts
    21
    XP
    230
    Level
    2
    Thanks
    0
    Thanked 1 Time in 1 Post
    Name is kicked by GM Name.Reason:
    Name is muted by GM Katharis for time.Reason:
    Name is banned by GM Name for time/Permanently.Reason:

    Something like that. Never seen this thing in the config

  4. #4
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,433
    XP
    20,133,659
    Level
    500
    Thanks
    1,069
    Thanked 322 Times in 206 Posts
    Now I have never worked with Mangos, CMangos, MangosZero or any Mangos version except TrinityCore (a spawn from of Mangos).
    For TrinityCore under Custom Server Settings you can find announce for Kick,Ban, and Mute:

    #
    # ShowKickInWorld
    # Description: Determines whether a message is broadcasted to the entire server when a
    # player gets kicked.
    # Default: 0 - (Disabled)
    # 1 - (Enabled)

    ShowKickInWorld = 0

    # ShowMuteInWorld
    # Description: Determines whether a message is broadcasted to the entire server when a
    # player gets muted.
    # Default: 0 - (Disabled)
    # 1 - (Enabled)

    ShowMuteInWorld = 0

    #
    # ShowBanInWorld
    # Description: Determines whether a message is broadcasted to the entire server when a
    # player gets banned.
    # Default: 0 - (Disabled)
    # 1 - (Enabled)

    ShowBanInWorld = 0
    let me check out the API .
    I didn't find any events for OnPlayerBanned, OnPlayerKicked, OnPlayerMuted. but I did get to thinking you could mod your core to do it possibly.

    in TrinityCore I would look at : \src\server\scripts\Commands\
    cs_ban.cpp
    cs_misc.cpp
    Last edited by slp13at420; 10-07-2016 at 12:37 PM.
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  5. #5
    Original Poster
    Member
    Join Date
    Sep 2016
    Posts
    21
    XP
    230
    Level
    2
    Thanks
    0
    Thanked 1 Time in 1 Post
    No there isnt this thing in config and no idea how to mod

  6. #6
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,433
    XP
    20,133,659
    Level
    500
    Thanks
    1,069
    Thanked 322 Times in 206 Posts
    again let me state that I have never worked with CMangos or Mangos of any type.

    I did do some poking around in the project files and did find :
    • \src\game\WorldSession.cpp :
      • Code:
        
        /// Kick a player out of the World
        void WorldSession::KickPlayer()
        {
            if (m_Socket)
                m_Socket->CloseSocket();
        }
    • \src\game\World.cpp :
      • Code:
        
        /// Ban an account or ban an IP address, duration_secs if it is positive used, otherwise permban
        BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_secs, std::string reason, const std::string& author)
        {
            LoginDatabase.escape_string(nameOrIP);
            LoginDatabase.escape_string(reason);
            std::string safe_author = author;
            LoginDatabase.escape_string(safe_author);
        
            QueryResult* resultAccounts = nullptr;                     // used for kicking
        
            ///- Update the database with ban information
            switch (mode)
            {
                case BAN_IP:
                    // No SQL injection as strings are escaped
                    resultAccounts = LoginDatabase.PQuery("SELECT id FROM account WHERE last_ip = '%s'", nameOrIP.c_str());
                    LoginDatabase.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+%u,'%s','%s')", nameOrIP.c_str(), duration_secs, safe_author.c_str(), reason.c_str());
                    break;
                case BAN_ACCOUNT:
                    // No SQL injection as string is escaped
                    resultAccounts = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", nameOrIP.c_str());
                    break;
                case BAN_CHARACTER:
                    // No SQL injection as string is escaped
                    resultAccounts = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", nameOrIP.c_str());
                    break;
                default:
                    return BAN_SYNTAX_ERROR;
            }
        
            if (!resultAccounts)
            {
                if (mode == BAN_IP)
                    return BAN_SUCCESS;                             // ip correctly banned but nobody affected (yet)
                else
                    return BAN_NOTFOUND;                            // Nobody to ban
            }
        
            ///- Disconnect all affected players (for IP it can be several)
            do
            {
                Field* fieldsAccount = resultAccounts->Fetch();
                uint32 account = fieldsAccount->GetUInt32();
        
                if (mode != BAN_IP)
                {
                    // No SQL injection as strings are escaped
                    LoginDatabase.PExecute("INSERT INTO account_banned VALUES ('%u', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+%u, '%s', '%s', '1')",
                                           account, duration_secs, safe_author.c_str(), reason.c_str());
                }
        
                if (WorldSession* sess = FindSession(account))
                    if (std::string(sess->GetPlayerName()) != author)
                        sess->KickPlayer();
            }
            while (resultAccounts->NextRow());
        
            delete resultAccounts;
            return BAN_SUCCESS;
        } 


    You could add a couple lines to do a World Announcement in these 2 functions:
    Code:
    
    /// Sends a server message to the specified or all players
    void World::SendServerMessage(ServerMessageType type, const char* text /*=""*/, Player* player /*= nullptr*/)
    
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  7. #7
    Original Poster
    Member
    Join Date
    Sep 2016
    Posts
    21
    XP
    230
    Level
    2
    Thanks
    0
    Thanked 1 Time in 1 Post
    Can u tell me what exactly i should do. I am new in core development

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •