Проблема с работой плагина Knife

RUSLAN80

Пользователь
Регистрация
11 Янв 2018
Сообщения
12
Симпатии
1
Пол
Мужской
OS
Linux
Amx Mod X
ReAMXX 1.8.3
Билд
[code=cpp]Protocol version Prot Prot 48Exe version 1.1.2.7/Stdio (cstrike)ReHLDS version: 3.4.0.653-dev Build date: 18:30:05 May 13 2018 (1492)Build from: https://github.com/dreamstalker/rehlds/commit/87a2d17
ReGamedll
[code=cpp]ReGameDLL version: 5.7.0.301-dev Build date: 00:28:14 Apr 9 2018Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/fe0ea9a
Metamod
[code=cpp]MetamodMetamod--r v1r v1.3.3..0.1060.106,, API API ((55::1313))
Metamod Metamod--r buildr build:: 1818::4646::2929 Jan Jan 2626 20182018
Metamod Metamod--r fromr from:: https https::////githubgithub..comcom//theAsmodaitheAsmodai//metamodmetamod--rr//commitcommit//80555d380555d3[/code]
Meta модули
Код:
C++:
[ 1] Reunion          RUN   -    reunion.so                  v0.1.0.89       ini  Start Never
[ 2] ReAuthCheck      RUN   -    reauthcheck.so              v0.1.6          ini  Start Never
[ 3] Rechecker        RUN   -    rechecker.so                v2.5            ini   ANY
[ 4] VoiceTranscoder  RUN   -    vtc.so                      v2017RC3        ini   ANY
[ 5] WHBlocker        RUN   -    whblocker.so                v1.5.695        ini   ANY
[ 6] ReSemiclip       RUN   -    resemiclip.so               v2.3.9          ini   ANY
[ 7] AMX Mod X        RUN   -    amxmodx.so                  v1.8.3-Re       ini  Start ANY
[ 8] ReSRDetector     RUN   -    resrdetector.so             v0.1.0          ini   ANY
[ 9] MySQL            RUN   -    mysql_amxx_i386.so          v1.8.3-Re       pl7   ANY
[10] Fun              RUN   -    fun_amxx_i386.so            v1.8.3-Re       pl7   ANY
[11] Engine           RUN   -    engine_amxx_i386.so         v1.8.3-Re       pl7   ANY
[12] FakeMeta         RUN   -    fakemeta_amxx_i386.so       v1.8.3-Re       pl7   ANY
[13] CStrike          RUN   -    cstrike_amxx_i386.so        v1.8.3-Re       pl7   ANY
[14] CSX              RUN   -    csx_amxx_i386.so            v1.8.3-Re       pl7   ANY
[15] Ham Sandwich     RUN   -    hamsandwich_amxx_i386.so    v1.8.3-Re       pl7   ANY
[16] ReAPI            RUN   -    reapi_amxx_i386.so          v5.2.0.145-dev  pl7   ANY   Never
 [code=cpp][17] ReAimDetector    RUN   -    reaimdetector_amxx_i386.so  v0.2.2          pl7   ANY   Never
