Не дает покоя данная ошибка (anticamp) и ошибка ли это?

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
166
Реакции
34
Помог
3 раз(а)
Ошибка
L 05/21/2018 - 14:25:37: Info (map "de_dust2_2x2") (file "addons/amxmodx/logs/error_20180521.log")
L 05/21/2018 - 14:25:37: [AMXX] Displaying debug trace (plugin "anticamp.amxx", version "1.01c")
L 05/21/2018 - 14:25:37: [AMXX] Run time error 4: index out of bounds
L 05/21/2018 - 14:25:37: [AMXX] [0] anticamp.sma::damage_event (line 209)
ОС
Windows
Билд
Exe version 1.1.2.7 (cstrike)
ReHLDS version: 3.4.0.635-dev
Build date: 11:55:07 Feb 13 2018 (1403)
Build from: https://github.com/dreamstalker/rehlds/commit/20de691
ReGamedll
ReGameDLL version: 5.5.0.291-dev
Build date: 09:37:02 Feb 8 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/40f3bc4
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] Reunion RUN - reunion_mm.dll v0.1.0.9 ini Start Never
[ 2] Rechecker RUN - rechecker_mm.dll v2.5 ini Chlvl ANY
[ 3] ReAuthCheck RUN - reauthcheck_mm.d v0.1.6 ini Start Never
[ 4] AMX Mod X RUN - amxmodx_mm.dll v1.8.3-R ini Start ANY
[ 5] Revoice RUN - revoice_mm.dll v0.1.0.3 ini Start Never
[ 6] WHBlocker RUN - whblocker_mm.dll v1.5.695 ini Chlvl ANY
[ 7] ReSemiclip RUN - resemiclip_mm.dl v2.3.9 ini Chlvl ANY
[ 8] MySQL RUN - mysql_amxx.dll v1.8.3-R pl4 ANY ANY
[ 9] Fun RUN - fun_amxx.dll v1.8.3-R pl4 ANY ANY
[10] Engine RUN - engine_amxx.dll v1.8.3-R pl4 ANY ANY
[11] FakeMeta RUN - fakemeta_amxx.dl v1.8.3-R pl4 ANY ANY
[12] GeoIP RUN - geoip_amxx.dll v1.8.3-R pl4 ANY ANY
[13] CStrike RUN - cstrike_amxx.dll v1.8.3-R pl4 ANY ANY
[14] CSX RUN - csx_amxx.dll v1.8.3-R pl4 ANY ANY
[15] Ham Sandwich RUN - hamsandwich_amxx v1.8.3-R pl4 ANY ANY
[16] ReAPI RUN - reapi_amxx.dll v5.5.0.1 pl4 ANY Never
[17] ReAimDetector RUN - reaimdetector_am v0.2.2 pl4 ANY Never
[18] ReCSDM RUN - csdm_amxx.dll v3.6 pl4 ANY ANY
18 plugins, 18 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.8.3-Re AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.8.3-Re AMXX Dev Team admincmd.amxx running
[ 3] Menus Front-End 1.8.3-Re AMXX Dev Team menufront.amxx running
[ 4] Commands Menu 1.8.3-Re AMXX Dev Team cmdmenu.amxx running
[ 5] Players Menu 1.8.3-Re AMXX Dev Team plmenu.amxx running
[ 6] Maps Menu 1.8.3-Re AMXX Dev Team mapsmenu.amxx running
[ 7] Admin Chat 1.8.3-Re AMXX Dev Team adminchat.amxx running
[ 8] Anti Flood 1.8.3-Re AMXX Dev Team antiflood.amxx running
[ 9] Scrolling Message 1.8.3-Re AMXX Dev Team scrollmsg.amxx running
[ 10] Info. Messages 1.8.3-Re AMXX Dev Team imessage.amxx running
[ 11] Admin Votes 1.8.3-Re AMXX Dev Team adminvote.amxx running
[ 12] NextMap 1.8.3-Re AMXX Dev Team nextmap.amxx running
[ 13] TimeLeft 1.8.3-Re AMXX Dev Team timeleft.amxx running
[ 14] Pause Plugins 1.8.3-Re AMXX Dev Team pausecfg.amxx running
[ 15] Stats Configuration 1.8.3-Re AMXX Dev Team statscfg.amxx running
[ 16] Teleport Menu 1.8.3-Re AMXX Dev Team telemenu.amxx running
[ 17] Multi-Lingual System 1.8.3-Re AMXX Dev Team multilingual.am running
[ 18] Plugin Menu 1.8.3-Re AMXX Dev Team pluginmenu.amxx running
[ 19] Advanced Experience Sy 0.5 Vega serfreeman1337 aes_main.amxx running
[ 20] AES: Informer 0.5 Vega serfreeman1337 aes_informer.am running
[ 21] AES: Admin Tools 0.5 Vega serfreeman1337 aes_exp_editor. running
[ 22] AES: CStrike Addon 0.5 Vega serfreeman1337 aes_exp_cstrike running
[ 24] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 25] Weapon Skin System 0.6.0-50 Mistrick weapon_skin_sys running
[ 26] StatsX 1.8.3 AMXX Dev Team [U statsx_gui.amxx running
[ 28] Stats Marquee 1.2 Travo top_players.amx running
[ 29] Reset Score 1.0 Silenttt resetscore.amxx running
[ 31] Custom NextMap Chooser 1.4d GHW_Chronic GHW_Custom_Next running
[ 32] Team Balancer 1.8b3 Ptahhotep ptb.amxx running
[ 33] Ban Cs 13.0 Empower amx_bancs.amxx running
[ 34] IDEAL VIP by Ba/lePa 3.4 Ba/lePa IDEAL_VIP.amxx running
[ 35] Menu serwerow 0.2.1 Sebul server_menu_v2. running
[ 36] Nice Kicker 8.0 sector nice_kicker.amx running
[ 37] AFK Kicker 1.0b Cheesy Peteza afkkicker.amxx running
[ 38] Block Change Name 1.0 DJ_WEST block_change_na running
[ 39] block ip 0.1 legenda amx_blockip.amx running
[ 40] Auto recording demo 2.0 IzI | Bonaqua (R amx_autodemorec running
[ 44] AntiCamping Advanced 1.01c Homicide- Tweake anticamp.amxx debug
[ 45] Shoot Grenades 1.0 joaquimandrade shootGrenades.a running
[ 46] Lite VoteBan 1.4 neygomon lite_voteban.am running
[ 50] Admin Prefixes 3.0 m0skVi4a ;] AdminPrefixes.a running
[ 51] Parachute 15.01.06 KRoT@L/JTP10181 parachute_rbs.a running
[ 52] Admin Gag 1.0 fomeN amx_admingag.am running
[ 53] Blue Fade 0.1 Stimul Blue_Fade.amxx running
[ 54] Kills Counter 1.0 Safety1st killscounter.am running
[ 55] GunGame AMMO 2.2 Prayer gg_ammo.amxx running
[ 56] Best Player MOTD 1.1.2 OciXCrom crx_bestplayer. running
[ 57] Custom Models 1.3.2 neugomon custom_models.a running
[ 58] WalkGuard 1.3.2 mogel walkguard.amxx running
[ 59] Items Restrict 1.0 s1lent items_restrict. running
[ 60] CSDM Main 2.1.3c CSDM Team csdm_main.amxx running
[ 61] CSDM Equip 2.1.3c CSDM Team csdm_equip.amxx running
[ 62] CSDM Spawns 2.1.3c CSDM Team csdm_spawn_pres running
[ 63] CSDM Misc 2.1.3c CSDM Team csdm_misc.amxx running
[ 64] CSDM Stripper 2.1.3c KWo csdm_stripper.a running
[ 65] CSDM Protection 2.1.3c BAILOPAN csdm_protection running
[ 66] AMXBans: Screens Gm 1.6 Larte Team amxbans_ssban.a running
Исходный код
/* AMXx Mod script 
*
* AntiCamping Advanced
* by Homicide, original code by SpaceDude
*
* This script is a modification to SpaceDude's anti-camping plugin.
* I used Spacedude’s 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-4 0=disables, 1=slap, 2=health reduction, 3=heartbeat | default: 3
* anticamping_time n Sets the speed at which the camp meter increases | default: 20
* anticamping_healthpunish n Sets the amount of health a player losses if anticamping is set to 1(slap) or 2(health reduction) | default: 10
* anticamping_meter 0/1 0=disable campmeter, 1=enable campmeter
*
* Additional tweaking by RaWDeaL:
* 1.01b
* -On de_maps CT can camp until bomb is planted after which T can camp.
* -On all other maps T can camp, but CT has campmeter running, this is for improved gameplay on cs_ and as_maps.
* Recommend using the plugin "Custom Map Configs (JustinHoMi/JGHG)" to disable this plugin on whatever map You like.
* -Replaced heartbeat sound with snoring.
* 1.01c
* Campmeter not visible unless active
* note: this plugin is best used without any other anti-camp plugins
*/

#include <amxmodx>
#include <fun>

#define SND_STOP (1<<5)

new playercoord0[33][3]
new playercoord1[33][3]
new playercoord2[33][3]
new playercoord3[33][3]
new playercoord4[33][3]
new campmeter[33]
new bool:pausecounter[33]
new bool:bombplanted
new bool:de_map
new camptolerancedefending = 180
new camptoleranceattacking = 220



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[0]
pausecounter[id] = false
return PLUGIN_CONTINUE
}

