Поправить исходник для HeadShot Vote

Сообщения
26
Реакции
0
Ошибка
L 12/08/2019 - 06:42:10: [AMXX] Displaying debug trace (plugin "hsv.amxx", version "2.0")
L 12/08/2019 - 06:42:10: [AMXX] Run time error 4: index out of bounds
L 12/08/2019 - 06:42:10: [AMXX] [0] hsv.sma::ColorChat (line 276)
L 12/08/2019 - 06:42:10: [AMXX] [1] hsv.sma::EndVote (line 185)
ОС
Linux
Amx Mod X
1,9,0
Билд
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)
ReGamedll
ReGameDLL version: 5.12.0.425-dev
Build date: 08:48:23 Nov 2 2019
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Список метамодулей
[ 1] Reunion       RUN   -    reunion.so                v0.1.0.92c         ini  Start Never
[ 2] AMX Mod X RUN - amxmodx.so v1.9.0.5235 ini Start ANY
[ 3] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 4] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 5] WHBlocker RUN - whblocker.so v1.5.696 ini ANY
[ 6] Revoice RUN - revoice.so v0.1.0.33 ini Start Never
[ 7] MySQL RUN - mysql_amxx_i386.so v1.9.0.5235 pl2 ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5235 pl2 ANY
[ 9] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5219 pl2 ANY
[10] Engine RUN - engine_amxx_i386.so v1.9.0.5235 pl2 ANY ANY
[11] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5235 pl2 ANY ANY
[12] AuthEmu RUN - authemu_amxx_i386.so v4.2.12.311-dev+m pl2 ANY Never
[13] CSX RUN - csx_amxx_i386.so v1.9.0.5219 pl2 ANY ANY
[14] ReAPI RUN - reapi_amxx_i386.so v5.11.0.191-dev pl2 ANY Never
[15] Fun RUN - fun_amxx_i386.so v1.9.0.5235 pl2 ANY ANY
Список плагинов
[  1] admin_loader            v0.5.7       kanagava          admin_loader.am  running  
[ 2] FreshBans v1.4.3b kanagava fresh_bans.amxx running
[ 3] Advanced Gag v1.4.2 neygomon amx_gag.amxx running
[ 4] AIM detector v0.9.2cs kanagava aim_detector.am running
[ 5] DevMsCore v1.2 gyxoBka DevMs_Core.amxx running
[ 6] DevMs Flag v1.0 gyxoBka DevMs_Flag.amxx running
[ 7] DevMs PlayerMenu v1.0 gyxoBka DevMs_PlayerMen running
[ 8] AuthEmu API v1.0 Dev-MS Team authemu.amxx running
[ 9] [183] Army Ranks Ultim v18.05.15 SKAJIbnEJIb army_ranks_ulti running
[ 10] [183] CsStats MySQL v19.08.27 SKAJIbnEJIb csstats_mysql.a running
[ 11] Stats Configuration v18.05.15 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 12] [183] StatsX RBS v19.08.28 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 13] [183] Chat RBS v19.08.01 SKAJIbnEJIb chat_rbs.amxx running
[ 14] [183] Ultimate Weapons v18.08.08BE SKAJIbnEJIb ultimate_weapon running
[ 15] [183] VIP RBS v19.09.04BE SKAJIbnEJIb vip_rbs.amxx running
[ 16] [183] Top Award RBS v19.08.28 SKAJIbnEJIb topaward_rbs.am running
[ 17] Admin Chat v1.9.0.5235 AMXX Dev Team adminchat.amxx running
[ 18] Admin Commands v1.9.0.5235 AMXX Dev Team admincmd.amxx running
[ 19] Admin Voice Chat v0.2 mx?! admin_voice_cha running
[ 20] Commands Menu v1.9.0.5235 AMXX Dev Team cmdmenu.amxx running
[ 21] Menus Front-End v1.9.0.5232 AMXX Dev Team menufront.amxx running
[ 22] Maps Menu v1.9.0.5235 AMXX Dev Team mapsmenu.amxx running
[ 23] Players Menu v1.9.0.5232 AMXX Dev Team plmenu.amxx running
[ 24] Plugin Menu v1.9.0.5235 AMXX Dev Team pluginmenu.amxx running
[ 25] Advanced Client Checke v0.3.6 Mistrick cmdchecker.amxx running
[ 26] Restrict Weapons v1.9.0.5235 AMXX Dev Team restmenu.amxx running
[ 27] Admin Votes v1.9.0.5235 AMXX Dev Team adminvote.amxx running
[ 28] Warmup v1.2.2 Radius warmup.amxx stopped
[ 29] ReAPI Test v1.0 s1lent reapi_test.amxx running
[ 30] Ping Checker v26.0.1 RC1 h1k3 ping_checker.am running
[ 31] Mode 2x2 v2.5re s1lent mode_2x2.amxx running
[ 32] Autoresponder/Advertis v0.5 MaximusBrood ad_manager.amxx running
[ 33] Map Manager: Core v3.0.0 Mistrick map_manager.amx running
[ 34] [JD]mute v1.2 Jack Daniel`s jb_menu.amxx running
[ 35] Block 'Fire in the hol v0.1 Safety1st block_fire_in_t running
[ 36] Flasher Name v1.0.0 Vaqtincha flasher_name.am running
[ 37] Auto Demo Recorder v2.3 F@nt0M auto_demo_recor running
[ 38] Block HudTextArgs v1.0 ConnorMcLeod block_hudtextar running
[ 39] ReChecker Logging v1.0 custom rc_logging.amxx running
[ 40] FM ResetScore v0.1 neygomon fm_resetscore.a running
[ 41] Change Game Name v1.2 ReHLDS Team change_game_nam running
[ 42] AFK Control v1.4.1 [Rnd neygomon afk_control.amx running
[ 43] Auto Team Balance Adva v1.5.1 Radius auto_team_balan running
[ 44] SF Warn Menu v0.1.4g serfreeman1337 sf_warn_menu.am running
[ 45] [183] Snipers RBS v19.09.10 SKAJIbnEJIb snipers_rbs.amx running
[ 46] [182] Spect Bot v17.08.28 SKAJIbnEJIb & Bo spectbot.amxx running
[ 47] Map Manager: Scheduler v0.1.0 Mistrick map_manager_sch running
[ 48] Map Manager: Rtv v0.0.4 Mistrick map_manager_rtv running
[ 49] Map Manager: Nominatio v0.0.8 Mistrick map_manager_nom running
[ 50] Map Manager: BlockList v0.0.3 Mistrick map_manager_blo running
[ 51] Map Manager: Online so v0.0.2 Mistrick map_manager_onl running
[ 52] Map Manager: Effects v0.0.8 Mistrick map_manager_eff running
[ 53] Map Manager: Informer v0.0.5 Mistrick map_manager_inf running
Автор плагина
[gm-project.net] #Staff / Lt.RAT
Версия плагина
2.0
Исходный код
#include <amxmodx>
#include <fun>
#include <fakemeta_util>
#include <hamsandwich>

#define PLUGIN "HSMode vote"
#define VERSION "2.0"
#define AUTHOR "[gm-project.net] #Staff / Lt.RAT"

new g_VoteMenu
new g_Votes[2]
new g_Voting

new g_VoteVote[33]
new gHeadShot

new CvarRatio

new HamHook: fwd_TraceAttack, CvarKnife
new g_iMsgTeamInfo, g_iMsgSayText

new g_msgScreenFade
new g_MaxPlayers

enum Color {
NORMAL = 1,
GREEN,
RED,
BLUE
};

new TeamName[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
};

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_dictionary("hsv.txt")
register_cvar("hsv_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);

CvarKnife = register_cvar ( "hsv_knife", "0")
CvarRatio = register_cvar ( "hsv_cratio", "0.6" )
g_MaxPlayers = global_get(glb_maxClients)

g_iMsgSayText = get_user_msgid( "SayText" );
g_iMsgTeamInfo = get_user_msgid( "TeamInfo" );
g_msgScreenFade = get_user_msgid("ScreenFade")

set_task(30.0,"StartVote")
}

public client_connect(id) {
if(gHeadShot) {
set_task(15.0,"DispInfo", id)
}
}

public cmd_startvote(id) {
g_VoteVote[id]=1

new name [32]
get_user_name(id, name, 31)

new VoteYes, VoteNo
for( new i = 1; i <= g_MaxPlayers; i++ )
{
if( is_user_connected(i) )
{
if (g_VoteVote[i]) {
VoteYes++
} else {
VoteNo++
}
}
}
ColorChat(0, RED, "[HsV]^1 %L", id, "HSV_PLVOTED", name)

if (VoteYes > get_pcvar_float(CvarRatio)*(VoteYes+VoteNo)) {
ColorChat(0, RED, "[HsV]^1 %L", id, "HSV_STNEWVOTE")
set_task(5.0,"StartVote")
}
}

public client_disconnected(id) {
g_VoteVote[id]=0
}

public DispInfo(id) {
ColorChat(0, RED, "[HsV] ^1 %L", id, "HSV_CONMSG")
}

public StartVote() {
static s_MenuHeader[64]
static s_MenuItem1[64]
static s_MenuItem2[64]

formatex(s_MenuHeader, charsmax(s_MenuHeader), "%L", LANG_PLAYER, "HSV_MHEADER")
formatex(s_MenuItem1, charsmax(s_MenuItem1), "%L", LANG_PLAYER, "HSV_MCLASSIC")
formatex(s_MenuItem2, charsmax(s_MenuItem2), "%L", LANG_PLAYER, "HSV_MHSONLY")

for( new plr = 1; plr <= g_MaxPlayers; plr++ ) {
if (is_user_alive(plr) && is_user_connected(plr)) {
set_pev(plr, pev_flags, pev(plr, pev_flags) | FL_FROZEN)
}
}

set_task ( 0.1, "ScreenFade", 0)

g_VoteMenu = menu_create("s_MenuHeader", "menu_handler")

menu_additem(g_VoteMenu, s_MenuItem1, "0", 0)
menu_additem(g_VoteMenu, s_MenuItem2, "1", 0)

new s_Players[32], i_Num, i_Player
get_players(s_Players, i_Num)

for (new i; i < i_Num; i++)
{
i_Player = s_Players[i]

menu_display(i_Player, g_VoteMenu, 0)

g_Voting++
}

set_task(5.2, "EndVote")

g_Votes[0] = g_Votes[1] = 0
return PLUGIN_HANDLED
}

public menu_handler(id, menu, item) {
if (item == MENU_EXIT)
return PLUGIN_HANDLED

new s_Data[6], s_Name[64], i_Access, i_Callback
new name[32]
get_user_name(id, name, 31)
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

new i_Vote = str_to_num(s_Data)

ColorChat(0, RED, "[HsV]^1 %L", id, "HSV_VOTED", name, (item ? "HS mode" : "Classic game"))
g_Votes[i_Vote]++

return PLUGIN_HANDLED
}

public EndVote() {
if ( fwd_TraceAttack == HamHook:0 ) {
register_clcmd ( "say /hsv", "cmd_startvote", 0, "- start vote for HSMode" )
register_clcmd ( "say_team /hsv", "cmd_startvote", 0, "- start vote for HSMode" )
}

if (g_Votes[0] > g_Votes[1]) {
gHeadShot = false
ColorChat(0, RED, "[HsV]^1 %L", LANG_PLAYER, "HSV_PLAYCL")

if ( fwd_TraceAttack != HamHook:0 )
{
DisableHamForward(fwd_TraceAttack)
}

server_cmd("sv_restart 1")
server_exec ()
}
else if (g_Votes[1] > g_Votes[0]) {
gHeadShot = true
ColorChat(0, RED, "[HsV]^1 %L", LANG_PLAYER, "HSV_PLAYHS")

if ( fwd_TraceAttack == HamHook:0 ) {
fwd_TraceAttack = RegisterHam(Ham_TraceAttack, "player", "Forward_TraceAttack")
}
else {
EnableHamForward(fwd_TraceAttack)
}

server_cmd("sv_restart 1")
server_exec ()
}
else if (g_Votes[1] >= g_Votes[0]) {
ColorChat(0, RED, "[HsV]^1 %L", LANG_PLAYER, "HSV_PLAYNT")
}

menu_destroy(g_VoteMenu)

for( new plr = 1; plr <= g_MaxPlayers; plr++ ) {
if (is_user_alive(plr) && is_user_connected(plr)) {
set_pev(plr, pev_flags, pev(plr, pev_flags) & ~FL_FROZEN)
}
}

set_task(0.1, "DelScreenFade", 0)

g_Voting = 0
return PLUGIN_CONTINUE
}

public Forward_TraceAttack(id, attacker, Float:dmg, Float:dir[3], tr, dmgbit) {
if(id != attacker && get_tr2(tr, TR_iHitgroup) != HIT_HEAD) {
if(1 <= attacker <= g_MaxPlayers) {
if(!get_pcvar_num(CvarKnife) && get_user_weapon(attacker) == CSW_KNIFE) {
return HAM_IGNORED
}
return HAM_SUPERCEDE
}
}

return HAM_IGNORED;
}

public ScreenFade() {
message_begin(MSG_ALL, g_msgScreenFade, _, 0)
write_short(1<<0)
write_short(1<<0)
write_short(1<<2)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(255)
message_end()
}

public DelScreenFade() {
message_begin(MSG_ALL, g_msgScreenFade, _, 0)
write_short(1<<0)
write_short(1<<0)
write_short(1<<0)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(0)
message_end()
}

// COLORCHAT, hello xPaw ^^,

ColorChat( id, Color:type, const szMessage[], {Float,Sql,Result,_}:... ) {
if( !get_playersnum() ) return;

new message[256];

switch( type ) {
case NORMAL: message[0] = 0x01;
case GREEN: message[0] = 0x04;
default: message[0] = 0x03;
}

vformat(message[1], 251, szMessage, 4);

message[192] = '^0';

replace_all( message, 191, "\YEL", "^1" );
replace_all( message, 191, "\GRN", "^4" );
replace_all( message, 191, "\TEM", "^3" );

new iTeam, ColorChange, index, MSG_Type;

if( id ) {
MSG_Type = MSG_ONE_UNRELIABLE;
index = id;
} else {
index = CC_FindPlayer();
MSG_Type = MSG_BROADCAST;
}

iTeam = get_user_team( index );
ColorChange = CC_ColorSelection(index, MSG_Type, type);

CC_ShowColorMessage(index, MSG_Type, message);

if( ColorChange )
CC_Team_Info(index, MSG_Type, TeamName[iTeam]);
}

CC_ShowColorMessage( id, type, message[] ) {
message_begin( type, g_iMsgSayText, _, id );
write_byte( id );
write_string( message );
message_end();
}

CC_Team_Info( id, type, team[] ) {
message_begin( type, g_iMsgTeamInfo, _, id );
write_byte( id );
write_string( team );
message_end( );

return 1;
}

CC_ColorSelection( index, type, Color:Type ) {
switch( Type ) {
case RED: return CC_Team_Info(index, type, TeamName[1]);
case BLUE: return CC_Team_Info(index, type, TeamName[2]);
}

return 0;
}

CC_FindPlayer() {
for( new i = 1; i <= g_MaxPlayers; i++ )
if( is_user_connected(i) )
return i;

return -1;
}
Всех приветствую! Кому не сложно поправить исходник под 1.9.0? Заранее спасибо!
 

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

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