Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Licensed under GNU GPL see LICENSE file
- // balarm atcommand
- #include <stdio.h>
- #include <string.h>
- #include "../common/HPMi.h"
- #include "../map/script.h"
- #include "../map/pc.h"
- HPExport struct hplugin_info pinfo = {
- "Broadcast Alarm", // 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)
- };
- /***
- * @balarm <color> <type> <sound_file> <output> [Pan]
- ***/
- ACMD(balarm)
- {
- int color = 0;
- int type = 0;
- char sound_file[100];
- char atcmd_output[256];
- memset(atcmd_output, '\0', sizeof(atcmd_output));
- memset(sound_file, '\0', sizeof(sound_file));
- if(!message || !*message
- || (sscanf(message, "%u %u %99s %199s",&color, &type, sound_file, atcmd_output) < 4)
- || type > SELF )
- {
- clif->message(fd,"<color> <type 0-global 1- local> <sound_file> <atcmd output>");
- return false;
- }
- if(color >0xFFFFFF)
- {
- clif->message(fd, msg_txt(982)); // Invalid color
- return false;
- }
- if(strstr(sound_file, ".wav") == NULL)
- strcat(sound_file, ".wav");
- // @see clif.h send_target for more types
- // ALL_CLIENT - 0 -> Global
- // ALL_SAMEMAP - 1 -> Local
- clif->soundeffectall(&sd->bl, sound_file, 0, (send_target)type);
- clif->broadcast2(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0, (send_target)type);
- return true;
- }
- // Main hook
- HPExport void plugin_init (void)
- {
- clif = GET_SYMBOL("clif");
- addAtcommand("balarm", balarm);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement