flashbang_ban.amxx ERROR (native "SetHookChainReturn")

Сообщения
110
Реакции
6
Помог
2 раз(а)
Ошибка
L 11/24/2019 - 07:16:17: [ReAPI] SetHookChainReturn: trying to set return value with incompatible type, expected 'ATYPE_BOOL'; got 'ATYPE_INTEGER'
L 11/24/2019 - 07:16:17: [AMXX] Run time error 10 (plugin "flashbang_ban.amxx") (native "SetHookChainReturn") - debug not enabled!
ОС
Linux
Amx Mod X
1.9.0.5263
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.692-dev
Build date: 18:58:01 Sep 21 2019 (1988)
Build from: https://github.com/dreamstalker/rehlds/commit/e7232be
ReGamedll
ReGameDLL version: 5.12.0.425-dev
Build date: 08:48:23 Nov 2 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/fd06d65
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5263 ini Start ANY
[ 3] Reunion RUN - reunion_mm_i386.so v0.1.0.135 ini Start Never
[ 4] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 5] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 6] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 7] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[ 9] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[10] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[11] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[12] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl2 ANY Never
X[13] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl2 ANY ANY [14] ReAPI RUN - reapi_amxx_i386.so v5.11.0.190-dev pl2 ANY Never
[15] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] AMXBans Core 6.13 YamiKaitou amxbans_core.am running
[ 2] AMXBans Main 6.13 YamiKaitou amxbans_main.am running
[ 3] FreshBans 1.4.3b kanagava fresh_bans.amxx running
[ 4] CVAR Hostname Blocker 1.0 block_hostname. running
[ 5] Admin Commands 1.9.0.5263 AMXX Dev Team admincmd.amxx running
[ 6] Admin Help 1.9.0.5263 AMXX Dev Team adminhelp.amxx running
[ 7] Menus Front-End 1.9.0.5263 AMXX Dev Team menufront.amxx running
[ 8] Commands Menu 1.9.0.5263 AMXX Dev Team cmdmenu.amxx running
[ 9] Players Menu 1.9.0.5263 AMXX Dev Team plmenu.amxx running
[ 10] Teleport Menu 1.9.0.5263 AMXX Dev Team telemenu.amxx running
[ 11] Maps Menu 1.9.0.5263 AMXX Dev Team mapsmenu.amxx running
[ 12] Plugin Menu 1.9.0.5263 AMXX Dev Team pluginmenu.amxx running
[ 13] Restrict Weapons 1.9.0.5263 AMXX Dev Team restmenu.amxx running
X[ 14] Admin Chat 1.9.0.5263 AMXX Dev Team adminchat.amxx running [ 15] Anti Flood 1.9.0.5263 AMXX Dev Team antiflood.amxx running
[ 16] Scrolling Message 1.9.0.5263 AMXX Dev Team scrollmsg.amxx running
[ 17] Info. Messages 1.9.0.5263 AMXX Dev Team imessage.amxx running
[ 18] Admin Votes 1.9.0.5263 AMXX Dev Team adminvote.amxx running
[ 19] Stats Configuration 1.9.0.5263 AMXX Dev Team statscfg.amxx running
[ 20] StatsX 1.9.0.5263 AMXX Dev Team statsx.amxx running
[ 21] CS Misc. Stats 1.8.2 AMXX Dev Team miscstats.amxx running
[ 22] Chat Manager 4.4 OciXCrom crx_chatmanager running
[ 23] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 24] OciXCrom's Rank System 3.8.2 OciXCrom crx_ranksystem. running
[ 25] Fast Knife 1.0 OciXCrom crx_fast_knife. running
[ 26] c4 timer 1.1 cheap_suit c4timer.amxx running
[ 27] CS Revo: Objetivo ou K 1.0 Wilian M. csr_objetivo.am running
[ 28] CS Revo: Change Map Re 1.0 Wilian M. csrevo_changema running
X[ 29] CS Revo: Fast Sniper 1.0 Wilian M. csrevo_fast_sni running [ 30] KiLL Assist poka_4to_b PRoSToTeM@ Kill_assist_rea running
[ 31] [ReApi] Killer ScreenF 0.0.4 Vaqtincha reapi_killer_sc running
[ 32] TimePass-Destroyer 1.0 Challenge & Dark advanced_destro running
[ 33] [ReAPI:AMXX] Buy Nades 0.0.3a steelzorrr amxx_buy_nades_ running
[ 34] Flashbang Ban 0.2 mx?! flashbang_ban.a running
[ 35] VIP_Xtreme 3.5 $ohaibXtreme VIP.amxx running
[ 36] Auto Demo Recorder 1.5 IzI amx_demorecorde running
[ 37] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 38] AMXX Gag 1.5.0 xPaw & Exolent amx_gag.amxx running
[ 39] [ReAPI] No Team Flash 0.0.3 Vaqtincha no_team_flash.a running
[ 40] Ping Faker 1.0 Hattrick pingfaker2.amxx running
[ 41] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 42] [ReAPI] Block 'Fire in 0.0.1 sergrib reapi_block_FIT running
[ 43] Weapon Icon 1.2 hoboman313/Zenix weapon_icon.amx running
X[ 44] Simple Reset Score 1.0 PG resetscore.amxx running [ 45] KGB Bots 2.1 OvidiuS & Desika kgbbots.amxx running
45 plugins, 45 running
Автор плагина
Flashbang Ban 0.2 Author: BlackSignature | Creation date [Dec 11, 2018]
Версия плагина
0.2
Исходный код
/*
При просмотре и редактировании данного файла необходимо использовать кодировку 'UTF-8 без BOM'

Требования:
* AMXX 1.8.3, либо новее
* ReGameDLL_CS, Reapi
*/

