Advertisement
Guest User

bAlarm 1.1 by pan

a guest
Dec 27th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.54 KB | None | 0 0
  1. // Licensed under GNU GPL see LICENSE file
  2. // @balarm by Pan version 1.1
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include "../common/HPMi.h"
  7. #include "../map/script.h"
  8. #include "../map/pc.h"
  9.  
  10. HPExport struct hplugin_info pinfo = {
  11.     "Broadcast Alarm",      // Plugin name
  12.     SERVER_TYPE_MAP,        // Which server types this plugin works with?
  13.     "1.1",                  // Plugin version
  14.     HPM_VERSION,            // HPM Version (don't change, macro is automatically updated)
  15. };
  16.  
  17. /***
  18.  * @balarm <color> <type> <sound_file> <output> [Pan]
  19.  ***/
  20. ACMD(balarm)
  21. {
  22.     int color = 0;
  23.     int type = 0;
  24.     char sound_file[100];
  25.     char atcmd_output[305];
  26.     memset(atcmd_output, '\0', sizeof(atcmd_output));
  27.     memset(sound_file, '\0', sizeof(sound_file));
  28.  
  29.     if(!message || !*message
  30.         || (sscanf(message, "%u %u %99s %199[^\n]s",&color, &type, sound_file, atcmd_output) < 4)
  31.         || type > SELF )
  32.     {
  33.         clif->message(fd,"<color> <type 0-global 1- local> <sound_file> <atcmd output>");
  34.         return false;
  35.     }
  36.  
  37.     if(color >0xFFFFFF)
  38.     {
  39.             clif->message(fd, msg_txt(982)); // Invalid color
  40.             return false;
  41.     }
  42.  
  43.     if(strstr(sound_file, ".wav") == NULL)
  44.             strcat(sound_file, ".wav");
  45.     // @see clif.h send_target for more types
  46.     // ALL_CLIENT   - 0 -> Global
  47.     // ALL_SAMEMAP  - 1 -> Local
  48.     clif->soundeffectall(&sd->bl, sound_file, 0, (send_target)type);
  49.     clif->broadcast2(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0, (send_target)type);
  50.  
  51.     return true;
  52. }
  53.  
  54. // Main hook
  55. HPExport void plugin_init (void)
  56. {
  57.     clif = GET_SYMBOL("clif");
  58.     addAtcommand("balarm", balarm);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement