搜索
查看: 2252|回复: 2

求高手融合下这2个插件。

[复制链接]
发表于 2010-11-12 13:17:47 | 显示全部楼层 |阅读模式 来自 中国–四川–成都
本帖最后由 homework 于 2010-11-12 13:19 编辑

一个是color_radio 另一个是descriptive_fire_in_the_hole 希望能融合在一起,2个插件其实功能上可以融合成一个,这样就更方便使用了,谢谢,还要感谢插件的原作者。
color_radio.sma
  1. #include <amxmodx>
  2. #include <amxmisc>

  3. #define PLUGIN_NAME        "color radio"
  4. #define PLUGIN_VERSION        "1.0"
  5. #define PLUGIN_AUTHOR        "UnKnow"


  6. public plugin_init()
  7. {
  8.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  9.         register_message(get_user_msgid("TextMsg"),"color_radio")
  10. }

  11. public color_radio(msgid, msgDest, msgEnt){
  12.         new argNum = get_msg_args()
  13.         if (argNum!=5) return PLUGIN_CONTINUE
  14.         if (get_msg_argtype(1)!=ARG_BYTE) return PLUGIN_CONTINUE
  15.         new arg1=get_msg_arg_int(1)
  16.         if (arg1!=5) return PLUGIN_CONTINUE
  17.         new arg3[256]
  18.         get_msg_arg_string(3,arg3,255)
  19.         if(equal(arg3,"#Game_radio")){
  20.                 new arg4[33],arg5[129]
  21.                 get_msg_arg_string(4,arg4,32)
  22.                 get_msg_arg_string(5,arg5,128)
  23.                 new saymsg[256]
  24.                 if(equal(arg5,"#Go_go_go")){
  25.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队开始行动!",arg4)
  26.                 }
  27.                 else if(equal(arg5,"#Stick_together_team")){
  28.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队靠拢,准备行动!",arg4)
  29.                 }
  30.                 else if(equal(arg5,"#Team_fall_back")){
  31.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队撤退!",arg4)
  32.                 }
  33.                 else if(equal(arg5,"#Cover_me")){
  34.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 掩护我!",arg4)
  35.                 }
  36.                 else if(equal(arg5,"#You_take_the_point")){
  37.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 你去控制该地区!",arg4)
  38.                 }
  39.                 else if(equal(arg5,"#Hold_this_position")){
  40.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 各小组保持现在阵型!",arg4)
  41.                 }
  42.                 else if(equal(arg5,"#Regroup_team")){
  43.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 重新组队!",arg4)
  44.                 }
  45.                 else if(equal(arg5,"#Follow_me")){
  46.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 跟着我!",arg4)
  47.                 }
  48.                 else if(equal(arg5,"#Taking_fire")){
  49.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 敌方火力凶猛,需要支援!",arg4)
  50.                 }
  51.                 else if(equal(arg5,"#Get_in_position_and_wait")){
  52.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队就位,等我冲出去时掩护我!",arg4)
  53.                 }
  54.                 else if(equal(arg5,"#Storm_the_front")){
  55.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队正面快速突击!",arg4)
  56.                 }
  57.                 else if(equal(arg5,"#Report_in_team")){
  58.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队报告目前状况!",arg4)
  59.                 }
  60.                 else if(equal(arg5,"#Affirmative")){
  61.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 收到!",arg4)
  62.                 }
  63.                 else if(equal(arg5,"#Roger_that")){
  64.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 明白!",arg4)
  65.                 }
  66.                 else if(equal(arg5,"#Enemy_spotted")){
  67.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 发现敌人!",arg4)
  68.                 }
  69.                 else if(equal(arg5,"#Need_backup")){
  70.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 需要支援!",arg4)
  71.                 }
  72.                 else if(equal(arg5,"#Sector_clear")){
  73.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 该地区安全!",arg4)
  74.                 }
  75.                 else if(equal(arg5,"#In_position")){
  76.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 我已经就位!",arg4)
  77.                 }
  78.                 else if(equal(arg5,"#Reporting_in")){
  79.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 报告!",arg4)
  80.                 }
  81.                 else if(equal(arg5,"#Get_out_of_there")){
  82.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 马上离开此区域,炸弹马上爆炸!",arg4)
  83.                 }
  84.                 else if(equal(arg5,"#Negative")){
  85.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 无法做到!",arg4)
  86.                 }
  87.                 else if(equal(arg5,"#Enemy_down")){
  88.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 已经消灭敌人!",arg4)
  89.                 }
  90.                 else if(equal(arg5,"#Hostage_down")){
  91.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 人质死亡!",arg4)
  92.                 }
  93.                 else if(equal(arg5,"#Fire_in_the_hole")){
  94.                         format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 小心手雷!",arg4)
  95.                 }
  96.                 else {
  97.                         return PLUGIN_CONTINUE
  98.                 }
  99.                 message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, msgEnt)
  100.                 write_byte(msgEnt)
  101.                 write_string(saymsg)
  102.                 message_end()
  103.                 client_print(msgEnt, print_console,saymsg);
  104.                 return PLUGIN_HANDLED
  105.         }
  106.         return PLUGIN_CONTINUE
  107. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2010-11-12 13:18:51 | 显示全部楼层 来自 中国–四川–成都