/* История изменений:
0.2 ->
* Добавлена опция ответного ослепления (квар 'flashban_reflect_flash')
* Исправлен неверный lang-ключ 'FLBAN__FLASHED_BY' (спасибо Fanfar: https://dev-cs.ru/members/2074/)
*/

new const PLUGIN_NAME[] = "Flashbang Ban"
new const PLUGIN_VERSION[] = "0.2"
new const PLUGIN_AUTHOR[] = "mx?!"

#include <amxmodx>
#include <reapi>

#define chx charsmax

#define AUTO_CFG // Создавать конфиг с кварами в 'configs/plugins', и запускать его ?

new const SOUND__BLIP1[] = "sound/buttons/blip1.wav"
new const SOUND__ERROR[] = "sound/buttons/button2.wav"
new const SOUND__TUTOR_MSG[] = "sound/events/tutor_msg.wav"

enum {
HAS_AUTH,
IS_CONNECTED
}

enum _:CVAR_ENUM {
CVAR__ENABLED,
CVAR__MAX_WARNS,
CVAR__BAN_ROUNDS,
CVAR__DEC_WARNS,
CVAR__ONLY_FULL,
CVAR__REFLECT,
CVAR__IMMUNE_FLAGS
}

enum _:RGB { any:R, any:G, any:B }

const FULL_BLIND = 255

new g_eCvar[CVAR_ENUM], g_szAuthID[24], g_iBan[MAX_PLAYERS + 1], g_iWarn[MAX_PLAYERS + 1]
new Trie:g_tTrie, g_szName[MAX_NAME_LENGTH], g_iPlayerFlags[MAX_PLAYERS + 1], g_MsgScreenFade

/* -------------------- */

public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_dictionary("flashbang_ban.txt")

RegisterHookChain(RG_PlayerBlind, "OnPlayerBlind_Pre")
RegisterHookChain(RG_ThrowFlashbang, "OnThrowFlashbang_Pre")
RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "OnHasRestrictItem_Pre")
RegisterHookChain(RG_CSGameRules_RestartRound, "OnRestartRound_Pre")

bind_pcvar_num(create_cvar("flashban_enabled", "1", .description = "Working state"), g_eCvar[CVAR__ENABLED])
bind_pcvar_num(create_cvar("flashban_max_warns", "3", .description = "Warns limit to ban flash", .has_min = true, .min_val = 1.0), g_eCvar[CVAR__MAX_WARNS])
bind_pcvar_num(create_cvar("flashban_ban_rounds", "3", .description = "How many rounds flash will be banned", .has_min = true, .min_val = 1.0), g_eCvar[CVAR__BAN_ROUNDS])
bind_pcvar_num(create_cvar("flashban_dec_warns", "1", .description = "How many warns decreased every round", .has_min = true, .min_val = 1.0), g_eCvar[CVAR__DEC_WARNS])
bind_pcvar_num(create_cvar("flashban_only_full", "1", .description = "Increase warn only if fullflashed"), g_eCvar[CVAR__ONLY_FULL])
bind_pcvar_num(create_cvar("flashban_reflect_flash", "1", .description = "Reflect teamflash to flasher"), g_eCvar[CVAR__REFLECT])

new szVal[12], pCvar = create_cvar("flashban_immune_flags", "a", .description = "Immunity flags")
hook_cvar_change(pCvar, "func_CvarHook")
get_pcvar_string(pCvar, szVal, chx(szVal))
func_ReadFlags(szVal)

