搜索
查看: 5735|回复: 19

已有client_print,怎么添加设置hudmessage

[复制链接]
发表于 2007-12-8 19:16:57 | 显示全部楼层 |阅读模式 来自 中国–江苏–南京
现在已有的插件可以现实在CHAT的位置 想添加一个HUD显示 怎么添加
如果能写个帖子说明使用方法 可以方便大家修改插件
代码如下(注: HUD只显示在自己队友这1方,对方看不到)

public CheckMoney(id){
new
Players[32], Name[50], Num, Team
;
Team = get_user_team( id
);
get_players( Players, Num, "a"
)
for ( new
i = 0; i < Num; i
++ ){
if(
get_user_team( Players[i]) == Team
){
get_user_name( Players[i], Name, 49
);
client_print( id, print_chat, "%s - %i", Name, cs_get_user_money( Players[i
] ) );
}
}
}
发表于 2007-12-8 19:58:04 | 显示全部楼层 来自 中国–广东–惠州

回复: 已有client_print,怎么添加设置hudmessage

改这样试下,
[php]
public CheckMoney(id){
new Players[32], Name[50], Num, Team,hudmsg[128]
Team = get_user_team( id );
get_players( Players, Num, "a" )
for ( new i = 0; i < Num; i++ ){
if( get_user_team( Players) == Team ){
get_user_name( Players, Name, 49 );
client_print( id, print_chat, "%s - %i", Name, cs_get_user_money( Players ) );
format(hudmsg,127,"%s 队友%s共有金钱%d^n",hudmsg,Name,cs_get_user_money(Players))
}
}
for(new j=0;j<Num;j++)
{
if( get_user_team( Players[j]) == Team )
{
set_hudmessage(42, 127, 255, 0.01, 0.3, 2, 3.0, 4.0, 0.1, 0.2, 9)
show_hudmessage(Players[j],hudmsg)
}
}
}
[/php]
回复

使用道具 举报

发表于 2007-12-9 13:59:07 | 显示全部楼层 来自 中国–甘肃–兰州

回复: 已有client_print,怎么添加设置hudmessage

楼上正解.其实以set_hudmessage的形式来显示信息的话还有个好处,就是不仅可以设置字体的颜色和大小,而且还可以任意设置信息显示的位置和显示时间.
回复

使用道具 举报

 楼主| 发表于 2007-12-9 16:46:43 | 显示全部楼层 来自 中国–江苏–南京

回复: 已有client_print,怎么添加设置hudmessage

编译的时候错误:L~~~
这东西到底怎么弄啊~烦死了~
想学又学不会 有是代码有是鸟语
回复

使用道具 举报

发表于 2007-12-9 17:21:01 | 显示全部楼层 来自 中国–甘肃–兰州

回复: 已有client_print,怎么添加设置hudmessage

把代码改称这样试一下:
public CheckMoney(id){
new Players[32], Name[50], Num, Team;
Team = get_user_team( id );
get_players( Players, Num, "a" )
for ( new i = 0; i < Num; i++ ){

if( get_user_team( Players) == Team ){
get_user_name( Players, Name, 49 );

set_hudmessage(255, 255, 255, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
show_hudmessage ( id, "%s - %i", Name, cs_get_user_money( Players ) );
}
}
}
回复

使用道具 举报

 楼主| 发表于 2007-12-9 17:25:13 | 显示全部楼层 来自 中国–江苏–南京

回复: 已有client_print,怎么添加设置hudmessage

#5  我试了1下 ,可以了 不过游戏中只显示1个人的钱 本来可以显示其他人的
回复

使用道具 举报

发表于 2007-12-9 17:47:20 | 显示全部楼层 来自 中国–甘肃–兰州

回复: 已有client_print,怎么添加设置hudmessage

还是把原代码发上来吧,这样断章取义地修改,还真的是无从下手啊.
既然没有定义"cs_get_user_money"这个常量,那么你就试一下在"get_user_name( Players, Name, 49 );"这句代码后面再添加下面的代码:
cs_set_user_money( player, cs_get_user_money(i) )
回复

使用道具 举报

 楼主| 发表于 2007-12-9 17:58:16 | 显示全部楼层 来自 中国–江苏–南京

回复: 已有client_print,怎么添加设置hudmessage

呵呵 对哦 要联系上下文
这个插件可以在CHAT位置显示自己方人的金钱数 而对方看不到
现在我想要的效果是 用HUD显示在左下方 对方看不到
而原来的CHAT则不要(就是client_print
这东西太复杂了 想学也学不会 谁可以帮我改1下 最好能编译好 不慎感激


#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Team Money"
#define VERSION "1.0"
#define AUTHOR "Dylan Johnston"

public plugin_init
() {
register_plugin(PLUGIN, VERSION, AUTHOR
);
register_clcmd("say_team /money","CheckMoney"
);
}

public
CheckMoney(id
){
new
Players[32], Name[50], Num, Team
;
Team = get_user_team( id
);
get_players( Players, Num, "a"
)
for ( new
i = 0; i < Num; i
++ ){
if(
get_user_team( Players[i]) == Team
){
get_user_name( Players[i], Name, 49
);
client_print( id, print_chat, "%s - %i", Name, cs_get_user_money( Players[i
] ) );
}
}
}

回复

使用道具 举报

发表于 2007-12-9 18:40:08 | 显示全部楼层 来自 中国–广东–惠州–惠城区

回复: 已有client_print,怎么添加设置hudmessage

把[php]for(new j=0;j<num;j++)[/php]中的num必成Num就行了,我一下疏忽了</SPAN>
回复

使用道具 举报

 楼主| 发表于 2007-12-9 19:00:17 | 显示全部楼层 来自 中国–江苏–南京

回复: 已有client_print,怎么添加设置hudmessage

#9 没用哦        ````
回复

使用道具 举报

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

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