搜索
查看: 1392|回复: 2

谁帮帮我解决一下这个问题

[复制链接]
发表于 2006-9-8 22:33:50 | 显示全部楼层 |阅读模式 来自 新疆乌鲁木齐
我是个新手才学习,在别人给的代码上我修改了一下 出现下面的错误啊!高手帮我看看这个问题怎么会事!

下面是我修改的后的全部文件

/* Plugin generated by AMXX-Studio */
#include <amxmod>
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Same IP Same Team"
#define VERSION "1.5"
#define AUTHOR "martins"
new g_msgid
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_sameipsameteam","1")
register_cvar("knifekillaward","1")
register_cvar("knifekillmoney","500")
register_event("DeathMsg", "Death_insameip", "a")
g_msgid = get_user_msgid("SayText")
return PLUGIN_CONTINUE
}
public client_death(killer,victim,wpnindex,hitplace,TK) {
if(get_cvar_num("amx_sameipsameteam") != 1) return PLUGIN_CONTINUE
new id = victim
new pnum,target,sameipid,sameipcnt=0,team
new usrip[32],ips[32][32]
new players[32],name[32],target_name[32]
get_user_ip(id,usrip,31,1)
//console_print(0,"usrip is %s",usrip)
if(is_user_connected(id)){
get_players(players,pnum)
for( new i = 0 ; i <pnum ; i++) {
target = players
if (id != target){
get_user_ip(target,ips,31,1)
if(equali(usrip,ips)){
sameipid = target
sameipcnt = 1
break
}
}
}
if (sameipcnt){
new target_team = get_user_team(sameipid)
get_user_name(id,name,31)
get_user_name(sameipid,target_name,31)
team = get_user_team(id)
if ((team != target_team) && (!(get_user_flags(id)&ADMIN_IMMUNITY)) && (!(get_user_flags(id)&ADMIN_RESERVATION))){
switch(target_team){
case 2: {
cs_set_user_team(id,CS_TEAM_CT,CS_CT_GIGN)
new sjMsg[192]
format(sjMsg,191,print_console,"^x04*玩家:^x03%s^x04 因为和 ^x03%s^x04 相同IP: ^x03%s^x04 加入队伍 CT",name,target_name,usrip)
format(sjMsg,191,print_chat,"^x04*玩家:^x03%s^x04 因为和 ^x03%s^x04 相同IP: ^x03%s^x04 加入队伍 CT",name,target_name,usrip)
display_chat( sjMsg)
/*
new oldmoney = cs_get_user_money(killer)
new newmoney
newmoney = oldmoney + 3000
set_user_money(killer,newmoney)
new killer_frags = get_user_frags(killer)
set_user_frags(killer,killer_frags+1)
*/
}
case 1:
{
cs_set_user_team(id,CS_TEAM_T,CS_T_TERROR)
new sjMsg[192]
format(sjMsg,191,print_console,"^x04*玩家:^x03%s^x04 因为和 ^x03%s^x04 相同IP: ^x03%s^x04 加入队伍 T",name,target_name,usrip)
format(sjMsg,191,print_chat,"^x04*玩家:^x03%s^x04 因为和 ^x03%s^x04 相同IP: ^x03%s^x04 加入队伍 T",name,target_name,usrip)
display_chat( sjMsg)
/*
new oldmoney = cs_get_user_money(killer)
new newmoney
newmoney = oldmoney + 3000
set_user_money(killer,newmoney)
new killer_frags = get_user_frags(killer)
set_user_frags(killer,killer_frags+1)
*/
}
}
}
}
}
return PLUGIN_CONTINUE
}
public Death_insameip(){
new id = read_data(2)
new killer = read_data(1)
new wpn[32]
read_data(4,wpn,31)
if ( !killer || killer==id || get_user_team(killer)==get_user_team(id)){
return PLUGIN_CONTINUE
}else{
if (killer){
if (equal(wpn,"knife")){
if (get_cvar_num("knifekillaward") == 1){
new sjMsg[192]
new killer_name[32],id_name[32]
new award = get_cvar_num("knifekillmoney")
new oldmoney = cs_get_user_money(killer)
get_user_name(killer,killer_name,31)
get_user_name(id,id_name,31)
new newmoney
newmoney = oldmoney + award
set_user_money(killer, newmoney)
format(sjMsg,191,print_chat,"^x03%s^x01 用小刀杀死 ^x04%s^x01 得到奖励 ^x04%d",killer_name,id_name,award)
format(sjMsg,191,print_console,"^x03%s^x01 用小刀杀死 ^x04%s^x01 得到奖励 ^x04%d",killer_name,id_name,award)
display_chat( sjMsg)
}
}
}
}
return PLUGIN_CONTINUE
}
display_chat( sjMsg[]){
message_begin( MSG_ALL, g_msgid);
write_byte(1);
write_string( sjMsg);
message_end();
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2006-9-9 00:07:20 | 显示全部楼层 来自 广东深圳

回复: 谁帮帮我解决一下这个问题

format(sjMsg,191,print_console,"^。。。。
把所有上面的一行删掉

format(sjMsg,191,print_chat,"^。。。。
把所有上面的一行红字删除删掉
因为原来的代码用 client_print(0,print_chat,"..." ) 用foramat,要去掉  print_chat
回复

使用道具 举报

 楼主| 发表于 2006-9-9 10:24:57 | 显示全部楼层 来自 新疆乌鲁木齐

回复: 谁帮帮我解决一下这个问题

谢谢你兄弟,我的问题解决了。因为我是个菜鸟才开始学。别笑话哈。。!!
回复

使用道具 举报

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

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