g_tTrie = TrieCreate()
g_MsgScreenFade = get_user_msgid("ScreenFade")

#if defined AUTO_CFG
AutoExecConfig()
#endif
}

/* -------------------- */

public func_CvarHook(pCvar, szOldVal[], szNewVal[]) {
func_ReadFlags(szNewVal)
}

/* -------------------- */

stock func_ReadFlags(szVal[]) {
g_eCvar[CVAR__IMMUNE_FLAGS] = read_flags(szVal)
}

/* -------------------- */

public OnPlayerBlind_Pre(iVictim, iInflictor, iAttacker, Float:fFadeTime, Float:fFadeHold, iAlpha, Float:fColor[RGB]) {
if(
!g_eCvar[CVAR__ENABLED]
||
iVictim == iAttacker
||
!CheckFlag(iAttacker, IS_CONNECTED)
||
!IsInSameTeam(iVictim, iAttacker)
) {
return
}

get_user_name(iAttacker, g_szName, chx(g_szName))
client_print_color(iVictim, print_team_default, "%L", iVictim, "FLBAN__CHAT_FLASHED_BY", g_szName)
console_print(iVictim, "%L", iVictim, "FLBAN__CON_FLASHED_BY", g_szName)
rg_send_audio(iVictim, SOUND__TUTOR_MSG)

/* --- */

rg_send_audio(iAttacker, SOUND__TUTOR_MSG)

get_user_name(iVictim, g_szName, chx(g_szName))

if(get_user_flags(iAttacker) & g_eCvar[CVAR__IMMUNE_FLAGS]) {
client_print_color( iAttacker, print_team_default, "%L", iAttacker,
iAlpha == FULL_BLIND ? "FLBAN__IMM_FLASHED_PLAYER_FULL" : "FLBAN__IMM_FLASHED_PLAYER_PART", g_szName );

return
}

if(!g_eCvar[CVAR__ONLY_FULL] || iAlpha == FULL_BLIND) {
g_iWarn[iAttacker]++
}

if(g_eCvar[CVAR__REFLECT] && IsNotFullyBlinded(iAttacker, iAlpha)) {
func_FlashPlayer(iAttacker, fFadeTime, fFadeHold, fColor, iAlpha)
}

client_print_color( iAttacker, print_team_default, "%L", iAttacker,
iAlpha == FULL_BLIND ? "FLBAN__FLASHED_PLAYER_FULL" : "FLBAN__FLASHED_PLAYER_PART",
g_szName, g_iWarn[iAttacker], g_eCvar[CVAR__MAX_WARNS] );

if(g_iWarn[iAttacker] < g_eCvar[CVAR__MAX_WARNS] || g_iBan[iAttacker]) {
return
}

client_print(iAttacker, print_center, "%L", iAttacker, "FLBAN__CENTER_FLASH_BANNED")
g_iBan[iAttacker] = g_eCvar[CVAR__BAN_ROUNDS]
}

/* -------------------- */

public OnThrowFlashbang_Pre(id) {
if(!g_iBan[id]) {
return HC_CONTINUE
}

func_BanInfo(id)
SetHookChainReturn(ATYPE_INTEGER, false)
return HC_SUPERCEDE
}

/* -------------------- */

public OnHasRestrictItem_Pre(id, ItemID:iItem, ItemRestType:iRestType) {
if(!g_iBan[id] || iRestType != ITEM_TYPE_BUYING || iItem != ITEM_FLASHBANG) {
return HC_CONTINUE
}

func_BanInfo(id)
SetHookChainReturn(ATYPE_INTEGER, true)
return HC_SUPERCEDE
}

/* -------------------- */

public OnRestartRound_Pre() {
if(!g_eCvar[CVAR__ENABLED]) {
return
}

new iPlayers[MAX_PLAYERS], iPlCount

get_players(iPlayers, iPlCount, "ch")

for(new i, iPlayer; i < iPlCount; i++) {
iPlayer = iPlayers[i]

if(g_iWarn[iPlayer]) {
g_iWarn[iPlayer] = max(0, g_iWarn[iPlayer] - g_eCvar[CVAR__DEC_WARNS])
}

if(!g_iBan[iPlayer]) {
continue
}

g_iBan[iPlayer]--

if(!g_iBan[iPlayer]) {
rg_send_audio(iPlayer, SOUND__BLIP1)
client_print_color(iPlayer, print_team_default, "%L", iPlayer, "FLBAN__BAN_EXPIRED")
}
}
}

/* -------------------- */

