viewing paste gmimpersonate | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#include "common/hercules.h"
#include "common/memmgr.h"
#include "common/mmo.h"
#include "common/socket.h"
#include "common/strlib.h"
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../map/pc.h"
#include "../map/clif.h"
#include "../common/HPMi.h"
 
#include "plugins/HPMHooking.h"
#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)
 
HPExport struct hplugin_info pinfo = {  
    "gmimpersonate",    // Plugin name  
    SERVER_TYPE_MAP,// Which server types this plugin works with?   
    "0.1",          // Plugin version   
    HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)
};
 
bool clif_process_whisper_message_post(bool retVal___, struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen)
{
    if (retVal___ == true) {
        char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3;
        normalize_name( message, "255xA0032tx0Ax0D " );
        if ( stristr( message, "x20x3Ax20" ) || stristr( message, "x20x3Bx20" ) ) { // type " : " OR " ; " will be blocked
            clif->messagecolor_self( sd->fd, COLOR_RED, "You can't impersonate other players !" );
            return false;
        }
    }
    return true;
}
 
HPExport void plugin_init (void) {
    addHookPost(clif, process_whisper_message, clif_process_whisper_message_post);
}
Viewed 826 times, submitted by wakoko231.