搜索
查看: 3565|回复: 1

关于cs防炸

[复制链接]
发表于 2008-9-19 10:13:15 | 显示全部楼层 |阅读模式 来自 中国–北京–北京
我不太喜欢扔雷换刀的做法。网上找到比较好的三种方案:
1.lzh留下来了的核心代码:我测试了,好像没问题
#include <amxmodx>
new lastWeap[33]
new DQWeap[33]
public plugin_init()
{
register_plugin("xxx","xxx","xxx")
server_cmd("sv_allowdownload 0")
register_clcmd("lastinv","MyLast")
register_event("CurWeapon", "switchweapon","be","1=1")

}
public client_connect(id)
{
lastWeap[id]=CSW_KNIFE

}
public MyLast(id)
{
new WName[32]
get_weaponname(lastWeap[id],WName,31)
engclient_cmd(id,WName)
return PLUGIN_HANDLED
}
public switchweapon(id)
{
new tmp=read_data(2)
if(DQWeap[id]!=tmp)
{
                          lastWeap[id]=DQWeap[id]
                          DQWeap[id]=tmp
}
return PLUGIN_CONTINUE
}

2.点通同志们给的代码:我测试过,好像有问题
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Exploit"
#define AUTHOR "Jim"
#define VERSION "1.0"
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("lastinv", "block")
    server_cmd("sv_allowdownload 0")
    server_cmd("alias name")
}
public block(id)
{
    return pev(id, pev_weapons) == 0xFFFFFFFFA0000000 ? PLUGIN_HANDLED : PLUGIN_CONTINUE
}

