【求助】进出服务器提示(帮忙改下使他能用彩色聊天信息)
#include <amxmod>#include <amxmodx>
#include <csstats>
#include <ipseeker>
public plugin_init() {
register_plugin("Enter-Leave Message","1.0","martins")
register_cvar("amx_enter_message", "Server join: %name% (Rank: %rankpos%)(total:%rankmax%)")
register_cvar("amx_leave_message", "Server leave: %name%")
return PLUGIN_CONTINUE
}
public client_putinserver(id){
new param, len
param = id
len = get_user_name(id,param,31)
set_task(2.0, "enter_msg", 0, param,len + 2)
return PLUGIN_CONTINUE
}
public client_disconnect(id){
new param, len
param = id
len = get_user_name(id, param, 31)
set_task(2.0, "leave_msg", 0, param, len + 2)
return PLUGIN_CONTINUE
}
public enter_msg(param[]) {
new message,hostname
get_cvar_string("amx_enter_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace(message,191, "%hostname%", hostname)
new ip
get_user_ip(param, ip, 31, 1)
new addr
ipseeker(ip, ipseek_all, addr, 128, 1)
replace(message,191, "%IP%", addr)
if (cvar_exists("csstats_reset")){
new data, rankpos, rankmax , iRankpos , iRankmax
iRankpos = get_user_stats(param,data,data)
iRankmax = get_statsnum()
numtostr(iRankpos,rankpos,7)
numtostr(iRankmax,rankmax,7)
replace(message, 191, "%rankpos%", rankpos)
replace(message, 191, "%rankmax%", rankmax)
}
replace(message, 191, "%name%", param)
while(replace(message, 191, "\n", "^n")){}
//set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
//show_hudmessage(0, message)
client_print(0,print_chat,"%s",message)
return PLUGIN_CONTINUE
}
public leave_msg(param[]) {
new message,hostname
get_cvar_string("amx_leave_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace(message, 191, "%hostname%", hostname)
replace(message, 191, "%name%", param)
while(replace(message, 191, "\n", "^n")){}
//set_hudmessage(255, 0, 255, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
//show_hudmessage(0, message)
client_print(0,print_chat,"%s",message)
return PLUGIN_CONTINUE
}
回复: 【求助】进出服务器提示(帮忙改下使他能用彩色聊天信息)
应该是这样了,不行的话就请下一位来帮忙了。#include <amxmod>
#include <amxmodx>
#include <csstats>
#include <ipseeker>
public plugin_init() {
register_plugin("Enter-Leave Message","1.0","martins")
register_cvar("amx_enter_message", "Server join: %name% (Rank: %rankpos%)(total:%rankmax%)")
register_cvar("amx_leave_message", "Server leave: %name%")
return PLUGIN_CONTINUE
}
public client_putinserver(id){
new param[34], len
param[0] = id
len = get_user_name(id,param[1],31)
set_task(2.0, "enter_msg", 0, param,len + 2)
return PLUGIN_CONTINUE
}
public client_disconnect(id){
new param[34], len
param[0] = id
len = get_user_name(id, param[1], 31)
set_task(2.0, "leave_msg", 0, param, len + 2)
return PLUGIN_CONTINUE
}
public enter_msg(param[]) {
new message[192],hostname[64]
get_cvar_string("amx_enter_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace(message,191, "%hostname%", hostname)
new ip[32]
get_user_ip(param[0], ip, 31, 1)
new addr[64]
ipseeker(ip, ipseek_all, addr, 128, 1)
replace(message,191, "%IP%", addr)
if (cvar_exists("csstats_reset")){
new data[8], rankpos[8], rankmax[8] , iRankpos , iRankmax
iRankpos = get_user_stats(param[0],data,data)
iRankmax = get_statsnum()
numtostr(iRankpos,rankpos,7)
numtostr(iRankmax,rankmax,7)
replace(message, 191, "%rankpos%", rankpos)
replace(message, 191, "%rankmax%", rankmax)
}
replace(message, 191, "%name%", param[1])
while(replace(message, 191, "\n", "^n")){}
set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0, message)
//client_print(0,print_chat,"%s",message)
return PLUGIN_CONTINUE
}
public leave_msg(param[]) {
new message[192],hostname[64]
get_cvar_string("amx_leave_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace(message, 191, "%hostname%", hostname)
replace(message, 191, "%name%", param[1])
while(replace(message, 191, "\n", "^n")){}
set_hudmessage(255, 0, 255, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0, message)
//client_print(0,print_chat,"%s",message)
return PLUGIN_CONTINUE
}
回复: 【求助】进出服务器提示(帮忙改下使他能用彩色聊天信息)
楼上的误解了还是怎么了,楼主要的是彩色聊天信息,hudmessage可以实现一个字一种颜色的吗?回复: 【求助】进出服务器提示(帮忙改下使他能用彩色聊天信息)
你又没说明,晕,我那也是彩色聊天的,如果要改成那种SAY一样大小的字的彩色聊天好像client_print没有这个功能。回复: 【求助】进出服务器提示(帮忙改下使他能用彩色聊天信息)
hehe 谢谢大家 已经改好了 。。。 !! 不行转换不到AMXX.... #include <amxmod>#include <amxmodx>
#include <csstats>
#include <ipseeker>
public plugin_init() {
register_plugin("Enter-Leave Message","1.0","martins")
register_cvar("amx_enter_message", "Server join: %name% (Rank: %rankpos%)(total:%rankmax%)")
register_cvar("amx_leave_message", "Server leave: %name%")
}
public client_putinserver(id){
new param, len
param = id
len = get_user_name(id,param,31)
set_task(2.0, "enter_msg", 0, param,len + 2)
return PLUGIN_CONTINUE
}
public client_disconnect(id){
new param, len
param = id
len = get_user_name(id, param, 31)
set_task(2.0, "leave_msg", 0, param, len + 2)
return PLUGIN_CONTINUE
}
public enter_msg(param[]) {
new message,hostname
get_cvar_string("amx_enter_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace(message,191, "%hostname%", hostname)
new ip
get_user_ip(param, ip, 31, 1)
new addr
ipseeker(ip, ipseek_all, addr, 128, 1)
replace_all( message, 191, "%IP%", addr );
if (cvar_exists("csstats_reset")){
new data, rankpos, rankmax , iRankpos , iRankmax
iRankpos = get_user_stats(param,data,data)
iRankmax = get_statsnum()
numtostr(iRankpos,rankpos,7)
numtostr(iRankmax,rankmax,7)
replace_all( message, 191, "%rankpos%", rankpos );
replace_all( message, 191, "%rankmax%", rankmax );
}
replace_all( message, 191, "%name%", param[ 1 ] );
replace_all( message, charsmax( message ), "\n", "^n" );
/*set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0, message)*/
client_print_color( 0, param[ 0 ], "%s" , message );
return PLUGIN_CONTINUE
}
public leave_msg(param[]) {
new message,hostname
get_cvar_string("amx_leave_message", message, 191)
get_cvar_string("hostname", hostname, 63)
replace_all( message, 191, "%hostname%", hostname );
replace_all( message, 191, "%name%", param[ 1 ] );
replace_all( message, charsmax( message ), "\n", "^n" );
/*set_hudmessage(255, 0, 255, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0, message)*/
client_print_color( 0, param[ 0 ], "%s" , message );
return PLUGIN_CONTINUE
}
stock client_print_color( id, color, const fmt[], any:... )
{
static iSayText;
static szMsg[ 192 ];
vformat( szMsg, charsmax( szMsg ), fmt, 4 );
if ( iSayText || ( iSayText == get_user_msgid( "SayText" ) ) )
{
message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, _, id )
{
write_byte( color );
write_string( szMsg );
}
message_end( )
}
}用记事本写的,有错误提出来! 帮帮忙帮帮忙 2# wwww23
页:
[1]