Плагины
Код:
C++:
[  1] USS & Stats-Time        1.5         Aleksandr E.      uss.amxx         running
[  2] Advanced Gag            1.9.0       neygomon          advanced_gag.am  running
[  3] ReAimDetector API       0.2.2       ReHLDS Team       reaimdetector.a  running
[  4] FreshBans               1.4.0b      kanagava          fresh_bans_140_  running
[  5] Admin Loader            3.1         neygomon          admin_loader_fo  running
[  6] Menus Front-End         1.5         neugomon          menufront_end.a  running
[  7] Maps Menu               1.4.1       neugomon          mapsmenu_.amxx   running
[  8] Players Menu            1.8.3       AMXX Dev Team     plmenu.amxx      running
[  9] Restrict Weapons        1.8.3       AMXX Dev Team     restmenu.amxx    running
[ 10] Advanced MapChooser     1.4         neygomon          advanced_mapcho  running
[ 11] Change Game Name        1.2         ReHLDS Team       change_game_nam  running
[ 12] Autoresponder/Advertis  0.5         MaximusBrood      reklama_in_chat  running
[ 13] Rock to Ban             1.52f       Safety1st         rock_to_ban.amx  running
[ 14] [ReAPI] AdminFreeLook   1.0         ReHLDS Team       reapi_adminfree  running
[ 15] AFK Control             1.4.1 [Rnd  neygomon          afk_control.amx  running
[ 16] C4 Timer on roundtime   0.3.3a      neygomon          c4timer.amxx     running
[ 17] Smoke: HealthNade       0.0.3       wopox1337         smoke_healthnad  running
[ 18] WarmUP Sound            1.0         ill               warmup_sound.am  running
[ 19] [ReAPI] No Team Flash   0.0.2       Vaqtincha         no_team_flash_l  running
[ 20] Parachute for ALL [ReA  3.0         Leo_[BH]          parachute_for_a  running
[ 21] Kill Sound              1.0         Jack Daniel`s     kill_sound.amxx  running
[ 22] Reset Score             0.0.2f      wopox1337         reset_score.amx  running
[ 23] [ReAPI] AWPoff          1.4.2       PAffAEJIkA :3     awp_off.amxx     running
[ 24] Round Balancer          1.0 build   neygomon          round_balancer.  running
[ 25] Mode 2x2                2.5re       s1lent            mode_2x2.amxx    running
[ 26] Fake Ping               1.1         MeRcyLeZZ/gyxoBk  fake_ping.amxx   running
[ 27] Damager                 2.0         Prayer            damager.amxx     running
[ 28] [ReAMX] Army Ranks Ult  17.12.12    SKAJIbnEJIb       army_ranks_ulti  running
[ 29] [ReAMX] Ultimate Weapo  17.08.28    SKAJIbnEJIb       ultimate_weapon  running
[ 30] [ReAMX] VIP RBS         18.03.24    SKAJIbnEJIb       vip_rbs.amxx     running
[ 31] [ReAMX] Demo Recorder   18.02.08    SKAJIbnEJIb       demorecorder_rb  running
[ 32] [ReAMX] Chat Controlle  18.05.15    SKAJIbnEJIb       chat_controller  running
[ 33] [ReAMX] AR Bets         17.10.30    SKAJIbnEJIb       ar_bets.amxx     running
[ 34] [ReAMX] Jobs RBS        18.05.15    SKAJIbnEJIb       jobs_rbs.amxx    running
[ 35] [ReAMX] Kill Assist RB  17.10.30    Digi & SKAJIbnEJ  killassist_rbs.  running
[ 36] [ReAMX] Piss RBS        17.10.30    SKAJIbnEJIb & KR  piss_rbs.amxx    running
[ 37] [ReAMX] High Ping Kick  18.05.15    SKAJIbnEJIb       hpk_rbs.amxx     running
[ 38] [ReAMX] Map Spawns Edi  17.08.27    iG_os & SKAJIbnE  MapSpawnsEditor  running
[ 39] [ReAMX] ESP RBS         17.10.30    SKAJIbnEJIb & Ko  esp_rbs.amxx     running
[ 40] [ReAMX] Chat RBS        18.03.24    SKAJIbnEJIb       chat_rbs.amxx    running
[ 41] [ReAMX] CsStats MySQL   18.03.24    SKAJIbnEJIb       csstats_mysql.a  running
[ 42] [ReAMX] Stats Configur  17.10.30    SKAJIbnEJIb & AM  statscfg_rbs.am  running
[ 43] [ReAMX] StatsX RBS      18.03.24    SKAJIbnEJIb & AM  statsx_rbs.amxx  running
Amxx Модули
Код:
C++:
[ 1] MySQL                   1.8.3-Re    AMX Mod X Dev Team   running
[ 2] Fun                     1.8.3-Re    AMX Mod X Dev Team   running
[ 3] Engine                  1.8.3-Re    AMX Mod X Dev Team   running
[ 4] FakeMeta                1.8.3-Re    AMX Mod X Dev Team   running
[ 5] CStrike                 1.8.3-Re    AMX Mod X Dev Team   running
[ 6] CSX                     1.8.3-Re    AMX Mod X Dev Team   running
[ 7] Ham Sandwich            1.8.3-Re    AMX Mod X Dev Team   running
[ 8] ReAPI                   5.2.0.145-  Asmodai & s1lent     running
[ 9] ReAimDetector           0.2.2       ReHLDS Team          running
[10] Sockets                 1.8.3-Re    HLSW Dev Team        running
[11] Sockets2                1.8.1.3746  HLSW Dev Team        running
[12] RegEx                   1.8.3-Re    AMX Mod X Dev Team   running
Ошибка
Код:
нет ошибки в работе плагина
Исходник
Код:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <dhudmessage>

#define PLUGIN "Player Knife Duel"
#define VERSION "1.6"
#define AUTHOR "Name_PKD"

#define CBASE_CURRWPN_ENT 373
#define OFFSET_ENT_TO_INDEX 43
#define MUSIC1 "sound/PlayerKnifeDuel.mp3"

new const g_szKnifeSound[] = "weapons/knife_hitwall1.wav";
new const g_szSpawnClassname[] = "info_player_deathmatch";

new Float:g_fHit[33];
new iHitCount[33];
new g_iChallenged, g_iChallenger;

new Float:g_vKnifeOrigin[2][3];
new bool:g_bInChallenge;
new bool:g_bProtect;
new g_iTimer;

enum _:max_cvars {

CVAR_COUNT = 0,
CVAR_TIMER,
CVAR_MAXDISTANCE,
CVAR_PROTECTION,
CVAR_ANNOUNCE,
CVAR_RESET
};
new g_Pcvar[max_cvars];

new g_iFwdSpawn;
new g_iMaxPlayers;

public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR);

register_forward(FM_EmitSound, "fwd_EmitSound", 1);
register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink_post", 1);
RegisterHam(Ham_Killed, "player", "fwd_Killed", 1);
unregister_forward(FM_Spawn, g_iFwdSpawn, 1);

register_logevent("logevent_RoundEnd", 2, "1=Round_End", "1=Round_Draw");

g_Pcvar[CVAR_COUNT] = register_cvar("kd_knifecount", "3");
g_Pcvar[CVAR_TIMER] = register_cvar("kd_preparetime", "10");
g_iTimer = get_pcvar_num(g_Pcvar[CVAR_TIMER]);
g_Pcvar[CVAR_PROTECTION] = register_cvar("kd_protection", "1");
g_Pcvar[CVAR_MAXDISTANCE] = register_cvar("kd_maxdistance", "400");
g_Pcvar[CVAR_ANNOUNCE] = register_cvar("kd_announce", "0");
g_Pcvar[CVAR_RESET] = register_cvar("kd_resethp", "1");

g_iMaxPlayers = get_maxplayers();
}

public plugin_precache()
{
g_iFwdSpawn = register_forward(FM_Spawn, "fwd_Spawn", 1);

precache_generic(MUSIC1);
}

public client_disconnect(id)
{
client_cmd(id, "mp3 stop");
if((id == g_iChallenged) || (id == g_iChallenger))
{
g_bInChallenge = false;
g_bProtect = false;
}
}

public fwd_Spawn(ent)
{
if(!pev_valid(ent))
return FMRES_IGNORED;

static szClassname[32];
pev(ent, pev_classname, szClassname, sizeof szClassname - 1);

if(equal(szClassname, g_szSpawnClassname))
{
if(vec_null(g_vKnifeOrigin[0]))
{
pev(ent, pev_origin, g_vKnifeOrigin[0]);
}
else if(!vec_null(g_vKnifeOrigin[0]) && vec_null(g_vKnifeOrigin[1]))
{
static Float:vTmp[3];
pev(ent, pev_origin, vTmp);

if((300.0 <= vector_distance(g_vKnifeOrigin[0], vTmp) < 600.0))
g_vKnifeOrigin[1] = vTmp;
}
}
return FMRES_IGNORED;
}

public fwd_EmitSound(id, channel, const sound[])
{
if(!is_user_alive(id))
return FMRES_IGNORED;

if(!equal(sound, g_szKnifeSound))
return FMRES_IGNORED;

static Float:fGmTime;
fGmTime = get_gametime();

if((fGmTime - g_fHit[id]) >= 1.0)
{
iHitCount[id] = 0;
g_fHit[id] = fGmTime;
}
++iHitCount[id];
g_fHit[id] = fGmTime;

if((iHitCount[id] >= get_pcvar_num(g_Pcvar[CVAR_COUNT])) && check_players() && !g_bInChallenge)
{
new iOpponent = get_opponent(3 - get_user_team(id));
if(!iOpponent)
return FMRES_IGNORED;

fnChallenge(id, iOpponent);

iHitCount[id] = 0;
}
return FMRES_IGNORED;
}

public fwd_PlayerPreThink_post(id)
{
if(!is_user_alive(id) || !g_bInChallenge)
return FMRES_IGNORED;

static iWpn;
iWpn = get_pdata_cbase(id, CBASE_CURRWPN_ENT);

if(pev_valid(iWpn))
{
if(get_pdata_int(iWpn, OFFSET_ENT_TO_INDEX) != CSW_KNIFE)
engclient_cmd(id, "weapon_knife");
}

static iOpponent;
if(id == g_iChallenged)
iOpponent = g_iChallenger;
else
iOpponent = g_iChallenged;

if(!is_user_connected(iOpponent))
return FMRES_IGNORED;

if((fm_get_entity_distance(id, iOpponent) >= get_pcvar_float(g_Pcvar[CVAR_MAXDISTANCE])) && g_bProtect)
{
static Float:vVel[3];
fm_get_speed_vector2(id, iOpponent, 100.0, vVel);

set_pev(id, pev_velocity, vVel);
}
return FMRES_IGNORED;
}

public fwd_Killed(id, idattacker, shouldgib)
{
if(!get_pcvar_num(g_Pcvar[CVAR_ANNOUNCE]))
return HAM_IGNORED;

if(check_players())
{
for(new i = 0 ; i <= g_iMaxPlayers ; i++)
{
if(!is_user_alive(i))
continue;
Color_Print(id, "!y[!gvk.com/sev_cs!y] Остался !tОдин !yна !tОдин !y? Для игры на !gНожах!y, чиркни о стену !g3 !yраза.", get_pcvar_num(g_Pcvar[CVAR_COUNT]));
}
}
return HAM_IGNORED;
}

public fnChallenge(id, opponent)
{
new szName[32], szOppName[32];
get_user_name(id, szName, sizeof szName - 1);
get_user_name(opponent, szOppName, sizeof szOppName - 1);

new szTitle[64];
formatex(szTitle, sizeof szTitle - 1, "\wИгрок: \r%s \yхочет на Ножах.", szName);

new iMenu = menu_create(szTitle, "menu_MainHandler", 0);
menu_additem(iMenu, "Я согласен.", "1", 0, -1);
menu_additem(iMenu, "Не, нахуй надо.", "2", 0, -1);

menu_setprop(iMenu, MPROP_EXIT, MEXIT_NEVER);
menu_display(opponent, iMenu, 0);

Color_Print(id, "!y[!gvk.com/sev_cs!y] Игрок: !g%s !yвызвал игрока: !g%s !yпоиграть на !gНожах!y.", szName, szOppName);

g_iChallenger = id;
g_iChallenged = opponent;
g_bInChallenge = true;
}

public menu_MainHandler(id, menu, item)
{
if(!is_user_connected(id))
return 1;

new szData[6], iAccess, iCallBack;
menu_item_getinfo(menu, item, iAccess, szData, sizeof szData - 1, _, _, iCallBack);

new iKey = str_to_num(szData);

new szName[32];
get_user_name(id, szName, sizeof szName - 1);

switch(iKey)
{
case 1:
{
Color_Print(id, "!y[!gvk.com/sev_cs!y] Игрок: !g%s !yпринял вызов для игры на !gНожах!y.", szName);
fnStartDuel();
}
case 2:
{
Color_Print(id, "!y[!gvk.com/sev_cs!y] Игрок: !g%s сказал: !gНахуй надо !yи будет играть с !gОружием!y.", szName);
g_bInChallenge = false;
}
}
return 1;
}

public fnStartDuel()
{
if(!is_user_connected(g_iChallenged) || !is_user_connected(g_iChallenger))
return;

engfunc(EngFunc_SetOrigin, g_iChallenged, g_vKnifeOrigin[0]);
engfunc(EngFunc_SetOrigin, g_iChallenger, g_vKnifeOrigin[1]);

fm_entity_set_aim(g_iChallenged, g_iChallenger, 0);
fm_entity_set_aim(g_iChallenger, g_iChallenged, 0);

fm_set_user_godmode(g_iChallenged, 1);
fm_set_user_godmode(g_iChallenger, 1);

if(get_pcvar_num(g_Pcvar[CVAR_RESET]))
{
set_pev(g_iChallenged, pev_health, 100.0);
set_pev(g_iChallenger, pev_health, 100.0);
}
set_task(1.0, "taskDuelThink", 'x', "", 0, "b", 0);

if(get_pcvar_num(g_Pcvar[CVAR_PROTECTION]))
g_bProtect = true;
}

public taskDuelThink()
{
if(g_iTimer > 0)
{
set_dhudmessage(255, 0, 0, -1.0, 0.1, 0, 6.0, 1.0, 0.1, 0.9, false);
show_dhudmessage(0, "--== Дуэль на Ножах, начнётся через: %d сек. ==--", g_iTimer--);
}
else
{
set_dhudmessage(0, 255, 0, -1.0, 0.15, 0, 6.0, 1.0, 0.1, 0.9, false);
show_dhudmessage(0, "*** Покажи на что ты способен на Ножах !!! ***");

client_cmd(0, "mp3 play %s",MUSIC1);


g_iTimer = get_pcvar_num(g_Pcvar[CVAR_TIMER]);
remove_task('x');

for(new i = 0 ; i <= g_iMaxPlayers ; i++)
{
if(!is_user_alive(i))
continue;

fm_set_user_godmode(i, 0);
}
}
}

public logevent_RoundEnd()
{
g_bInChallenge = false;
g_bProtect = false;
client_cmd(0, "mp3 stop");
}

stock fm_entity_set_aim(id, ent, bone = 0)
{
if(!is_user_connected(id) || !pev_valid(ent))
return 0;

new Float:vOrigin[3];
pev(ent, pev_origin, vOrigin);

new Float:vEntOrigin[3], Float:vAngles[3];

if(bone)
engfunc(EngFunc_GetBonePosition, id, bone, vEntOrigin, vAngles);
else
pev(id, pev_origin, vEntOrigin);

vOrigin[0] -= vEntOrigin[0];
vOrigin[1] -= vEntOrigin[1];
vOrigin[2] -= vEntOrigin[2];

new Float:v_length;
v_length = vector_length(vOrigin);

new Float:vAimVector[3];
vAimVector[0] = vOrigin[0] / v_length;
vAimVector[1] = vOrigin[1] / v_length;
vAimVector[2] = vOrigin[2] / v_length;

new Float:vNewAngles[3];
vector_to_angle(vAimVector, vNewAngles);

vNewAngles[0] *= -1;

if(vNewAngles[1] > 180.0) vNewAngles[1] -= 360;
if(vNewAngles[1] < -180.0) vNewAngles[1] += 360;
if(vNewAngles[1] == 180.0 || vNewAngles[1] == -180.0) vNewAngles[1] = -179.9;

set_pev(id, pev_angles, vNewAngles);
set_pev(id, pev_fixangle, 1);

return 1;
}

stock vec_null(Float:vec[3])
{
if(!vec[0] && !vec[1] && !vec[2])
return 1;

return 0;
}

stock bool:check_players()
{
new iNum[2];
for(new i = 1 ; i <= g_iMaxPlayers ; i++)
{
if(!is_user_alive(i))
continue;

if(get_user_team(i) == 1)
++iNum[0];
else if(get_user_team(i) == 2)
++iNum[1];
}
if((iNum[0] == 1) && (iNum[1] == 1))
return true;

return false;
}

stock get_opponent(team)
{
for(new i = 0 ; i <= g_iMaxPlayers ; i++)
{
if(!is_user_alive(i))
continue;

if(get_user_team(i) == team)
return i;
}
return 0;
}

stock fm_set_user_godmode(index, godmode = 0)
{
set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM);
return 1;
}

stock fm_get_speed_vector2(ent1, ent2, Float:speed, Float:new_velocity[3])
{
if(!pev_valid(ent1) || !pev_valid(ent2))
return 0;

static Float:vOrigin1[3];
pev(ent1, pev_origin, vOrigin1);
static Float:vOrigin2[3];
pev(ent2, pev_origin, vOrigin2);

new_velocity[0] = vOrigin2[0] - vOrigin1[0];
new_velocity[1] = vOrigin2[1] - vOrigin1[1];
new_velocity[2] = vOrigin2[2] - vOrigin1[2];
new Float:fNum = floatsqroot(speed * speed / (new_velocity[0] * new_velocity[0] + new_velocity[1] * new_velocity[1] + new_velocity[2] * new_velocity[2]));
new_velocity[0] *= fNum;
new_velocity[1] *= fNum;
new_velocity[2] *= fNum;

return 1;
}

stock Float:fm_get_entity_distance(ent1, ent2)
{
if(!pev_valid(ent1) || !pev_valid(ent2))
return 0.0;

static Float:vOrigin1[3];
pev(ent1, pev_origin, vOrigin1);
static Float:vOrigin2[3];
pev(ent2, pev_origin, vOrigin2);

return vector_distance(vOrigin1, vOrigin2);
}

stock Color_Print(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players);
write_string(msg);
message_end();
}
}
}
}
При согласии игрока на бой на ножах игроков закидывает в текстуры
 

Вложения

RUSLAN80

Пользователь
Регистрация
11 Янв 2018
Сообщения
12
Симпатии
1
Пол
Мужской
Может все таки кто нибудь подскажет как решить эту проблему если не сложно.
 

To be or not to be

Пользователь
Регистрация
9 Июн 2017
Сообщения
1.215
Симпатии
304
RUSLAN80, переписать код плагина - ошибка явно в нем
 

Vesuvius

НЕ СКРИПТЕР!!!
Команда форума
Администратор
Регистрация
8 Июн 2017
Сообщения
1.595
Симпатии
572
Пол
Мужской
Сверху Снизу