如何显示彩色的print文字?
用client_print显示出来的字都是默认的土黄色的,怎么样才能用其他颜色显示?我知道HudMessage可以用彩色,但是这个不知道怎么用,好像没地方设置颜色的……
谁做过这个讨论一下
回复: 如何显示彩色的print文字?
用MESSAGE,你可以参考下下面的例子/* * * * * * * * * * * * * * * * * * * * * * * *
* Admin_chatcolor, by BlueRaja (AMX Mod X)*
* *
* Special thanks to Damaged Soul *
* - not just for helping me when I needed it, *
* but for putting up with all my shit ^_^*
* *
*************I hate asterisks.*****************
* *
* (c) Copyright 2005 *
* This file is provided as is (no warranties) *
* * * * * * * * * * * * * * * * * * * * * * * */
//Use !T for team-color (sorry, can't use red when on CT, and vice-versa)
//!G for green, and !W for normal (it's more of a tan than a white...)
//Includes
#include <amxmodx>
#include <cstrike>
//Defines
#if defined ACCESS_LEVEL
#undef ACCESS_LEVEL
#endif
//#define ACCESS_LEVEL ADMIN_CHAT //UNCOMMENT THIS LINE to allow only admins (with ADMIN_CHAT) to use colors
//Messages
new gmsgSayText
//Globals
//Initialization
public plugin_init()
{
gmsgSayText = get_user_msgid("SayText")
register_clcmd("say", "CatchSay")
register_clcmd("say_team", "CatchSay")
register_plugin("Admin Chat Color","1.0","BlueRaja")
return PLUGIN_CONTINUE
}
//Functions
public CatchSay(id)
{
#if defined ACCESS_LEVEL
if( !(get_user_flags(id)&ACCESS_LEVEL) ) return PLUGIN_CONTINUE
#endif
new message
read_argv(1,message,128)
if ( containi(message,"!t")==-1 &&
containi(message,"!w")==-1 &&
containi(message,"!g")==-1 )
{
return PLUGIN_CONTINUE
}
new szCommand
read_argv(0,szCommand,8)
new CsTeams:team = cs_get_user_team(id)
new isAlive = is_user_alive(id)
new playerList//players to send message to
new playerCount
new message_to_send = "^x01"
new szFlags = ""
if(isAlive){
add(szFlags,3,"a")//Only alive players
} else {
add(szFlags,3,"b")//Only dead players
add(message_to_send,128,"*DEAD*")
}
add(szFlags,3,"c")//skip bots
if(equal(szCommand,"say_team")) {
add(szFlags,3,"e")//Match with passed teamname
if(team==CS_TEAM_T){
get_players(playerList,playerCount,szFlags,"TERRORIST")
add(message_to_send,128,"(Terrorist) ^x03")
} else if(team==CS_TEAM_CT) {
get_players(playerList,playerCount,szFlags,"CT")
add(message_to_send,128,"(Counter-terrorist) ^x03")
} else { //assume Spectator
get_players(playerList,playerCount,szFlags,"SPECTATOR")
add(message_to_send,128,"(Spectator) ^x03")
}
} else { //assume "say"
get_players(playerList,playerCount,szFlags)
if(isAlive)
{
add(message_to_send,128,"^x03")
} else {
add(message_to_send,128," ^x03")
}
}
new username
get_user_name(id,username,128)
add(message_to_send,128,username)
add(message_to_send,128,"^x01 :")
add( message_to_send,128,message,(128-strlen(message_to_send)) )
while(containi(message_to_send,"!t") != -1)
{
replace(message_to_send,128,"!T","^x03")
replace(message_to_send,128,"!t","^x03")
}
while(containi(message_to_send,"!g") != -1)
{
replace(message_to_send,128,"!G","^x04")
replace(message_to_send,128,"!g","^x04")
}
while(containi(message_to_send,"!w") != -1)
{
replace(message_to_send,128,"!W","^x01")
replace(message_to_send,128,"!w","^x01")
}
for(new i=0; i<playerCount; i++)
{
message_begin(MSG_ONE, gmsgSayText, {0,0,0}, playerList)
write_byte(playerList)
write_string(message_to_send)
message_end()
}
return PLUGIN_HANDLED
}
回复: 如何显示彩色的print文字?
底细当。。。这样的东西,能看懂么回复: 如何显示彩色的print文字?
还可以啊,不是很复杂啊。大概的过程了解了。回复: 如何显示彩色的print文字?
会了就好__________
回复: 如何显示彩色的print文字?
我前2天也刚学会。只是有些信息会有BUG,比如有些信息是玩家进入后多少秒后才会显示1次的,反而会不定时显示一次,还有些信息是针对某个玩家显示的,反而全部人都可以看见了。。。谁能教我啊。。。郁闷回复: 如何显示彩色的print文字?
Post by AE86我前2天也刚学会。只是有些信息会有BUG,比如有些信息是玩家进入后多少秒后才会显示1次的,反而会不定时显示一次,还有些信息是针对某个玩家显示的,反而全部人都可以看见了。。。谁能教我啊。。。郁闷
你得把你有问题的程序附上啊
回复: 如何显示彩色的print文字?
比如这段:}
public client_putinserver(id)
{
if(is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id))
set_task(20.0,"Task_ActivatePingCheck",id,_,_,"a",1) // Since when the user "just" connected, his ping is high, we dont want to get a false detection
}
public Task_ActivatePingCheck(id)
{ new p_message
g_PingOffence = 0
g_CheckPlayer = 1
g_MaxPing = get_cvar_num("amx_maxping")
//g_MinRate = get_cvar_num("amx_minrate")
format(p_message,127,"^x04 ^x03[][][][][][][][][][][][][]……",g_MaxPing)
hpk_message(p_message)
}
public client_disconnect(id)
{
g_CheckPlayer = 0
remove_task(id)
}
public Task_CheckPlayers()
{
for(new i=1;i<=g_MaxPlayers;i++) if(g_CheckPlayer)
CheckPing(i)
}
本来只是玩家连接的时候显示,设为这种颜色后,会不定时显示出来。。能帮我解决该问题吗?
回复: 如何显示彩色的print文字?
似乎是定时检测玩家的PING....高了就踢掉..所以会显示出来呀回复: 如何显示彩色的print文字?
不不,那段是进入后显示“玩家网络延迟超出150将会被自动踢出”所以只有进入后才会显示一次。现在改为format显示方式后,每隔一段时间显示一次“玩家网络延迟超出150将会被自动踢出”我郁闷
页:
[1]
2