stock func_BanInfo(id) {
rg_send_audio(id, SOUND__ERROR)
client_print(id, print_center, "%L", id, "FLBAN__CENTER_FLASH_BANNED")
client_print_color(id, print_team_red, "%L", id, "FLBAN__INFO", g_iBan[id])
}

/* -------------------- */

public client_authorized(id) {
SetFlag(id, HAS_AUTH)

if(CheckFlag(id, IS_CONNECTED)) {
func_AgregatePlayer(id)
}
}

/* -------------------- */

public client_putinserver(id) {
SetFlag(id, IS_CONNECTED)

if(CheckFlag(id, HAS_AUTH)) {
func_AgregatePlayer(id)
}
}

/* -------------------- */

public func_AgregatePlayer(id) {
if(!g_eCvar[CVAR__ENABLED]) {
return
}

get_user_authid(id, g_szAuthID, chx(g_szAuthID))

if(TrieGetCell(g_tTrie, g_szAuthID, g_iBan[id])) {
TrieDeleteKey(g_tTrie, g_szAuthID)
}
}

/* -------------------- */

public client_disconnected(id) {
g_iPlayerFlags[id] = 0
g_iWarn[id] = 0

if(g_iBan[id]) {
get_user_authid(id, g_szAuthID, chx(g_szAuthID))
TrieSetCell(g_tTrie, g_szAuthID, g_iBan[id])
g_iBan[id] = 0
}
}

/* -------------------- */

stock func_FlashPlayer(id, Float:fOutTime, Float:fHoldTime, Float:fColor[RGB], iAlpha) {
message_begin(MSG_ONE_UNRELIABLE, g_MsgScreenFade, .player = id)
write_short(FixedUnsigned16(fOutTime)) // SCREENFADE__OUT_TIME (duration / fade time)
write_short(FixedUnsigned16(fHoldTime)) // SCREENFADE__HOLD_TIME (hold time)
write_short(0x0000) // fade in
write_byte(floatround(fColor[R]))
write_byte(floatround(fColor[G]))
write_byte(floatround(fColor[B]))
write_byte(iAlpha)
message_end()

new Float:fGameTime = get_gametime()

set_member(id, m_blindStartTime, fGameTime)
set_member(id, m_blindFadeTime, fOutTime)
set_member(id, m_blindHoldTime, fHoldTime)
set_member(id, m_blindUntilTime, fGameTime + fOutTime)
set_member(id, m_blindAlpha, iAlpha)
}

/* -------------------- */

stock FixedUnsigned16(Float:fVal, iScale = (1 << 12)) {
return clamp(floatround(fVal * iScale), 0, 0xFFFF)
}

/* -------------------- */

stock bool:IsNotFullyBlinded(id, iAlpha) {
return bool:(
get_member(id, m_blindAlpha) < iAlpha
||
Float:get_member(id, m_blindStartTime) + Float:get_member(id, m_blindHoldTime) < get_gametime()
);
}

/* -------------------- */

public plugin_end() {
TrieDestroy(g_tTrie)
}

/* -------------------- */

stock SetFlag(id, iFlag) (g_iPlayerFlags[id] |= (1 << iFlag))
stock ClearFlag(id, iFlag) (g_iPlayerFlags[id] &= ~(1 << iFlag))
stock CheckFlag(id, iFlag) return (g_iPlayerFlags[id] & (1 << iFlag))
stock bool:IsInSameTeam(iPlayer1, iPlayer2) return (get_member(iPlayer1, m_iTeam) == get_member(iPlayer2, m_iTeam))
L 11/24/2019 - 07:06:16: Start of error session.
L 11/24/2019 - 07:06:16: Info (map "de_inferno") (file "addons/amxmodx/logs/error_20191124.log")
L 11/24/2019 - 07:06:16: [ReAPI] SetHookChainReturn: trying to set return value with incompatible type, expected 'ATYPE_BOOL'; got 'ATYPE_INTEGER'
L 11/24/2019 - 07:06:16: [AMXX] Run time error 10 (plugin "flashbang_ban.amxx") (native "SetHookChainReturn") - debug not enabled!
L 11/24/2019 - 07:06:16: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
 
Последнее редактирование модератором:

d3m37r4

111111
Сообщения
1,454
Реакции
1,194
Помог
10 раз(а)
Учитесь пользоваться поиском. И вот эту портянку на метр, которая после исходного кода, можно было бы под спойлер кинуть.
 

Вложения

Сообщения
28
Реакции
25
Помог
1 раз(а)
Строчка: 168

Изменить:
SetHookChainReturn(ATYPE_INTEGER, true)

На:
SetHookChainReturn(ATYPE_BOOL, true)
 

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

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