求高手融合下这2个插件。
本帖最后由 homework 于 2010-11-12 13:19 编辑一个是color_radio 另一个是descriptive_fire_in_the_hole 希望能融合在一起,2个插件其实功能上可以融合成一个,这样就更方便使用了,谢谢,还要感谢插件的原作者。
color_radio.sma#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "color radio"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "UnKnow"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_message(get_user_msgid("TextMsg"),"color_radio")
}
public color_radio(msgid, msgDest, msgEnt){
new argNum = get_msg_args()
if (argNum!=5) return PLUGIN_CONTINUE
if (get_msg_argtype(1)!=ARG_BYTE) return PLUGIN_CONTINUE
new arg1=get_msg_arg_int(1)
if (arg1!=5) return PLUGIN_CONTINUE
new arg3
get_msg_arg_string(3,arg3,255)
if(equal(arg3,"#Game_radio")){
new arg4,arg5
get_msg_arg_string(4,arg4,32)
get_msg_arg_string(5,arg5,128)
new saymsg
if(equal(arg5,"#Go_go_go")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队开始行动!",arg4)
}
else if(equal(arg5,"#Stick_together_team")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队靠拢,准备行动!",arg4)
}
else if(equal(arg5,"#Team_fall_back")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队撤退!",arg4)
}
else if(equal(arg5,"#Cover_me")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 掩护我!",arg4)
}
else if(equal(arg5,"#You_take_the_point")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 你去控制该地区!",arg4)
}
else if(equal(arg5,"#Hold_this_position")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 各小组保持现在阵型!",arg4)
}
else if(equal(arg5,"#Regroup_team")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 重新组队!",arg4)
}
else if(equal(arg5,"#Follow_me")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 跟着我!",arg4)
}
else if(equal(arg5,"#Taking_fire")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 敌方火力凶猛,需要支援!",arg4)
}
else if(equal(arg5,"#Get_in_position_and_wait")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队就位,等我冲出去时掩护我!",arg4)
}
else if(equal(arg5,"#Storm_the_front")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队正面快速突击!",arg4)
}
else if(equal(arg5,"#Report_in_team")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 全队报告目前状况!",arg4)
}
else if(equal(arg5,"#Affirmative")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 收到!",arg4)
}
else if(equal(arg5,"#Roger_that")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 明白!",arg4)
}
else if(equal(arg5,"#Enemy_spotted")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 发现敌人!",arg4)
}
else if(equal(arg5,"#Need_backup")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 需要支援!",arg4)
}
else if(equal(arg5,"#Sector_clear")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 该地区安全!",arg4)
}
else if(equal(arg5,"#In_position")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 我已经就位!",arg4)
}
else if(equal(arg5,"#Reporting_in")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 报告!",arg4)
}
else if(equal(arg5,"#Get_out_of_there")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 马上离开此区域,炸弹马上爆炸!",arg4)
}
else if(equal(arg5,"#Negative")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 无法做到!",arg4)
}
else if(equal(arg5,"#Enemy_down")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 已经消灭敌人!",arg4)
}
else if(equal(arg5,"#Hostage_down")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 人质死亡!",arg4)
}
else if(equal(arg5,"#Fire_in_the_hole")){
format(saymsg,255,"^x03%s ^x01@ ^x04(无线电)^x01 小心手雷!",arg4)
}
else {
return PLUGIN_CONTINUE
}
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, msgEnt)
write_byte(msgEnt)
write_string(saymsg)
message_end()
client_print(msgEnt, print_console,saymsg);
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
} descriptive_fire_in_the_hole.sma/* AMX Mod X
* Descriptive 'Fire in the hole!'
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
* DESCRIPTION
* Plugin provides additional colored text for "Fire in the hole!" radio chat message.
* The color and the text is different for each grenade type and can be altered.
* This will help teammates to get the throwed grenade type and act accordingly.
* Search for "EDITABLE" mark in the plugin's source code to configure text and color.
*
* CREDITS
* Damaged Soul - colored chat text method
* p3tsin - team color override method
*/
#include <amxmodx>
#define PLUGIN_NAME "Descriptive 'Fire in the hole!'"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"
enum grenade {
GRENADE_HE,
GRENADE_FLASH,
GRENADE_SMOKE
}
// EDITABLE: grenade description
new const g_grenade_description[] = {
" 【手榴弹】",
" 【闪光弹】",
" 【烟雾弹】"
}
enum color {
COLOR_NORMAL,
COLOR_RED,
COLOR_BLUE,
COLOR_GRAY,
COLOR_GREEN
}
// EDITABLE: grenade description text color
new const g_grenade_desccolor = {
COLOR_RED,
COLOR_GRAY,
COLOR_GREEN
}
new const g_grenade_weaponid = {
CSW_HEGRENADE,
CSW_FLASHBANG,
CSW_SMOKEGRENADE
}
#define COLORCODE_NORMAL 0x01
#define COLORCODE_TEAM 0x03
#define COLORCODE_LOCATION 0x04
new const g_color_code = {
COLORCODE_NORMAL,
COLORCODE_TEAM,
COLORCODE_TEAM,
COLORCODE_TEAM,
COLORCODE_LOCATION
}
new const g_color_teamname[] = {
"",
"TERRORIST",
"CT",
"SPECTATOR",
""
}
#define RADIOTEXT_MSGARG_NUMBER 5
enum radiotext_msgarg {
RADIOTEXT_MSGARG_PRINTDEST = 1,
RADIOTEXT_MSGARG_CALLERID,
RADIOTEXT_MSGARG_TEXTTYPE,
RADIOTEXT_MSGARG_CALLERNAME,
RADIOTEXT_MSGARG_RADIOTYPE,
}
new const g_required_radiotype[] = "#Fire_in_the_hole"
new const g_radiotext_template[] = "%s [对讲机]: 投了一颗!"
new g_msgid_saytext
new g_msgid_teaminfo
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_message(get_user_msgid("TextMsg"), "message_text")
g_msgid_saytext = get_user_msgid("SayText")
g_msgid_teaminfo = get_user_msgid("TeamInfo")
}
public message_text(msgid, dest, id) {
if (get_msg_args() != RADIOTEXT_MSGARG_NUMBER || get_msg_argtype(RADIOTEXT_MSGARG_RADIOTYPE) != ARG_STRING)
return PLUGIN_CONTINUE
static arg
get_msg_arg_string(RADIOTEXT_MSGARG_RADIOTYPE, arg, sizeof arg - 1)
if (!equal(arg, g_required_radiotype))
return PLUGIN_CONTINUE
get_msg_arg_string(RADIOTEXT_MSGARG_CALLERID, arg, sizeof arg - 1)
new caller = str_to_num(arg)
if (!is_user_alive(caller))
return PLUGIN_CONTINUE
new clip, ammo, weapon
weapon = get_user_weapon(caller, clip, ammo)
for (new i; i < sizeof g_grenade_weaponid; ++i) {
if (g_grenade_weaponid == weapon) {
static text
new pos = 0
text = g_color_code
get_msg_arg_string(RADIOTEXT_MSGARG_CALLERNAME, arg, sizeof arg - 1)
pos += formatex(text, sizeof text - pos - 1, g_radiotext_template, arg)
copy(text[++pos], sizeof text - pos - 1, g_grenade_description)
new desccolor = g_grenade_desccolor
if ((text[--pos] = g_color_code) == COLORCODE_TEAM) {
static teamname
get_user_team(id, teamname, sizeof teamname - 1)
if (!equal(teamname, g_color_teamname)) {
msg_teaminfo(id, g_color_teamname)
msg_saytext(id, text)
msg_teaminfo(id, teamname)
return PLUGIN_HANDLED
}
}
msg_saytext(id, text)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
msg_teaminfo(id, teamname[]) {
message_begin(MSG_ONE, g_msgid_teaminfo, _, id)
write_byte(id)
write_string(teamname)
message_end()
}
msg_saytext(id, text[]) {
message_begin(MSG_ONE, g_msgid_saytext, _, id)
write_byte(id)
write_string(text)
message_end()
}
本帖最后由 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个插件同时开启的效果:
页:
[1]