viewing paste bcstaff | 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
//================= Hercules Plugin =================
//= @bcstaff
//==== Autor: =======================================
//= GallaZ
//==== Version: =====================================
//= 1.0
//===================================================
#include <stdio.h>
#include <string.h>
#include "../common/HPMi.h"
#include "../map/script.h"
#include "../map/pc.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 = {
        "bcstaff",              // 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)
};
 
// @bcstaff <0-global 1-local> <message>
ACMD(bcstaff){
        int type = 0;
        char atcmd_output[256];
        char smsg[256];
        memset(atcmd_output, '\0', sizeof(atcmd_output));
        memset(smsg, '\0', sizeof(smsg));
       
        if(!message || !*message || (sscanf(message, "%u %199[^\n]",&type, atcmd_output) < 2) || type > 1 || type < 0) {
                clif->message(fd, "@bcstaff <0-global 1-local> <message>");
                return false;
        }
       
        switch(type) {
                case 0:
                        sprintf(smsg, "[Staff]: %s", atcmd_output);
                        clif->broadcast2(&sd->bl, smsg, strlen(smsg) + 1, 0xCCFF00, 0x190, 12, 0, 0, (send_target)type);
                        break;
                case 1:
                        sprintf(smsg, "[Staff]: %s", atcmd_output);
                        clif->broadcast2(&sd->bl, smsg, strlen(smsg) + 1, 0x00CCFF, 0x190, 12, 0, 0, (send_target)type);
                        break;;
                default:
                        break;
        }
       
        return true;
}
 
HPExport void plugin_init (void) {
        clif = GET_SYMBOL("clif");
       
        addAtcommand("bcstaff",bcstaff);
}
Viewed 361 times, submitted by GallaZ.