[SCRIPT] Глобальный чат

Тема в разделе "COEP", создана пользователем root, 1 окт 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    GlobalShout.cpp
    Код:
    #include "GlobalShout.h" void GlobalShout::HandleShout(User* pUser, WCHAR* msg) 
    { 
        typedef void (*User__Shout)(User* pUser, WCHAR* msg); 
        static User__Shout Shout = (User__Shout)0x818A30; 
    
    
        if(Config::GlobalShout) //if global shout is enabled, broadcast to all users 
        { 
            WCHAR* username = new WCHAR[32]; memset(username, 0, 64); 
            WCHAR* message = new WCHAR[512]; memset(message, 0, 1024); 
    
    
            wcsncpy(username, pUser->SD->wszName, wcslen(pUser->SD->wszName)); 
            wcsncpy(message, msg, wcslen(msg));         
    
    
            CSPacket Packet; Packet.set(2048); 
            Packet << (BYTE)0x4A; 
            Packet << (INT32)pUser->nObjectID; 
            Packet << (INT32)1; 
            Packet << username; 
            Packet << message; 
            L2ServerFunctions::BroadcastToAllUser(&Packet); 
    
    
            delete username; 
            delete message; 
        } 
        else //if global shout is disabled, call original function 
        { 
            Shout(pUser, msg); 
        } 
    } 
    
    
    void GlobalShout::Install() 
    { 
        WriteInstruction(0x886C52, (INT32)GlobalShout::HandleShout, 0, 0xE8); 
    
    }
    GlobalShout.h
    Код:
    #pragma once #include "Global.h" 
    
    
    class GlobalShout 
    { 
    public: 
        static void Install(); 
        static void HandleShout(User* pUser, WCHAR* msg); 
    };