public displaymeter(id) {
if (get_cvar_num("anticamping_meter") != 0) {
if (campmeter[id] > 100) {
set_hudmessage(255, 0, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
} else if (campmeter[id] > 90) {
set_hudmessage(255, 0, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
} else if (campmeter[id] > 80){
set_hudmessage(255, 100, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
} else if (campmeter[id] > 50 ) {
set_hudmessage(255, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
} else if (campmeter[id] > 20 ) {
set_hudmessage(0, 255, 0, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
} else if (campmeter[id] > 0 ) {
set_hudmessage(0, 0, 255, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"Kемпер: %i%",campmeter[id])
}
}
return PLUGIN_HANDLED
}

public checkcamping(){
if (get_cvar_num("anticamping") == 0){
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
new players[32]
new numberofplayers
new variance[3]
new average[3]
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[players[i]]) {
++i
}
if (i >= numberofplayers){
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
id = players[i]
for (j = 0; j < 3; ++j) {
playercoord4[id][j] = playercoord3[id][j]
playercoord3[id][j] = playercoord2[id][j]
playercoord2[id][j] = playercoord1[id][j]
playercoord1[id][j] = playercoord0[id][j]
}
get_user_origin(id, playercoord0[id], 0)
for (j = 0; j < 3; ++j) {
average[j] = (playercoord0[id][j] +
playercoord1[id][j] +
playercoord2[id][j] +
playercoord3[id][j] +
playercoord4[id][j]) / 5
variance[j] = (((playercoord0[id][j] - average[j]) * (playercoord0[id][j] - average[j]) +
(playercoord1[id][j] - average[j]) * (playercoord1[id][j] - average[j]) +
(playercoord2[id][j] - average[j]) * (playercoord2[id][j] - average[j]) +
(playercoord3[id][j] - average[j]) * (playercoord3[id][j] - average[j]) +
(playercoord4[id][j] - average[j]) * (playercoord4[id][j] - average[j])) / 4)
}
variancetotal=variance[0]+variance[1]+variance[2]
standarddeviation=sqrt(variancetotal)
team = get_user_team(id)
if (!de_map){
if (team==2) // Team 1 = Terro, Team 2 = CT
campmeter[id] += (camptoleranceattacking - standarddeviation) / get_cvar_num("anticamping_camptime")
else
campmeter[id] = 0
}
else if (bombplanted){
if (team == 1) // Team 1 = Terro, Team 2 = CT
campmeter[id] = 0
else
campmeter[id] += (camptoleranceattacking-standarddeviation)/get_cvar_num("anticamping_camptime")
}
else{
if (team==2) // Team 1 = Terro, Team 2 = CT
campmeter[id] = 0
else
campmeter[id] += (camptolerancedefending-standarddeviation)/get_cvar_num("anticamping_camptime")
}
if (campmeter[id] < 80 ) {
emit_sound(id,CHAN_VOICE,"player/heartbeat.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
if (campmeter[id] < 0) {
campmeter[id] = 0
} else if (campmeter[id]>100) {
switch(get_cvar_num("anticamping")) {
case 1: {
user_slap(id,get_cvar_num("anticamping_healthpunish"))
}
case 2: {
set_user_health(id, get_user_health(id) - get_cvar_num("anticamping_healthpunish"))
}
case 3: {
emit_sound(id,CHAN_VOICE,"player/heartbeat.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
campmeter[id] = 100
} else if (campmeter[id] > 90) {
switch(get_cvar_num("anticamping")) {
case 1: {
user_slap(id,get_cvar_num("anticamping_healthpunish") / 5)
}
case 2: {
set_user_health(id, get_user_health(id) - get_cvar_num("anticamping_healthpunish") / 5)
}
case 3: {
emit_sound(id,CHAN_VOICE,"player/heartbeat.wav", 0.5, ATTN_NORM, 0, PITCH_NORM)
}
}
} else if (campmeter[id]>80){
switch(get_cvar_num("anticamping")) {
case 1: {
user_slap(id,get_cvar_num("anticamping_healthpunish") / 10)
}
case 2: {
set_user_health(id, get_user_health(id) - get_cvar_num("anticamping_healthpunish") / 10)
}
case 3: {
emit_sound(id,CHAN_VOICE,"player/heartbeat.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_cvar_num("anticamping") != 0) {
new enemy = get_user_attacker(id)
if (get_user_team(id)!=get_user_team(enemy)) {
campmeter[id]=0
campmeter[enemy]=0
}
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}

public new_round(id) {
if (get_cvar_num("anticamping") != 0) {
bombplanted=false
pausecounter[id]=true
campmeter[id]=0
new Float:freezetime = get_cvar_float("mp_freezetime")+1.0
new parm[1]
parm[0]=id
set_task(freezetime,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}

public bartime_event(id) {
if (get_cvar_num("anticamping") != 0) {
pausecounter[id]=true
campmeter[id]=0
new Float:bar_time=float(read_data(1)+1)
new parm[1]
parm[0]=id
set_task(bar_time,"unpausecounter",0,parm,1)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}

public bomb_planted() {
if (get_cvar_num("anticamping") != 0) {
bombplanted=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}

public got_bomb(id) {
if (get_cvar_num("anticamping") != 0) {
de_map=true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}

public round_end() {
if (get_cvar_num("anticamping") != 0) {
new players[32]
new numberofplayers
new id
new i
get_players(players, numberofplayers, "a")
for (i = 0; i < numberofplayers; ++i) {
id=players[i]
pausecounter[id]=true
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}

public plugin_precache() {
precache_sound("player/heartbeat.wav")
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("AntiCamping Advanced","1.01c","Homicide- Tweaked by RaWDeaL, original code by SpaceDude")
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_cvar("anticamping","3",0) //0=Disabled, 1=Slap, 2=Health Reduction, 3=Heartbeat
register_cvar("anticamping_camptime","20",0) //Amount of time allowed to camp
register_cvar("anticamping_healthpunish","10",0) //Amount of health taken due to punishment
register_cvar("anticamping_meter","1",0) //Display 'campmeter' to each cilent
set_task(1.0,"checkcamping",1)
return PLUGIN_CONTINUE
}
Где то в этом куске кода, скрывается вся тайна. Как я понимаю это часть кода, которая отвечает за наказание игрока который получает наказание после определенного времени без движения. (но это только предположение) :pardon:
Код:
public damage_event(id) {
    if (get_cvar_num("anticamping") != 0) {
        new enemy = get_user_attacker(id)
        if (get_user_team(id)!=get_user_team(enemy)) {
            campmeter[id]=0
            campmeter[enemy]=0
        }
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
Буду благодарен если кто нибудь подскажет как исправить ошибку.
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
198
Реакции
273
Помог
5 раз(а)
Pe4enbka,
Ошибка обозначает: выход за границы массива. По ощущению, в условие нужно добавить проверку на то, что урон наносит игрок.
 
Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
Проще говоря, нужно проверить на валидность атакующего.
 
Сообщения
198
Реакции
273
Помог
5 раз(а)
Код:
public damage_event(id) {
    if (get_cvar_num("anticamping") != 0) {
        new enemy = get_user_attacker(id)
-       if (get_user_team(id)!=get_user_team(enemy)) {
+       if (get_user_team(id)!=get_user_team(enemy) && enemy < MaxClients ){
            campmeter[id]=0
            campmeter[enemy]=0
        }
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу