版主请来看下为什么会出现4次改名的
我在你的基础上修改了下,能实现了我所想要的功能,不过出现了一个错误当玩家改名的时候出现4个
"A改名字为m"
我那里弄错了,请指点,谢谢!
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new g_motdFile
public plugin_init()
{
register_plugin("AMX Admin Model", "1.1.1", "whitemike | C.H.M")
register_event("ResetHUD", "resetModel", "b")
get_configsdir(g_motdFile, 63)
format(g_motdFile, 63, "%s/MM.ini", g_motdFile)
return PLUGIN_CONTINUE
}
public plugin_precache()
{
precache_model("models/player/vip/vip.mdl")
return PLUGIN_CONTINUE
}
public resetModel(id, level, cid)
{
if (file_exists(g_motdFile))
{
new name,message, len, line = 0
get_user_name( id, name, 31)
while(read_file( g_motdFile, line++, message, 191, len))
{
if( containi( name, message) != -1 )
set_user_flags(id, get_user_flags(id)|ADMIN_VOTE)
}
}
if (get_user_flags(id) & ADMIN_VOTE)
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
cs_set_user_model(id, "vip")
}
else if(userTeam == CS_TEAM_CT)
{
cs_set_user_model(id, "vip")
}
else
{
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
new newname,message, len, line = 0
get_user_info(id, "name", newname,31)
if (file_exists(g_motdFile))
{
while(read_file( g_motdFile, line++, message, 191, len))
{
if( containi( newname, message) != -1 )
set_user_flags(id, get_user_flags(id)|ADMIN_VOTE)
else
{
set_user_flags(id, get_user_flags(id)|ADMIN_USER)
cs_reset_user_model(id)
}
}
}
return PLUGIN_CONTINUE
}
回复: 版主请来看下为什么会出现4次改名的
还有这个怎么改成只有一方才能看见扔雷信息呢?弄了一个晚上都弄不明白!!请高手指教!
#include <amxmodx>
#include <amxmisc>
#include <Engine>
#define PLUGIN_NAME "New Plug-In"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
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)
if(equal(arg5,"#Fire_in_the_hole")){
return 1
}
}
return PLUGIN_CONTINUE
}
public grenade_throw(id, greindex, wpnid)
{
new msg
new thname
new pindex
pindex=id
switch(wpnid)
{
case CSW_HEGRENADE:
{
get_user_name(id,thname,31)
format(msg,63,"^x03%s ^x01(对讲机):^x04 注意! 扔炸弹了!",thname)
}
case CSW_FLASHBANG:
{
get_user_name(id,thname,31)
format(msg,63,"^x03%s ^x01(对讲机):^x04 注意! 扔闪光弹了!",thname)
}
case CSW_SMOKEGRENADE:
{
get_user_name(id,thname,31)
format(msg,63,"^x03%s ^x01(对讲机):^x04 注意! 扔烟雾弹了!",thname)
}
}
client_color(0,id,msg)
}
public client_color(playerid, colorid, msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),{0,0,0},playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
回复: 版主请来看下为什么会出现4次改名的
把这行改下client_color(0,id,msg)
改成这样试下
new players,num
get_players(players,num,"e",get_user_team(id)==1?"TERRORIST":"CT")
for(new i=0;i<num;i++)
{
client_color(players,id,msg)
}
回复: 版主请来看下为什么会出现4次改名的
谢谢楼上的第一个知道怎么出错的吗?
set_user_flags(id, get_user_flags(id)|ADMIN_VOTE)
else
{
set_user_flags(id, get_user_flags(id)|ADMIN_USER)
cs_reset_user_model(id)
}
如果不加上红色的那一行,当玩家权限变默认的时候,模型还是和原来一样,但是加上了不久就出现提示调试错误!
回复: 版主请来看下为什么会出现4次改名的
没人帮忙.顶一下先!回复: 版主请来看下为什么会出现4次改名的
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new g_motdFile
public plugin_init()
{
register_plugin("AMX Admin Model", "1.1.1", "whitemike | C.H.M")
register_event("ResetHUD", "resetModel", "b")
get_configsdir(g_motdFile, 63)
format(g_motdFile, 63, "%s/MM.ini", g_motdFile)
return PLUGIN_CONTINUE
}
public plugin_precache()
{
precache_model("models/player/vip/vip.mdl")
return PLUGIN_CONTINUE
}
public resetModel(id, level, cid)
{
if (file_exists(g_motdFile))
{
new name,message, len, line = 0
get_user_name( id, name, 31)
while(read_file( g_motdFile, line++, message, 191, len))
{
if( containi( name, message) != -1 )
set_user_flags(id, get_user_flags(id)|ADMIN_VOTE)
}
}
if (get_user_flags(id) & ADMIN_VOTE)
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
cs_set_user_model(id, "vip")
}
else if(userTeam == CS_TEAM_CT)
{
cs_set_user_model(id, "vip")
}
else
{
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
new newname,oldname,message, len, line = 0
get_user_name(id,oldname,31)
get_user_info(id, "name", newname,31)
if(!equal(newname,oldname))
{
if (file_exists(g_motdFile))
{
while(read_file( g_motdFile, line++, message, 191, len))
{
if( containi( newname, message) != -1 )
set_user_flags(id, get_user_flags(id)|ADMIN_VOTE)
else
{
set_user_flags(id, get_user_flags(id)|ADMIN_USER)
cs_reset_user_model(id)
}
}
}
}
}
回复: 版主请来看下为什么会出现4次改名的
谢谢楼上的 .测试了下,问题还是一样,功能是能实现了.不过还是出现4次"**改名为TT"
页:
[1]