viewing paste Unknown #19038 | C#

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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#include <stdio.h>
#include <string.h>
#include "../common/HPMi.h"
#include "../map/script.h"
#include "../map/pc.h"
#include "../map/clif.h"
#include "../common/HPMDataCheck.h"
 
HPExport struct hplugin_info pinfo = {
    "dispbottom2",      // Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "1.0",          // Plugin version
    HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)
};
 
/*==========================================
 * Coloured DispBottom [By Dastgir]
 *------------------------------------------*/
BUILDIN(dispbottom2)
{
    TBL_PC *sd=script_rid2sd(st);
    const char *message;
    unsigned long color;
    message=script_getstr(st,3);
    color=strtoul(script_getstr(st,2),NULL,0);
    if(sd)
        clif_colormes_e(sd,color,message);
    return 0;
}
 
// [By Dastgir]
int clif_colormes_e(struct map_session_data * sd,unsigned long color1, const char* msg) {
    
    unsigned short msg_len = strlen(msg) + 1;
    WFIFOHEAD(sd->fd,msg_len + 12);
    WFIFOW(sd->fd,0) = 0x2C1;
    WFIFOW(sd->fd,2) = msg_len + 12;
    WFIFOL(sd->fd,4) = 0;
    WFIFOL(sd->fd,8) = (color1&0x0000FF) << 16 | (color1&0x00FF00) | (color1&0xFF0000) >> 16; // RGB -> BGR
    safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);
    clif_send(WFIFOP(sd->fd,0), WFIFOW(sd->fd,2), &sd->bl, SELF);
 
 
    return 0;
}
 
 
/* Server Startup */
HPExport void plugin_init (void)
{
    clif = GET_SYMBOL("clif");
    script = GET_SYMBOL("script");
    pc = GET_SYMBOL("pc");
    
    addScriptCommand("dispbottom2","s?",dispbottom2);
}
 
/* run when server is ready (online) */
HPExport void server_online (void) {
    ShowInfo("Dispbottom2 plugin is loaded.");
}
Viewed 613 times, submitted by Guest.