descriptive_fire_in_the_hole.sma
  1. /* AMX Mod X
  2. *   Descriptive 'Fire in the hole!'
  3. *
  4. * (c) Copyright 2006 by VEN
  5. *
  6. * This file is provided as is (no warranties)
  7. *
  8. *     DESCRIPTION
  9. *       Plugin provides additional colored text for "Fire in the hole!" radio chat message.
  10. *       The color and the text is different for each grenade type and can be altered.
  11. *       This will help teammates to get the throwed grenade type and act accordingly.
  12. *       Search for "EDITABLE" mark in the plugin's source code to configure text and color.
  13. *
  14. *     CREDITS
  15. *       Damaged Soul - colored chat text method
  16. *       p3tsin - team color override method
  17. */

  18. #include <amxmodx>

  19. #define PLUGIN_NAME "Descriptive 'Fire in the hole!'"
  20. #define PLUGIN_VERSION "0.1"
  21. #define PLUGIN_AUTHOR "VEN"

  22. enum grenade {
  23.         GRENADE_HE,
  24.         GRENADE_FLASH,
  25.         GRENADE_SMOKE
  26. }

  27. // EDITABLE: grenade description
  28. new const g_grenade_description[_:grenade][] = {
  29.         " 【手榴弹】",
  30.         " 【闪光弹】",
  31.         " 【烟雾弹】"
  32. }

  33. enum color {
  34.         COLOR_NORMAL,
  35.         COLOR_RED,
  36.         COLOR_BLUE,
  37.         COLOR_GRAY,
  38.         COLOR_GREEN
  39. }

  40. // EDITABLE: grenade description text color
  41. new const g_grenade_desccolor[_:grenade] = {
  42.         COLOR_RED,
  43.         COLOR_GRAY,
  44.         COLOR_GREEN
  45. }

  46. new const g_grenade_weaponid[_:grenade] = {
  47.         CSW_HEGRENADE,
  48.         CSW_FLASHBANG,
  49.         CSW_SMOKEGRENADE
  50. }

  51. #define COLORCODE_NORMAL 0x01
  52. #define COLORCODE_TEAM 0x03
  53. #define COLORCODE_LOCATION 0x04

  54. new const g_color_code[_:color] = {
  55.         COLORCODE_NORMAL,
  56.         COLORCODE_TEAM,
  57.         COLORCODE_TEAM,
  58.         COLORCODE_TEAM,
  59.         COLORCODE_LOCATION
  60. }

  61. new const g_color_teamname[_:color][] = {
  62.         "",
  63.         "TERRORIST",
  64.         "CT",
  65.         "SPECTATOR",
  66.         ""
  67. }

  68. #define RADIOTEXT_MSGARG_NUMBER 5

  69. enum radiotext_msgarg {
  70.         RADIOTEXT_MSGARG_PRINTDEST = 1,
  71.         RADIOTEXT_MSGARG_CALLERID,
  72.         RADIOTEXT_MSGARG_TEXTTYPE,
  73.         RADIOTEXT_MSGARG_CALLERNAME,
  74.         RADIOTEXT_MSGARG_RADIOTYPE,
  75. }

  76. new const g_required_radiotype[] = "#Fire_in_the_hole"
  77. new const g_radiotext_template[] = "%s [对讲机]: 投了一颗!"

  78. new g_msgid_saytext
  79. new g_msgid_teaminfo

  80. public plugin_init() {
  81.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

  82.         register_message(get_user_msgid("TextMsg"), "message_text")

  83.         g_msgid_saytext = get_user_msgid("SayText")
  84.         g_msgid_teaminfo = get_user_msgid("TeamInfo")
  85. }

  86. public message_text(msgid, dest, id) {
  87.         if (get_msg_args() != RADIOTEXT_MSGARG_NUMBER || get_msg_argtype(RADIOTEXT_MSGARG_RADIOTYPE) != ARG_STRING)
  88.                 return PLUGIN_CONTINUE

  89.         static arg[32]
  90.         get_msg_arg_string(RADIOTEXT_MSGARG_RADIOTYPE, arg, sizeof arg - 1)
  91.         if (!equal(arg, g_required_radiotype))
  92.                 return PLUGIN_CONTINUE

  93.         get_msg_arg_string(RADIOTEXT_MSGARG_CALLERID, arg, sizeof arg - 1)
  94.         new caller = str_to_num(arg)
  95.         if (!is_user_alive(caller))
  96.                 return PLUGIN_CONTINUE

  97.         new clip, ammo, weapon
  98.         weapon = get_user_weapon(caller, clip, ammo)
  99.         for (new i; i < sizeof g_grenade_weaponid; ++i) {
  100.                 if (g_grenade_weaponid[i] == weapon) {
  101.                         static text[192]
  102.                         new pos = 0
  103.                         text[pos++] = g_color_code[COLOR_NORMAL]

  104.                         get_msg_arg_string(RADIOTEXT_MSGARG_CALLERNAME, arg, sizeof arg - 1)
  105.                         pos += formatex(text[pos], sizeof text - pos - 1, g_radiotext_template, arg)
  106.                         copy(text[++pos], sizeof text - pos - 1, g_grenade_description[i])

  107.                         new desccolor = g_grenade_desccolor[i]
  108.                         if ((text[--pos] = g_color_code[desccolor]) == COLORCODE_TEAM) {
  109.                                 static teamname[12]
  110.                                 get_user_team(id, teamname, sizeof teamname - 1)

  111.                                 if (!equal(teamname, g_color_teamname[desccolor])) {
  112.                                         msg_teaminfo(id, g_color_teamname[desccolor])
  113.                                         msg_saytext(id, text)
  114.                                         msg_teaminfo(id, teamname)

  115.                                         return PLUGIN_HANDLED
  116.                                 }
  117.                         }

  118.                         msg_saytext(id, text)

  119.                         return PLUGIN_HANDLED
  120.                 }
  121.         }

  122.         return PLUGIN_CONTINUE
  123. }

  124. msg_teaminfo(id, teamname[]) {
  125.         message_begin(MSG_ONE, g_msgid_teaminfo, _, id)
  126.         write_byte(id)
  127.         write_string(teamname)
  128.         message_end()
  129. }

  130. msg_saytext(id, text[]) {
  131.         message_begin(MSG_ONE, g_msgid_saytext, _, id)
  132.         write_byte(id)
  133.         write_string(text)
  134.         message_end()
  135. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2010-11-12 13:39:05 | 显示全部楼层 来自 中国–四川–成都
本帖最后由 homework 于 2010-11-12 13:45 编辑

color_radio
功能特点:
丢炸弹发对讲机的时候 玩家 名字是根据所在队伍显示的 CT为蓝 T为红。
缺点:
丢炸弹只显示丢一颗炸弹,不显示丢的什么炸弹,比如闪光 炸弹 烟雾。

descriptive_fire_in_the_hole
功能特点:
丢炸弹会显示玩家丢的什么类型的炸弹出来, 闪光 烟雾 炸弹
缺点:
对讲机显示没有玩家名字颜色。

融合建议:
如果把Color_radio的丢炸弹显示改造成descriptive_fire_in_the_hole的丢炸弹显示功能,这2个插件就可以完美融合在一起,这样就具有2个插件的亮点,就更方便使用了。

呵呵,本人的一点小小建议,希望高手能帮忙实现,不胜感激,。

2个插件同时开启的效果:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表