3.网友给的代码:没有测试
CS1.5防炸插件源码
2008-07-21  13:55
网 上好像搜不到,不知道那些人是什么意图,既然我不图利益,那么何必管别人的利益,我的原创我做主,代码如下所示,如果不会用还是算了吧,因为要保证可以在 其他地方编译,不得不把自己用到的自定义函数贴进来了,代码有点长,不过复制粘贴就可以编译,代码在此,根本不必怀疑我会放什么后门吧,将以下代码复制到 记事本另存为xqfz.sma编译即可,只为交流之用,不过还请保留我的个人信息,如需转载,请注明此为出处。
———————————————xqfz.sma————————————————
//小强反炸插件(通道4),鄙视制作lzh的人渣(用于CS1.5)
//功能介绍:防雷,下载和lzh后门,所有警告只会发至主机,对防御信息完全封锁.对于反下载部分则尚未成熟,故留一自配参数xqv_antidlf以 开启下载,但有极小可能仍导致炸F,故默认为关(0),考虑到程序的死性和玩家利益,本插件并无出现任何惩罚代码,由管理员自行定夺
#include<amxmod>
#define WEP_B11 16
#define WEP_B12 17
#define WEP_B13 26
#define WEP_B14 1
#define WEP_B15 10
#define WEP_B16 11
#define WEP_B21 21
#define WEP_B22 5
#define WEP_B31 19
#define WEP_B32 23
#define WEP_B33 30
#define WEP_B34 7
#define WEP_B35 12
#define WEP_B41 28
#define WEP_B42 27
#define WEP_B43 22
#define WEP_B44 8
#define WEP_B45 3
#define WEP_B46 18
#define WEP_B47 24
#define WEP_B48 13
#define WEP_B51 20
#define WEP_3 29
#define WEP_O3 25
#define WEP_O4 4
#define WEP_O5 9
#define WEP_5 6
//以下为武器名称字符串
#define WEP_B11N "weapon_usp"
#define WEP_B12N "weapon_glock18"
#define WEP_B13N "weapon_deagle"
#define WEP_B14N "weapon_p228"
#define WEP_B15N "weapon_elite"
#define WEP_B16N "weapon_fiveseven"
#define WEP_B21N "weapon_m3"
#define WEP_B22N "weapon_xm1014"
#define WEP_B31N "weapon_mp5navy"
#define WEP_B32N "weapon_tmp"
#define WEP_B33N "weapon_p90"
#define WEP_B34N "weapon_mac10"
#define WEP_B35N "weapon_ump45"
#define WEP_B41N "weapon_ak47"
#define WEP_B42N "weapon_sg552"
#define WEP_B43N "weapon_m4a1"
#define WEP_B44N "weapon_aug"
#define WEP_B45N "weapon_scout"
#define WEP_B46N "weapon_awp"
#define WEP_B47N "weapon_g3sg1"
#define WEP_B48N "weapon_sg550"
#define WEP_B51N "weapon_m249"
#define WEP_3N "weapon_knife"
#define WEP_O3N "weapon_flashbang"
#define WEP_O4N "weapon_hegrenade"
#define WEP_O5N "weapon_smokegrenade"
#define WEP_5N "weapon_c4"
#define ITM_O2 "item_assaultsuit"
#define WARNCHANNEL 4
new weaponsw[32][2]//保存玩家的当前武器和上一武器(0当前,1上个)
new crashflag[32]//炸F第一步标记
public plugin_init(){
register_plugin("Anti Crash","1.5","Flea")
  register_cvar("xqv_antidlf","0")
set_cvar_num("sv_allowdownload",0)
  register_event("DeathMsg","domydeath","a")
  set_task (4.0,"doremoveflag",82349,"",0,"ab")
}
public plugin_end(){ remove_task(82349);}
/////////////////////////反下载部分
//玩家连接时启用下载
public client_connect ( id ) { set_cvar_num("sv_allowdownload",get_cvar_num("xqv_antidlf"));}
//玩家已经就绪,如有其他玩家还在连接(下载)则仍旧开启,否则关闭
public client_putinserver ( id ) { checktoset();}
//玩家离开时检测下载的开关,置嫌疑和武器切换信息为0
public client_disconnect ( id ){ checktoset(); crashflag[id-1]=weaponsw[id-1][0] = weaponsw[id-1][1]=0;}
stock checktoset(){
if(!get_cvar_num("xqv_antidlf")){set_cvar_num("sv_allowdownload",0);return;}
new allow=0
for(new i=1;i<=32;++i)
   if(is_user_connecting(i))
    allow=1
set_cvar_num("sv_allowdownload",allow)
}
/////////////////////////反雷部分
//玩家死亡时清除对应信息
public domydeath(){ new i = read_data(2)-1; crashflag=weaponsw[0]=weaponsw[1]=0;}
public doremoveflag(){//定时检测并移除玩家的嫌疑标志
new Players[32],playerCount,Hasgun
get_players(Players, playerCount)
for (new i=0; i<playerCount; ++i){
   Hasgun = xqHas(Players,1) + xqHas(Players,2)
   if(Hasgun) crashflag = 0
}
}
stock carryonlyknife(id){//判断玩家是否持刀且只有刀,目前可假设为剩余1个武器
new wps[32],num
get_user_weapons(id,wps,num)
return num==1
}
stock docrasher(id){
new name[32]=""
get_user_name(id,name,31)
  new outln[128]=""
format(outln,127,"--The player:%s(id=%d) is CRASHING? Check it out!",name,id)
xqSvPrint(outln,0.2,0.3,250,250,250)
}
public client_command(id){//捕捉选枪和切枪动作
if(!is_user_alive(id))return PLUGIN_CONTINUE
  new cmdstr[32]=""
read_argv(0,cmdstr,31)
//处理客户端发送的选枪请求
if(containi(cmdstr,"weapon_")==0){
   new wp = xqGetWeaponId(cmdstr)
   if(!wp || xqGetUserWeapon(id) == wp)return PLUGIN_HANDLED//wp非法或者选的是当前枪则钩住
    weaponsw[id-1][1] = xqGetUserWeapon(id)
   weaponsw[id-1][0] = wp
    return PLUGIN_CONTINUE
}
//丢枪时仅一种枪且有雷时列为嫌疑对象
else if(equali(cmdstr,"drop") && xqHas(id,1)+xqHas(id,2) == 1 && xqHas(id,4)+xqHas(id,5))
   crashflag[id-1]=1
//客户端发送的切枪请求
else if(equali(cmdstr,"lastinv")){
   if(carryonlyknife(id)&&crashflag[id-1]){ docrasher(id); return PLUGIN_HANDLED;}//可能炸服了
   if( !xqUserHasWeapon(id,weaponsw[id-1][1]) ) return PLUGIN_HANDLED//没有则忽略
    //一般情况:执行切换
   weaponsw[id-1][0] = weaponsw[id-1][1]
   weaponsw[id-1][1] = xqGetUserWeapon(id)//切换前保存旧的武器
    new name[32]=""
   get_weaponname(weaponsw[id-1][0],name,31)
   engclient_cmd(id,name)
    return PLUGIN_HANDLED
}
//合并欺骗攻击者部分
else if(equali(cmdstr,"uaredeath")){
   new name[20]="",msgln[128]="",arg1[16]=""
   get_user_name(id,name,19)
   format(msgln,127,"--The player:%s(id=%d) is Cracking with uaredeath...!",name,id)
    //把警告发向服务器
   xqSvPrint(msgln,0.2,0.3,200,200,200)
   //命令打对才让他高兴会
   read_argv(1,arg1,15)
   if(equali(arg1,"client_clcmd")) console_print(id,"cniusaudsaosdjw")//随便发个句子过去
   return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
/////////////////////////自定义库函数部分
//在主机控制台和屏幕打印信息(如果不是主机方式则只在服务器控制台显示),屏幕消息使用默认6秒的保存时间,通道为4
stock xqSvPrint(str[],Float:x,Float:y,r,g,b)
{
server_print(str)
if(xqIsLocal()){
   set_hudmessage ( r, g, b, x, y, 0, 6.0, 6.0, 0.1, 0.2, 4)
   show_hudmessage( 1,str)
}
}
stock xqHas(id,slot){//检测玩家是否有某个索引的枪,如1为主战枪,2为手枪
new Weapons[32],numWeapons
get_user_weapons(id, Weapons, numWeapons)
for (new i=0; i<numWeapons; ++i)
   if(xqGetWeaponSlot(Weapons)==slot)
    return 1
return 0
}
public xqGetWeaponSlot(id)
{//根据武器id返回是几号武器
if( id == WEP_B11 || id == WEP_B12 || id == WEP_B13 || id == WEP_B14 || id == WEP_B15 || id == WEP_B16)return 2
  if( id == WEP_B21 || id == WEP_B22 || id == WEP_B31 || id == WEP_B32 || id == WEP_B33 || id == WEP_B34
  || id == WEP_B35 || id == WEP_B41 || id == WEP_B42 || id == WEP_B43 || id == WEP_B44 || id == WEP_B45
  || id == WEP_B46 || id == WEP_B47 || id == WEP_B48 || id == WEP_B51 )return 1
  if( id == WEP_3 )return 3
if( id == WEP_O3 || id == WEP_O4 || id == WEP_O5 )return 4
if( id == WEP_5 )return 5
  return 0
}
//根据武器名称获取武器id,主要用于比较,逆向则使用系统函数get_weaponname
stock xqGetWeaponId(name[])
{
if(equali(name,WEP_B11N)) return WEP_B11
if(equali(name,WEP_B12N)) return WEP_B12
if(equali(name,WEP_B13N)) return WEP_B13
if(equali(name,WEP_B14N)) return WEP_B14
if(equali(name,WEP_B15N)) return WEP_B15
if(equali(name,WEP_B16N)) return WEP_B16
  if(equali(name,WEP_B21N)) return WEP_B21
if(equali(name,WEP_B22N)) return WEP_B21
  if(equali(name,WEP_B31N)) return WEP_B31
if(equali(name,WEP_B32N)) return WEP_B32
if(equali(name,WEP_B33N)) return WEP_B33
if(equali(name,WEP_B34N)) return WEP_B34
if(equali(name,WEP_B35N)) return WEP_B35
  if(equali(name,WEP_B41N)) return WEP_B41
if(equali(name,WEP_B42N)) return WEP_B42
if(equali(name,WEP_B43N)) return WEP_B43
if(equali(name,WEP_B44N)) return WEP_B44
if(equali(name,WEP_B45N)) return WEP_B45
if(equali(name,WEP_B46N)) return WEP_B46
if(equali(name,WEP_B47N)) return WEP_B47
if(equali(name,WEP_B48N)) return WEP_B48
if(equali(name,WEP_B51N)) return WEP_B51
  if(equali(name,WEP_3N)) return WEP_3
if(equali(name,WEP_O3N)) return WEP_O3
if(equali(name,WEP_O4N)) return WEP_O4
if(equali(name,WEP_O5N)) return WEP_O5
if(equali(name,WEP_5N)) return WEP_5
return 0//错误
}
//获取武器时通常只要返回武器ID
stock xqGetUserWeapon(id){ new c,a; return get_user_weapon(id,c,a);}
stock xqUserHasWeapon(id,wpid)
{//判断玩家是否有某武器
new Weapons[32],numWeapons
get_user_weapons(id, Weapons, numWeapons)
for (new i=0; i<numWeapons; ++i)
   if(wpid== Weapons)
    return 1
return 0
}
//判断是否为主机方式
stock xqIsLocal()
{
if(!is_user_connected(1))return 0
new ip[16]=""
get_user_ip(1,ip,15,1)
return equali(ip,"loopback")
}


大家可以试试
发表于 2008-9-22 11:23:17 | 显示全部楼层 来自 中国–湖北–黄冈

回复: 关于cs防炸

我现在没玩CS1.5了
在玩1.6的
回复

使用道具 举报

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

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