poi000 发表于 2006-12-26 06:46:21

求蹲坑放风筝插件.请高手改一下

参考服务器IP 218.17.242.201:27015他的插件我都要!!!!1
下面是源码amxx 1.6的
/* AMX Mod X script
*
* AntiCamping Advanced
* by Homicide, original code by SpaceDude
*
* This script is a modification to SpaceDude's anti-camping plugin.
* I used Spacedude抯 method for determine camping then added some nice features to the plugin.
*
*The main feature I added was the heartbeat method of discouraging camping.
*
* The features include the ability to set punishment, camping time, healthpunish, and toggle 'the campmeter'.
*
*   Cvars:
* anticamping 0|1   蹲坑检测 0=关闭, 1=开启 | 默认: 1
* anticamping_time n允许蹲坑的时间上限 | 默认: 20
* anticamping_punish_mode abcde 蹲坑惩罚的方式, a=扇耳光, b=减少生命值, c=举牌子, d=呼吸声, e=亮人, 可复选 | 默认:bc
* anticamping_healthpunish n每次减少生命值的数量(如果选择了减少生命的惩罚方式) | 默认: 10
* anticamping_meter 0|1向客户端显示检测的信息, 0=关闭, 1=开启 | 默认: 1
* anticamping_camp_limit n 每个玩家的蹲坑限次 | 默认: 3
* anticamping_kick 0|1是否自动踢出超过蹲坑限次的玩家, 1=开启, 0=关闭 | 默认: 1
*
* note: this plugin is best used without any other anti-camp plugins
* origin auth:Homicide-       original code by SpaceDude, nwb13
*
* edit last by KinSprite
*/
#include <amxmodx>
#include <fun>
#define SND_STOP (1<<5)
#define TASK_CAMP 6666667
#define DETECT_RANGE 30.0 // 检测范围
#define ROW_NUM 5 // 进度条的数量
new playercoord0
new playercoord1
new playercoord2
new playercoord3
new playercoord4
new campmeter
new g_pl_camptimes // 玩家的蹲坑次数
new bool:pausecounter
new bool:bombplanted
new bool:de_map
new camptolerancedefending = 180
new camptoleranceattacking = 200
new bool:g_pl_spr // 玩家的牌子状态
new bool:g_pl_lim // 玩家蹲坑到100%的状态
new camper_sprite
new cvarflags // 惩罚方式
new bool:g_pl_dtp // 检测玩家死亡时是否是正在蹲坑
new bool:g_pl_glow // 检测玩家是否被亮人
new p_anticamping
new p_anticamping_camptime
new p_anticamping_punish_mode
new p_anticamping_healthpunish
new p_anticamping_meter
new p_anticamping_camp_limit
new p_anticamping_kick
new p_anticamping_de_map_allow
new g_MyMsgSync
public plugin_init() {
register_plugin("AntiCamping Advanced XX","1.0","kinsprite")
register_dictionary("anticamping.txt")
register_event("Damage", "damage_event", "b", "2!0")
register_event("BarTime","bartime_event","b")
register_event("ResetHUD", "new_round", "b")
register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
register_event("SendAudio", "round_end", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("StatusIcon", "got_bomb", "be", "1=1", "1=2", "2=c4")
register_event("CS_DeathMsg", "on_death", "a")
p_anticamping = register_cvar("anticamping","1")// 蹲坑检测 0=关闭, 1=开启
p_anticamping_camptime = register_cvar("anticamping_camptime","20")// 允许蹲坑的时间上限
p_anticamping_punish_mode = register_cvar("anticamping_punish_mode","bc") // 对蹲坑玩家的惩罚方式, a=扇耳光, b=减少生命值, c=举牌子, d=呼吸声, e=亮人
p_anticamping_healthpunish = register_cvar("anticamping_healthpunish","10")// 每次减少生命值的数量
p_anticamping_meter = register_cvar("anticamping_meter","1") // 向客户端显示检测的信息, 0=关闭, 1=开启
p_anticamping_camp_limit = register_cvar("anticamping_camp_limit","3") // 每个玩家的蹲坑限次
p_anticamping_kick = register_cvar("anticamping_kick","1") // 是否自动踢出超过蹲坑限次的玩家, 1=开启, 0=关闭(但是立即杀死玩家并减上限数1)
p_anticamping_de_map_allow = register_cvar("anticamping_de_map_allow","1") //de_地图上是否允许防守方蹲坑
g_MyMsgSync = CreateHudSyncObj()
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
public sqrt(num) {
new div = num;
new result = 1;
while (div > result) { // end when div == result, or just below
div = (div + result) / 2 // take mean value as new divisor
result = num / div
}
return div;
}
public unpausecounter(parm[]) {
new id = parm
pausecounter = false
return PLUGIN_CONTINUE
}
public displaymeter(id) {
if (get_pcvar_num(p_anticamping_meter) != 0) {
new buffer,temp,pos
if ((get_user_team(id) == 1) && bombplanted && de_map && get_pcvar_num(p_anticamping_de_map_allow))
   pos += format(buffer,127-pos,"%L",id,"ANITCAMP_1")
else if ((get_user_team(id) == 2) && (!bombplanted) && de_map && get_pcvar_num(p_anticamping_de_map_allow))
   pos += format(buffer,127-pos,"%L",id,"ANITCAMP_2")
else {
   temp = campmeter/ROW_NUM
   for (new x=0; x<temp; x++)
    pos += format(buffer,127-pos,"|")
   for (new y=0; y<(100/ROW_NUM-temp); y++)
    pos += format(buffer,127-pos,"_")
   pos += format(buffer,127-pos,"%L",id,"ANITCAMP_3",campmeter,g_pl_camptimes,get_pcvar_num(p_anticamping_camp_limit))
}
if (campmeter > 100) {
   set_hudmessage(255, 0, 0, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
} else if (campmeter > 90) {
   set_hudmessage(255, 0, 0, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
} else if (campmeter > 80){
   set_hudmessage(255, 100, 0, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
} else if (campmeter > 50 ) {
   set_hudmessage(255, 255, 0, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
} else if (campmeter > 20 ) {
   set_hudmessage(0, 255, 0, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
} else {
   set_hudmessage(255, 255, 255, 0.02, 0.87, 0, 1.0, 2.0, 0.1, 0.1,4)
}
show_hudmessage(id,"%s",buffer) //ShowSyncHudMsg(id, g_MyMsgSync,"%s",buffer)
}
return PLUGIN_HANDLED
}
public checkcamping(){
if (!get_pcvar_num(p_anticamping)){
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
new players,variance,average
new numberofplayers, variancetotal, standarddeviation, id, i, j, team
get_pcvar_string(p_anticamping_punish_mode, cvarflags, 8)
get_players(players, numberofplayers, "a")
for (i = 0; i < numberofplayers; ++i) {
while (i < numberofplayers && pausecounter]) {
   ++i
}
if (i >= numberofplayers){
   set_task(1.0,"checkcamping",1)
   return PLUGIN_CONTINUE
}
id = players
for (j = 0; j < 3; ++j) {
   playercoord4 = playercoord3
   playercoord3 = playercoord2
   playercoord2 = playercoord1
   playercoord1 = playercoord0
}
get_user_origin(id, playercoord0, 0)
for (j = 0; j < 3; ++j) {
   average = (playercoord0 +
       playercoord1 +
       playercoord2 +
       playercoord3 +
       playercoord4) / 5
   variance = (((playercoord0 - average) * (playercoord0 - average) +
         (playercoord1 - average) * (playercoord1 - average) +
         (playercoord2 - average) * (playercoord2 - average) +
         (playercoord3 - average) * (playercoord3 - average) +
         (playercoord4 - average) * (playercoord4 - average)) / 4)
}
variancetotal=variance+variance+variance
standarddeviation=sqrt(variancetotal)
team = get_user_team(id)
if (!de_map){
   if (team == 2) // Team 1 = Terro, Team 2 = CT
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
   else
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
}
else if (bombplanted){
   if (team == 1) // Team 1 = Terro, Team 2 = CT
    if (get_pcvar_num(p_anticamping_de_map_allow))
   campmeter = 0
    else
   campmeter += (camptolerancedefending - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
   else
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
}
else{
   if (team == 2) // Team 1 = Terro, Team 2 = CT
    if (get_pcvar_num(p_anticamping_de_map_allow))
   campmeter = 0
    else
   campmeter += (camptolerancedefending - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
   else
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
}
if (g_pl_camptimes >= get_pcvar_num(p_anticamping_camp_limit)) {
   switch (get_pcvar_num(p_anticamping_kick)){
    case 0:{
   client_print(id,print_chat,"%L",id,"ANITCAMP_4")
   user_slap(id,get_user_health(id))
   g_pl_camptimes--
    }
    case 1:{
   client_cmd(id,"echo %L",id,"ANITCAMP_5")
   new temp
   format(temp,127,"%L",id,"ANITCAMP_6")
   server_cmd("kick #%d %s", get_user_userid(id),temp)
    }
   }
}
if ((campmeter < 80 ) && is_user_connected(id)) {
   if (g_pl_lim == true){
    g_pl_lim = false
   }
   if ((contain(cvarflags,"c") != -1) && (g_pl_spr == true)) {
    new parm
    parm = id
    parm = 0
    set_task(0.5,"clear_spr",TASK_CAMP+id,parm,2)
   }
   if ((contain(cvarflags,"e") != -1) && g_pl_glow) {
    set_user_rendering(id,kRenderFxNone,255,255,255,kRenderNormal,1)
    g_pl_glow = false
   }
   if (contain(cvarflags,"d") != -1) {
    emit_sound(id,CHAN_VOICE,"player/breathe2.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
   }
}
if ((campmeter < 0) && is_user_connected(id)){
   campmeter = 0
} else if ((campmeter>100) && is_user_connected(id)) {
   if (contain(cvarflags,"a") != -1) {
    user_slap(id,get_pcvar_num(p_anticamping_healthpunish))
   }
   if (contain(cvarflags,"b") != -1) {
    set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish))
   }
   if ((contain(cvarflags,"c") != -1) && (g_pl_spr == false)) {
    new parm
    parm = id
    set_task(0.5,"show_camper_spr",TASK_CAMP+id,parm,1)
   }
   if (contain(cvarflags,"d") != -1) {
    emit_sound(id,CHAN_VOICE,"player/breathe2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
   }
   if (contain(cvarflags,"e") != -1) {
    new colour_r,colour_b
    if (team == 1){
   colour_r = 255
   colour_b = 0
    }else{
   colour_r = 0
   colour_b = 255
    }
    set_user_rendering(id,kRenderFxGlowShell,colour_r,0,colour_b,kRenderNormal,17)
    g_pl_glow = true
   }
   if (g_pl_lim == false){
    g_pl_camptimes++
    detect_enemy(id)
    g_pl_lim = true
   }
   campmeter = 100
} else if ((campmeter > 90) && is_user_connected(id)) {
   if (contain(cvarflags,"a") != -1) {
    user_slap(id,get_pcvar_num(p_anticamping_healthpunish) / 5)
   }
   if (contain(cvarflags,"b") != -1) {
    set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish) / 5)
   }
   if (contain(cvarflags,"d") != -1) {
    emit_sound(id,CHAN_VOICE,"player/breathe2.wav", 0.5, ATTN_NORM, 0, PITCH_NORM)
   }
} else if ((campmeter>80) && is_user_connected(id)) {
   if (contain(cvarflags,"a") != -1) {
    user_slap(id,get_pcvar_num(p_anticamping_healthpunish) / 10)
   }
   if (contain(cvarflags,"b") != -1) {
    set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish) / 10)
   }
   if (contain(cvarflags,"d") != -1) {
    emit_sound(id,CHAN_VOICE,"player/breathe2.wav", 0.1, ATTN_NORM, 0, PITCH_NORM)
   }
}
if (is_user_connected(id) && get_pcvar_num(p_anticamping))
   displaymeter(id)
}
set_task(1.5,"checkcamping",1)
return PLUGIN_CONTINUE
}
public damage_event(id) {
if (get_pcvar_num(p_anticamping)&&id>0) {
new enemy = get_user_attacker(id)
if(enemy<1||enemy>32)
   return PLUGIN_CONTINUE
if (get_user_team(id)!=get_user_team(enemy)) {
   campmeter=0
   campmeter=0
}
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public new_round(id) {
if (get_pcvar_num(p_anticamping)) {
bombplanted=false
pausecounter=true
campmeter=0
new Float:freezetime = get_cvar_float("mp_freezetime")+1.0
new parm
parm=id
set_task(freezetime,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public bartime_event(id) {
if (get_pcvar_num(p_anticamping)) {
pausecounter=true
campmeter=0
new Float:bar_time=float(read_data(1)+1)
new parm
parm=id
set_task(bar_time,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public bomb_planted() {
if (get_pcvar_num(p_anticamping)) {
bombplanted=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public got_bomb(id) {
if (get_pcvar_num(p_anticamping)) {
de_map=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public round_end() {
if (get_pcvar_num(p_anticamping)) {
new players
new numberofplayers
new id
new i
get_players(players, numberofplayers, "a")
for (i = 0; i < numberofplayers; ++i) {
   id=players
   //pausecounter=true
   campmeter=0
   return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_sound("player/breathe2.wav")
camper_sprite = precache_model("sprites/camper.spr")
return PLUGIN_CONTINUE
}
public show_camper_spr(parm[]) {
new id = parm
message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte(124)
write_byte(id)
write_coord(65)
write_short(camper_sprite)
write_short(32767)
message_end()
g_pl_spr = true
show_camp_message(id,1)
return PLUGIN_CONTINUE
}
show_camp_message(id,type) {
new wps,buffer,name,wpnname
new num,clip,ammo,pos
new health = get_user_health(id)
new armor = get_user_armor(id)
get_user_name(id,name,31)
if (type == 1){
pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_7",name,health,armor)
}else{
pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_8",name,health,armor)
}
get_user_weapons(id,wps,num)
for (new i=0; i<num; i++) {
get_wpname(wps,wpnname,31)
get_user_ammo(id, wps, ammo, clip)
if (ammo < 0) ammo = 0
if (clip < 0) clip = 0
if (wps == CSW_C4 || wps == CSW_HEGRENADE || wps == CSW_SMOKEGRENADE || wps == CSW_FLASHBANG )
   pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_9",wpnname,clip)
else if (wps == CSW_KNIFE )
   pos += format(buffer,511-pos,"%s^n",wpnname)
else
   pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_10",wpnname,ammo,clip)
}
if (type == 1){
pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_11")
}else{
pos += format(buffer,511-pos,"%L",LANG_SERVER,"ANITCAMP_12")
}
if (type == 1)
set_hudmessage(230, 180, 0, 0.17, 0.05, 0, 6.0, 10.0, 0.1, 0.15)
else
set_hudmessage(154, 20, 255, 0.17, 0.05, 0, 6.0, 10.0, 0.1, 0.15)
ShowSyncHudMsg(0, g_MyMsgSync,buffer)
}
get_wpname(wp, name[], imax) {
new tempwp
switch (wp) {
case CSW_P228:
   copy(name, imax, "P228")
case CSW_SCOUT:
   copy(name, imax, "Scout")
case CSW_HEGRENADE:{
   format(tempwp,31,"%L",LANG_SERVER,"W_HEGREN")
    copy(name, imax,tempwp)
}
case CSW_XM1014:
   copy(name, imax, "Xm1014")
case CSW_C4:{
   format(tempwp,31,"%L",LANG_SERVER,"W_C4")
   copy(name, imax, tempwp)
}
case CSW_MAC10:
   copy(name, imax, "Mac10")
case CSW_AUG:
   copy(name, imax, "Aug")
case CSW_SMOKEGRENADE:{
   format(tempwp,31,"%L",LANG_SERVER,"W_SGREN")
   copy(name, imax, tempwp)
}
case CSW_ELITE:
   copy(name, imax, "Elite")
case CSW_FIVESEVEN:
   copy(name, imax, "Fiveseven")
case CSW_UMP45:
   copy(name, imax, "Ump45")
case CSW_SG550:
   copy(name, imax, "Sg550")
case CSW_GALIL:
   copy(name, imax, "Galil")
case CSW_FAMAS:
   copy(name, imax, "Famas")
case CSW_USP:
   copy(name, imax, "Usp")
case CSW_GLOCK18:
   copy(name, imax, "Glock18")
case CSW_AWP:
   copy(name, imax, "Awp")
case CSW_MP5NAVY:
   copy(name, imax, "Mp5navy")
case CSW_M249:
   copy(name, imax, "M249")
case CSW_M3:
   copy(name, imax, "M3")
case CSW_M4A1:
   copy(name, imax, "M4a1")
case CSW_TMP:
   copy(name, imax, "Tmp")
case CSW_G3SG1:
   copy(name, imax, "G3sg1")
case CSW_FLASHBANG:{
   format(tempwp,31,"%L",LANG_SERVER,"W_FLASG")
   copy(name, imax, tempwp)
}
case CSW_DEAGLE:
   copy(name, imax, "Deagle")
case CSW_SG552:
   copy(name, imax, "Sg552")
case CSW_AK47:
   copy(name, imax, "Ak47")
case CSW_KNIFE:{
   format(tempwp,31,"%L",LANG_SERVER,"W_KNIFE")
   copy(name, imax, tempwp)
}
case CSW_P90:
   copy(name, imax, "P90")
}
return 1
}
public clear_spr(parm[]) {
new id = parm
new type = parm // type 0=alive, 1=disconnect, 2=die in camping
message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte(125)
write_byte(id)
message_end()
if (type == 2 && g_pl_dtp && parm == id) {
new name_camper
get_user_name(id,name_camper,31)
set_hudmessage(154, 20, 255, 0.17, 0.1, 0, 6.0, 10.0, 0.1, 0.15)
ShowSyncHudMsg(0,g_MyMsgSync,"%L",LANG_PLAYER,"TXT_LAST",name_camper)
g_pl_dtp = false
}else if (type == 1) {
set_hudmessage(154, 20, 255, 0.17, 0.1, 0, 6.0, 10.0, 0.1, 0.15)
ShowSyncHudMsg(0,g_MyMsgSync,"%L",LANG_PLAYER,"TXT_LEAVE",parm)
}else if (type == 0)
show_camp_message(id,0)
g_pl_spr = false
return PLUGIN_CONTINUE
}
public client_connect(id) {
g_pl_camptimes = 0
g_pl_lim = false
g_pl_spr = false
campmeter = 0
return PLUGIN_CONTINUE
}
public client_disconnect(id) {
if ((contain(cvarflags,"c") != -1) && (g_pl_spr == true)) {
new parm
parm = id
parm = 1
get_user_name(id,parm,31)
set_task(0.5,"clear_spr",TASK_CAMP+id,parm,34)
}
if (contain(cvarflags,"d") != -1) {
emit_sound(id,CHAN_VOICE,"player/breathe2.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
campmeter = 0
return PLUGIN_CONTINUE
}
public on_death(){
new killer = read_data(1)
new id = read_data(2)
pausecounter=true
g_pl_dtp = true
if ((contain(cvarflags,"c") != -1) && (g_pl_spr == true)) {
new parm
parm = id
parm = 2
parm = killer
set_task(0.1,"clear_spr",TASK_CAMP+id,parm,3)
}
return PLUGIN_CONTINUE
}
public detect_enemy(id) {
if (!is_user_alive(id))
return PLUGIN_CONTINUE
new myorigin,emorigin
new name,plist,distance_string,pnum
new Float:dist

get_user_name(id,name,31)
get_user_origin(id, myorigin)
get_players(plist, pnum, "a")
for(new i = 0; i < pnum; i++) {
if (plist == id)
   continue
get_user_origin(plist, emorigin)
new distance = get_distance(emorigin, myorigin)
dist = float(distance) * 0.0254
format(distance_string,15,"%.2f",dist)
if ( dist < DETECT_RANGE ){
   if (get_user_team(id) == get_user_team(plist)){
    set_hudmessage(230, 180, 0, -1.0, 0.70, 0, 6.0, 6.0, 0.1, 0.15)
    ShowSyncHudMsg(plist,g_MyMsgSync,"%L",plist,"A_TEAM",name,distance_string)
    client_print(plist,print_chat,"* %L",plist,"A_TEAM",name,distance_string)
   }else{
    set_hudmessage(230, 180, 0, -1.0, 0.70, 0, 6.0, 6.0, 0.1, 0.15)
    ShowSyncHudMsg(plist,g_MyMsgSync,"%L",plist,"AN_ENEMY",distance_string)
    client_print(plist,print_chat,"* %L",plist,"AN_ENEMY",distance_string)
   }
}
}
return PLUGIN_CONTINUE
}

amx 0.97的
/* AMX Mod X
*
* (c) Copyright 2004, datang
*
* This file is part of AMX Mod X.
*
*/
#include <amxmodx>
#include <fun>
#define SND_STOP (1<<5)
new playercoord0
new playercoord1
new playercoord2
new playercoord3
new playercoord4
new campmeter
new bool:pausecounter
new bool:bombplanted
new bool:de_map
new camptolerancedefending = 180
new camptoleranceattacking = 200
new p_anticamping
new p_anticamping_camptime
new p_anticamping_healthpunish
new p_anticamping_meter

public sqrt(num) {
new div = num;
new result = 1;
while (div > result) { // end when div == result, or just below
div = (div + result) / 2 // take mean value as new divisor
result = num / div
}
return div;
}
public unpausecounter(parm[]) {
new id = parm
pausecounter = false
return PLUGIN_CONTINUE
}
public displaymeter(id) {
if (get_pcvar_num(p_anticamping_meter) != 0) {
if (campmeter > 100) {
   set_hudmessage(255, 0, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
} else if (campmeter > 90) {
   set_hudmessage(255, 0, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
} else if (campmeter > 80){
   set_hudmessage(255, 100, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
} else if (campmeter > 50 ) {
   set_hudmessage(255, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
} else if (campmeter > 20 ) {
   set_hudmessage(0, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
} else {
   set_hudmessage(0, 0, 255, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
   show_hudmessage(id,"%L: %i%", LANG_SERVER,"CAMP",campmeter)
}
}
return PLUGIN_HANDLED
}
public checkcamping(){
if (get_pcvar_num(p_anticamping) == 0){
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
new players
new numberofplayers
new variance
new average
new variancetotal
new standarddeviation
new id
new team
new i
new j
get_players(players, numberofplayers, "a")
for (i = 0; i < numberofplayers; ++i) {
while (i < numberofplayers && pausecounter]) {
   ++i
}
if (i >= numberofplayers){
   set_task(1.0,"checkcamping",1)
   return PLUGIN_CONTINUE
}
id = players
for (j = 0; j < 3; ++j) {
   playercoord4 = playercoord3
   playercoord3 = playercoord2
   playercoord2 = playercoord1
   playercoord1 = playercoord0
}
get_user_origin(id, playercoord0, 0)
for (j = 0; j < 3; ++j) {
   average = (playercoord0 +
       playercoord1 +
       playercoord2 +
       playercoord3 +
       playercoord4) / 5
   variance = (((playercoord0 - average) * (playercoord0 - average) +
         (playercoord1 - average) * (playercoord1 - average) +
         (playercoord2 - average) * (playercoord2 - average) +
         (playercoord3 - average) * (playercoord3 - average) +
         (playercoord4 - average) * (playercoord4 - average)) / 4)
}
variancetotal=variance+variance+variance
standarddeviation=sqrt(variancetotal)
team = get_user_team(id)
if (!de_map){
   if (team==2) // Team 1 = Terro, Team 2 = CT
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
   else
    campmeter += (camptoleranceattacking - standarddeviation) / get_pcvar_num(p_anticamping_camptime)
}
else if (bombplanted){
   if (team == 1) // Team 1 = Terro, Team 2 = CT
    campmeter = 0
   else
    campmeter += (camptoleranceattacking-standarddeviation)/get_pcvar_num(p_anticamping_camptime)
}
else{
   if (team==2) // Team 1 = Terro, Team 2 = CT
    campmeter += (camptolerancedefending-standarddeviation)/get_pcvar_num(p_anticamping_camptime)
   else
    campmeter += (camptoleranceattacking-standarddeviation)/get_pcvar_num(p_anticamping_camptime)
}
if (campmeter < 80 ) {
   emit_sound(id,CHAN_VOICE,"player/heartbeat1.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
if (campmeter < 0) {
   campmeter = 0
} else if (campmeter>100) {
   switch(get_pcvar_num(p_anticamping)) {
    case 1: {
   user_slap(id,get_pcvar_num(p_anticamping_healthpunish))
    }
    case 2: {
   set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish))
    }
    case 3: {
   emit_sound(id,CHAN_VOICE,"player/heartbeat1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
    }
   }
   campmeter = 100
} else if (campmeter > 90) {
   switch(get_pcvar_num(p_anticamping)) {
    case 1: {
   user_slap(id,get_pcvar_num(p_anticamping_healthpunish) / 5)
    }
    case 2: {
   set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish) / 5)
    }
    case 3: {
   emit_sound(id,CHAN_VOICE,"player/heartbeat1.wav", 0.5, ATTN_NORM, 0, PITCH_NORM)
    }
   }
} else if (campmeter>80){
   switch(get_pcvar_num(p_anticamping)) {
    case 1: {
   user_slap(id,get_pcvar_num(p_anticamping_healthpunish) / 10)
    }
    case 2: {
   set_user_health(id, get_user_health(id) - get_pcvar_num(p_anticamping_healthpunish) / 10)
    }
    case 3: {
   emit_sound(id,CHAN_VOICE,"player/heartbeat1.wav", 0.1, ATTN_NORM, 0, PITCH_NORM)
    }
   }
}
displaymeter(id)
}
set_task(2.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
public damage_event(id) {
if (get_pcvar_num(p_anticamping) != 0) {
new enemy = get_user_attacker(id)
if (get_user_team(id)!=get_user_team(enemy)) {
   campmeter=0
   campmeter=0
}
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public new_round(id) {
if (get_pcvar_num(p_anticamping) != 0) {
bombplanted=false
pausecounter=true
campmeter=0
new Float:freezetime = get_cvar_float("mp_freezetime")+1.0
new parm
parm=id
set_task(freezetime,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public bartime_event(id) {
if (get_pcvar_num(p_anticamping) != 0) {
pausecounter=true
campmeter=0
new Float:bar_time=float(read_data(1)+1)
new parm
parm=id
set_task(bar_time,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public bomb_planted() {
if (get_pcvar_num(p_anticamping) != 0) {
bombplanted=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public got_bomb(id) {
if (get_pcvar_num(p_anticamping) != 0) {
de_map=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public round_end() {
if (get_pcvar_num(p_anticamping) != 0) {
new players
new numberofplayers
new id
new i
get_players(players, numberofplayers, "a")
for (i = 0; i < numberofplayers; ++i) {
   id=players
   pausecounter=true
   return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_sound("player/heartbeat1.wav")
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("AntiCamping","1.0","datang")
register_dictionary("anticamping.txt")
register_event("Damage", "damage_event", "b", "2!0")
register_event("BarTime","bartime_event","b")
register_event("ResetHUD", "new_round", "b")
register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
register_event("SendAudio", "round_end", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("StatusIcon", "got_bomb", "be", "1=1", "1=2", "2=c4")
p_anticamping = register_cvar("anticamping","3",0)//0=Disabled, 1=Slap, 2=Health Reduction, 3=Heartbeat
p_anticamping_camptime = register_cvar("anticamping_camptime","20",0)//Amount of time allowed to camp
p_anticamping_healthpunish = register_cvar("anticamping_healthpunish","10",0)//Amount of health taken due to punishment
p_anticamping_meter = register_cvar("anticamping_meter","1",0) //Display 'campmeter' to each cilent
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}

自动换图的/* AMX Mod X
*   Nextmap Chooser Plugin
*
* by the AMX Mod X Development Team
*originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*This program is free software; you can redistribute it and/or modify it
*under the terms of the GNU General Public License as published by the
*Free Software Foundation; either version 2 of the License, or (at
*your option) any later version.
*
*This program is distributed in the hope that it will be useful, but
*WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software Foundation,
*Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*In addition, as a special exception, the author gives permission to
*link the code of this program with the Half-Life Game Engine ("HL
*Engine") and Modified Game Libraries ("MODs") developed by Valve,
*L.L.C ("Valve"). You must obey the GNU General Public License in all
*respects for all of the code used other than the HL Engine and MODs
*from Valve. If you modify this file, you may extend this exception
*to your version of the file, but you are not obligated to do so. If
*you do not wish to do so, delete this exception statement from your
*version.
*/
#include <amxmodx>
#include <amxmisc>
#define MAX_MAPS    128
#define SELECTMAPS5
new g_mapName
new g_mapNums
new g_nextName
new g_voteCount
new g_mapVoteNum
new g_teamScore
new g_lastMap
new g_coloredMenus
new bool:g_selected = false
public plugin_init() {
register_plugin("Nextmap Chooser",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("mapchooser.txt")
register_dictionary("common.txt")
new MenuName
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
register_menucmd(register_menuid(MenuName),(-1^(-1<<(SELECTMAPS+2))),"countVote")
if ( cstrike_running() )
    register_event("TeamScore", "team_score", "a")

get_localinfo("lastMap",g_lastMap,31)
set_localinfo("lastMap","")
new maps_ini_file
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
   get_cvar_string("mapcyclefile", maps_ini_file, 63)
if ( loadSettings(maps_ini_file) )
    set_task(15.0,"voteNextmap",987456,"",0,"b")
g_coloredMenus = colored_menus()
}
public checkVotes() {
new b = 0
for (new a = 0; a < g_mapVoteNum; ++a)
    if (g_voteCount < g_voteCount)
       b = a
if ( g_voteCount > g_voteCount ) {
    new mapname
    get_mapname(mapname,31)
    new Float:steptime = get_cvar_float("amx_extendmap_step")
    set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
    client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
    log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
      mapname , steptime )
    return
}
if ( g_voteCount && g_voteCount <= g_voteCount )
    set_cvar_string("amx_nextmap", g_mapName] )
new smap
get_cvar_string("amx_nextmap",smap,31)
client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
}
public countVote(id,key) {
if ( get_cvar_float("amx_vote_answers") ) {
    new name
    get_user_name(id,name,31)
    if ( key == SELECTMAPS )
      client_print(0,print_chat,"%L", LANG_PLAYER, "CHOSE_EXT", name )
    else if ( key < SELECTMAPS )
      client_print(0,print_chat,"%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapName] )
}
++g_voteCount
return PLUGIN_HANDLED
}
bool:isInMenu(id) {
for (new a=0; a<g_mapVoteNum; ++a)
    if (id==g_nextName)
      return true
return false
}
public voteNextmap() {
new winlimit = get_cvar_num("mp_winlimit")
new maxrounds = get_cvar_num("mp_maxrounds")
if ( winlimit ) {
    new c = winlimit - 2
    if ( (c > g_teamScore) && (c > g_teamScore) ) {
      g_selected = false
      return
    }
}
elseif ( maxrounds ) {
    if ( (maxrounds - 2) > (g_teamScore + g_teamScore) ){
      g_selected = false
      return
    }
}
else {
    new timeleft = get_timeleft()
    if (timeleft<1||timeleft>129){
      g_selected = false
      return
    }
}
if (g_selected)
    return
g_selected = true
new menu, a, mkeys = (1<<SELECTMAPS+1)
new pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
    a=random_num(0,g_mapNums-1)
    while( isInMenu(a) )
      if (++a >= g_mapNums) a = 0
    g_nextName = a
    pos += format(menu,511,"%d. %s^n",g_mapVoteNum+1,g_mapName)
    mkeys |= (1<<g_mapVoteNum)
    g_voteCount = 0
}
menu='^n'
g_voteCount = 0
g_voteCount = 0
new mapname
get_mapname(mapname,31)
if ( (winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))) {
    pos += format(menu,511,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTED_MAP",mapname)
    mkeys |= (1<<SELECTMAPS)
}
format(menu,511,"%d. %L",SELECTMAPS+2,LANG_SERVER,"NONE")
new MenuName
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
show_menu(0,mkeys,menu,15,MenuName)
set_task(15.0,"checkVotes")
client_print(0,print_chat,"%L",LANG_SERVER,"TIME_CHOOSE")
client_cmd(0,"spk Gman/Gman_Choose2")
log_amx("Vote: Voting for the nextmap started")
}
loadSettings(filename[]) {
if (!file_exists(filename)) return 0
new szText
new a, pos = 0
new currentMap
get_mapname(currentMap,31)
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) ) {
    if ( szText != ';'
    &&parse(szText, g_mapName ,31 )
    &&is_map_valid( g_mapName )
    &&!equali( g_mapName ,g_lastMap)
    &&!equali( g_mapName ,currentMap) )
      ++g_mapNums
}
return g_mapNums
}
public team_score() {
new team
read_data(1,team,1)
g_teamScore[ (team=='C') ? 0 : 1 ] = read_data(2)
}
public plugin_end() {
new current_map
get_mapname(current_map,31 )
set_localinfo("lastMap",current_map)
}

wtswangba 发表于 2006-12-26 10:12:19

回复: 求蹲坑放风筝插件.请高手改一下

楼主在干什么
写长篇小说呢
问题请具体点切中要点
谁有心思看你这些东西

shinyrose 发表于 2006-12-26 12:21:54

回复: 求蹲坑放风筝插件.请高手改一下

是呀,好想要这个插件,试过好几次修改,我都没有成功.谁能帮忙一下?

baby_fan 发表于 2006-12-26 14:16:17

回复: 求蹲坑放风筝插件.请高手改一下

你发这么长的代码!谁闲着没事给你看呢?提问题要有针对性!写清楚故障点在说!

jop 发表于 2006-12-26 14:43:45

回复: 求蹲坑放风筝插件.请高手改一下

Post by poi000
参考服务器IP 218.17.242.201:27015他的插件我都要!!!!1
...

如果你可以说出他里面所有插件的功能,我想问题就解决了。

shinyrose 发表于 2006-12-26 19:45:29

回复: 求蹲坑放风筝插件.请高手改一下

Post by jop
如果你可以说出他里面所有插件的功能,我想问题就解决了。
其实也很简单,就是蹲坑惩罚,与一般的不同,到蹲坑指数100%时就加快扇耳光的速度,大概4-5次/秒,这样人就会弹起来,然后头上加个蹲坑标志,就是所谓的"放风筝",很搞笑.而点通里的蹲坑插件,扇耳光的速度大概都是1次/秒,所以就没办法实现此效果了.
我试着修改过好几次了,但都以失败告终,我能力有限呀,希望有人能帮忙.谢谢.

sa202017 发表于 2006-12-30 03:32:24

回复: 求蹲坑放风筝插件.请高手改一下

放风筝插件??好东西。。希望有能力的达人能搞一下。。。。

zhangsheng 发表于 2007-1-1 01:25:05

回复: 求蹲坑放风筝插件.请高手改一下

他们服务器用的是这个插件Bad Camper我不用AMXX你自己测试下.
不过和CoVerT服务器比起来差了点.CVT服务器打耳光比它还快.打到99个耳光以后从天上掉下来.

zylcy 发表于 2007-1-4 23:38:35

回复: 求蹲坑放风筝插件.请高手改一下

这个源码用1.60的编译不了哦。,1.75的可以,,怎么办哦

dongtianbao 发表于 2007-2-28 14:10:19

回复: 求蹲坑放风筝插件.请高手改一下

挺简单的,研究一下就明白了
页: [1] 2
查看完整版本: 求蹲坑放风筝插件.请高手改一下