回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
这个是Amxx的图片回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
要的就是这个啦!呵呵.zhangsheng能不能把你AMXX的源码发一下,我想知道是如何实现的,还有蹲坑标志的文件名是什么?还有那蹲坑系数显示的位置不太显眼,我想改一下效果.我怎么没有楼上的效果?anticamping_sgin我已经设置为1了.回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
打耳光打到49就可以了一局可以墩两次还有就是有写蹲坑的上面没蹲坑的图片 只能看到血:cold:回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
Post by qq457417918打耳光打到49就可以了 一局可以墩两次 还有就是有写蹲坑的上面没蹲坑的图片 只能看到血:cold:
希望zhangsheng能把源码发出来,因为好多玩家被打耳光不知道怎么回事,那蹲坑系数的显示太不显眼了.还有那到80%就开始打耳光,能不能到95%才开始,80%-95%慢速打.这样比较好.
回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
你去AMX官方网找到一个叫amx_uberslap的插件把里面的代码复制到反蹲坑代码里面.然后把打耳光那里改成这个插件打耳光参数回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
代码是AMXX找到的,我加进去了,速度我也知道怎么改,就是campmeter>100才利用加进去的函数admin_slap(),编译只剩下一个错误了。就是不知道如何传递参数,能不能帮我看看呀?以下是代码加个该函数的代码:/* 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 <amxmisc>
#include <csx>
#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 camp_round_count//某局蹲坑次数
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 p_anticamping_max_round_count
new g_MyMsgSync
public plugin_init() {
register_plugin("AntiCamping Advanced XX","1.1","kinsprite/Rulzy")
register_dictionary("anticamping_multi.txt")
register_event("Damage", "damage_event", "b", "2!0")
register_event("BarTime","bartime_event","b")
register_event("ResetHUD", "new_round", "b")
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")
register_event("TextMsg", "game_restart", "a", "2&#Game_Commencing", "2&#Game_will_restart")// 重新开局added by Rulzy
register_logevent("planted_bomb",3,"1=triggered","2=Planted_The_Bomb")// C4已经布置added by Rulzy
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=关闭(但是立即处死玩家并且以后只要蹲坑状态达到100%就处死)
p_anticamping_de_map_allow = register_cvar("anticamping_de_map_allow","1") //de_地图上是否允许防守方蹲坑
p_anticamping_max_round_count = register_cvar("anticamping_max_round_count","2") //一局中最多算的蹲坑次数
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 admin_slap(id,level,cid){
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new name
new arg
read_argv(1,arg,31)
new player = cmd_target(id,arg,5)
if (!player)
return PLUGIN_HANDLED
new ids
ids = player
get_user_name(player,name,32)
disarm_player(id,player)
set_task(0.1, "slap_player", 0, ids, 1, "a", 100)
// set_task(11.5, "last_words", 0, ids, 1, "a", 0)
return PLUGIN_HANDLED
}
public disarm_player(id,victim){
new name, origin
get_user_origin(victim,origin)
origin -= 2000
set_user_origin(victim,origin)
new iweapons, wpname, inum
get_user_weapons(victim,iweapons,inum)
for(new a=0;a<inum;++a){
get_weaponname(iweapons,wpname,31)
engclient_cmd(victim,"drop",wpname)
}
engclient_cmd(victim,"weapon_knife")
origin += 2005
set_user_origin(victim,origin)
get_user_name(victim,name,31)
return PLUGIN_CONTINUE
}
public slap_player(ids[]) {
new id = ids
new power = 1,nopower= 0
if (get_user_health(id) > 1){
user_slap(id,power)
} else {
user_slap(id,nopower)
}
return PLUGIN_CONTINUE
}
public displaymeter(id) {
if (get_pcvar_num(p_anticamping_meter) != 0) {
new buffer,temp,pos
new cts, ts, ctsnum, tsnum
get_players(cts, ctsnum, "ae", "CT")
get_players(ts, tsnum, "ae", "TERRORIST")
if(ctsnum == 0 || tsnum == 0){
campmeter = 0
pos += format(buffer,127-pos,"%L",id,"ANITCAMP_0")
}
else 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, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
} else if (campmeter > 90) {
set_hudmessage(255, 0, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
} else if (campmeter > 80){
set_hudmessage(255, 100, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
} else if (campmeter > 50 ) {
set_hudmessage(255, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
} else if (campmeter > 20 ) {
set_hudmessage(0, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
} else {
set_hudmessage(0, 0, 255, -1.0, 0.85, 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")
client_cmd(id, "echo %s", temp)
new userid = get_user_userid(id)
server_cmd("kick #%d %s", userid, temp)
server_cmd("kick #%d", userid)
}
}
}
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){
camp_round_count++
new max_round_count = get_pcvar_num(p_anticamping_max_round_count)
if(max_round_count == 0 || camp_round_count<=max_round_count)
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)
camp_round_count=0
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 planted_bomb() {
if (get_pcvar_num(p_anticamping))
bombplanted=true
return PLUGIN_CONTINUE
}
public got_bomb(id) {
if (get_pcvar_num(p_anticamping))
de_map=true
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 game_restart(id) {
new players,playercount,player
get_players(players,playercount)
for(new i=0;i<playercount;i++)
{
player=players
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
}
回复: ATAC里的扇耳光函数能不能整合到蹲坑惩罚源码里?
} else if ((campmeter[id]>100) && is_user_connected(id)) {if (contain(cvarflags,"a") != -1) {
user_slap(id,get_pcvar_num(p_anticamping_healthpunish))
}
user_slap换成admin_slap(),该如何传递参数?