Снова проблемы с Knife Duel Arena

Сообщения
67
Реакции
4
Ошибка
На арене бывает по 4 игрока
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5263 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Oct 27 2019 16:23:31
Built from: https://github.com/alliedmodders/amxmodx/commit/15a14a0
Build ID: 5263:15a14a0
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.693-dev
Build date: 18:20:58 Jan 28 2020 (2117)
Build from: https://github.com/dreamstalker/rehlds/commit/c4cecf5
ReGamedll
ReGameDLL version: 5.17.0.466-dev
Build date: 02:56:24 May 27 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/bffb373
Версия 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] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5263 ini Start ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.92 ini Start Never
[ 3] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 4] ReAPI RUN - reapi_amxx_i386.so v5.14.0.195-dev pl1 ANY Never
[ 5] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 6] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 7] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 8] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[10] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
[11] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl1 ANY ANY
11 plugins, 11 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] WebHS 0.1 kanagava fb_web_online.a running
[ 2] FreshBans 1.3.8b kanagava fresh_bans_138_ running
[ 3] Admin Loader 3.3 neygomon admin_loader.am running
[ 4] Admin Commands 1.9.0.5263 AMXX Dev Team admincmd.amxx running
[ 5] Slots Reservation 1.9.0.5263 AMXX Dev Team adminslots.amxx running
[ 6] Menus Front-End 1.9.0.5263 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5263 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5263 AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.9.0.5263 AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.9.0.5263 AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.9.0.5263 AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.9.0.5263 AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.9.0.5263 AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.9.0.5263 AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.9.0.5263 AMXX Dev Team adminvote.amxx running
[ 16] Team Select 1.6.0 F@nt0M teamselect.amxx running
[ 17] unknown unknown unknown motd_model.amxx running
[ 18] Pause Plugins 1.9.0.5263 AMXX Dev Team pausecfg.amxx running
[ 19] Knife DeathMatch 1.1 Lucky deathmatch.amxx running
[ 20] AFK Protection 2.3 rapara13/Nordic afk.amxx running
[ 21] Spring 1.9 wellasgood spring.amxx running
[ 22] [190] Army Ranks Ultim 19.11.29 SKAJIbnEJIb army_ranks_ulti running
[ 23] [190] Chat RBS 19.12.23 SKAJIbnEJIb chat_rbs.amxx running
[ 24] [190] NewYear RBS 19.12.23 SKAJIbnEJIb newyear_rbs.amx running
[ 25] Stats Configuration 18.05.15 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 26] [183] StatsX RBS 19.08.28 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 27] [183] CsStats MySQL 19.08.27 SKAJIbnEJIb csstats_mysql.a running
[ 28] Spectator Bots 2.1 SISA specbots.amxx running
[ 29] [MG] Sky 1.0 Nickron mg_sky.amxx running
[ 30] Cam Change 1.1 Bl0ck Cam_Change.amxx running
[ 31] Knife Mode 1.0 Exodus Dex_Knive.amxx running
[ 32] [JBI] :: [Hats] 1.0 BlazeBest jbi_hats.amxx running
[ 33] Parachute 1.1 ReHLDS Team parachute.amxx running
33 plugins, 33 running
Автор плагина
Raizo/NordicWarrior
Версия плагина
1.1
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <xs>
#include <cstrike>
#include <dhudmessage>


#pragma tabsize 0
#pragma compress 1

#define PLUGIN "Knife Duel"
#define VERSION "1.1"
#define AUTHOR "Raizo/Remake by N.W."


#define CHAT_TAG "^3[^4Дуэли^3]^1 "
#define MAX_PLAYERS 32
#define MOVE_UP 0
#define MOVE_DOWN 1
#define MOVE_RIGHT 2
#define MOVE_LEFT 3
#define MOVE_FRONT 4
#define MOVE_BACK 5

new Entity, maxplayers

new mapid[32], szName[32], map_default_hp, rounds;

new Float:vOrigin[3], Float:fOrigin[3], Float:his_spawn[33][3], Float:move_size[33], Float:fVelocity[3];

new bool:in_Duel[MAX_PLAYERS+1], g_Challenge[MAX_PLAYERS+1], g_Area[MAX_PLAYERS+1] = 0, g_DuelK[MAX_PLAYERS+1] = 0, g_DuelC[MAX_PLAYERS+1] = 0, g_MenuCallback;
new bool:Arena1in = false, bool:Arena2in = false;

new bool:his_offline[MAX_PLAYERS+1]
new bool:slash_attack[33];
new bool:stab_attack[33];
new bool:hs_attack[33];
new bool:Non_Stop[33];

new bool:most = false

new const ARENA_FILE_AAA[] = "%s/plat_A/%s.cfg"
new const ARENA_FILE_BBB[] = "%s/plat_B/%s.cfg"
new const DATE[] = "models/knife_platform.mdl"
new const DATE2[] = "models/knife_most.mdl"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("say /duel","Duel_Menu");
register_clcmd("say /plm","EntityMenu");
register_clcmd("endduel","End_Duel");

rounds = register_cvar("rush_rounds","10")

g_MenuCallback = menu_makecallback("menuitem_callback");
RegisterHam(Ham_Touch, "weaponbox", "hamTouchWeapon");
RegisterHam(Ham_Touch, "armoury_entity", "hamTouchWeapon");
RegisterHam(Ham_Touch, "weapon_shield", "hamTouchWeapon");
RegisterHam(Ham_TakeDamage, "player", "TakeDMG");
RegisterHam(Ham_Killed, "player", "PlayerKilled");
RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
RegisterHam(Ham_Player_Jump, "player", "pfw_UpdateClientData");
RegisterHam(Ham_Player_Duck, "player", "pfw_UpdateClientData");
register_forward(FM_PlayerPreThink,"FW_Prethink")

Load_Coords()
Load_Coords2()

maxplayers = get_maxplayers();

register_forward(FM_CmdStart,"Fw_Cmd_Slash");
register_forward(FM_CmdStart,"Fw_Cmd_Stab");

register_forward(FM_CmdStart,"NonStop");

register_forward(FM_UpdateClientData, "pfw_UpdateClientData", 1)

RegisterHam(Ham_TraceAttack, "player", "Forward_TraceAttack");

get_mapname(mapid,charsmax(mapid))


if(containi(mapid,"35hp") != -1)
map_default_hp = 35
else if(containi(mapid,"1hp") != -1)
map_default_hp = 1
else map_default_hp = 35

}

public plugin_cfg()
{

new cfgdir[32], urlfile[64]
get_configsdir(cfgdir, charsmax(cfgdir))
formatex(urlfile, charsmax(urlfile), "%s/plat_A", cfgdir)
if(!dir_exists(urlfile))
{
mkdir(urlfile)
server_print("%sCreated new folder: %s",CHAT_TAG,urlfile)
}

new cfdir[32], urfile[64]
get_configsdir(cfdir, charsmax(cfdir))
formatex(urfile, charsmax(urfile), "%s/plat_B", cfdir)
if(!dir_exists(urfile))
{
mkdir(urfile)
server_print("%sCreated new folder: %s",CHAT_TAG,urfile)
}
}

public KDC_Menu( id )
{
new gMenu = menu_create("\yВыбери тип дуэли:", "kdc_menu_handler")

menu_additem(gMenu, "\wОбычный", "1")
menu_additem(gMenu, "\wНон-стоп", "2")
menu_additem(gMenu, "\wТолько правой", "3")
menu_additem(gMenu, "\wТолько левой", "4")
menu_additem(gMenu, "\wТолько в голову", "5")

menu_display(id, gMenu, 0)
}

public kdc_menu_handler(id, menu, item)
{
if ( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item)
{
case 0: knf_d(id)
case 1: Dont_Stop(id)
case 2: Block_Slash(id)
case 3: Block_Stab(id)
case 4: Hs_Only(id)
}
return PLUGIN_HANDLED;
}

public Fw_Cmd_Slash(id, uc_handle, seed)
{
if(!is_user_alive(id) || !slash_attack[id])
return FMRES_IGNORED;

new iButtons = get_uc(uc_handle,UC_Buttons);
new trash[2], iWeapon = get_user_weapon(id,trash[0], trash[1]);

if( (iButtons & IN_ATTACK) && iWeapon == CSW_KNIFE)
{
iButtons = iButtons & ~IN_ATTACK;
set_uc(uc_handle, UC_Buttons, iButtons);

return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

public Fw_Cmd_Stab(id, uc_handle, seed)
{
if(!is_user_alive(id) || !stab_attack[id])
return FMRES_IGNORED;

new iButtons = get_uc(uc_handle,UC_Buttons);
new trash[2], iWeapon = get_user_weapon(id,trash[0], trash[1]);

if( (iButtons & IN_ATTACK2) && iWeapon == CSW_KNIFE)
{
iButtons = iButtons & ~IN_ATTACK2;
set_uc(uc_handle, UC_Buttons, iButtons);

return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

public Forward_TraceAttack(iVictim, iKiller, Float:dmg, Float:dir[3], tr, dmgbit)
{
if (iVictim == iKiller || !is_user_alive(iKiller) || !hs_attack[iKiller] )
return FMRES_IGNORED;

if(iKiller && get_tr2(tr, TR_iHitgroup) != HIT_HEAD)

return HAM_SUPERCEDE;

return HAM_IGNORED;
}

public knf_d(Challenged)
{
get_user_name( Challenged , szName , charsmax( szName ) );

set_dhudmessage( 0, 206, 209, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(Challenged, "%s выбрал обычный режим!", szName)
show_dhudmessage(g_Challenge[Challenged], "%s выбрал обычный режим!", szName)

}

public Dont_Stop(Challenged)
{
get_user_name( Challenged , szName , charsmax( szName ) );

if (is_user_alive(Challenged) && is_user_alive(g_Challenge[Challenged]))
{
set_task(0.1, "GoToSpawn", Challenged);
set_task(0.1, "GoToSpawn", g_Challenge[Challenged]);
Non_Stop[Challenged] = true
Non_Stop[g_Challenge[Challenged]] = true
set_dhudmessage( 0, 206, 209, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(Challenged, "%s выбрал режим нон-стоп!", szName)
show_dhudmessage(g_Challenge[Challenged], "%s выбрал режим нон-стоп!", szName)
}
}

public Block_Slash(Challenged)
{
get_user_name( Challenged , szName , charsmax( szName ) );

if (is_user_alive(Challenged) && is_user_alive(g_Challenge[Challenged]))
{
slash_attack[Challenged] = true
slash_attack[g_Challenge[Challenged]] = true
set_dhudmessage( 0, 206, 209, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(Challenged, "%s выбрал режим только правой!", szName)
show_dhudmessage(g_Challenge[Challenged], "%s выбрал режим только правой!", szName)
}
}

public Block_Stab(Challenged)
{
get_user_name( Challenged , szName , charsmax( szName ) );

if (is_user_alive(Challenged) && is_user_alive(g_Challenge[Challenged]))
{
stab_attack[Challenged] = true
stab_attack[g_Challenge[Challenged]] = true
set_dhudmessage( 0, 206, 209, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(Challenged, "%s выбрал режим только левой!", szName)
show_dhudmessage(g_Challenge[Challenged], "%s выбрал режим только левой!", szName)
}
}

public Hs_Only(Challenged)
{
get_user_name( Challenged , szName , charsmax( szName ) );

if (is_user_alive(Challenged) && is_user_alive(g_Challenge[Challenged]))
{
hs_attack[Challenged] = true
hs_attack[g_Challenge[Challenged]] = true
set_dhudmessage( 0, 206, 209, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(Challenged, "%s выбрал режим только в голову!", szName)
show_dhudmessage(g_Challenge[Challenged], "%s выбрал режим только в голову!", szName)
}
}

public client_putinserver(id)
{
his_offline[id] = false

return PLUGIN_CONTINUE
}

public toggle_offline(id)
{
switch(his_offline[id])
{
case 0:
{
his_offline[id] = true
client_print_color(id, "!g[!tДуэли!g] !tТы !gотключил !tдуэли!");
}
default:
{
his_offline[id] = false
client_print_color(id, "!g[!tДуэли!g] !tТы !gснова включил !tдуэли!");
}
}
}

public toggle_most(id)
{
switch(most)
{
case 0: most = true
case 1: most = false
}
}

public FW_Prethink(id)
{

if (pev(id,pev_button) & IN_ATTACK && pev(id,pev_button) & IN_ATTACK2)
Duel_Menu(id)
}

public Duel_Menu(id)
{
new gMenu = menu_create("\yМеню дуэлей", "Duel_menu_handler")

menu_additem(gMenu, "\wВызвать на дуэль", "0")
menu_additem(gMenu, "\wСдаться [\yВ дуэли\w]", "0")
if(his_offline[id] == false)
{
menu_additem(gMenu, "\wОтключить дуэли", "0")
}
else
{
menu_additem(gMenu, "\wВключить дуэли", "0")
}
if(most == true)
{
menu_additem(gMenu, "\wМесто: [\rМост\w]", "0")
}
else
{
menu_additem(gMenu, "\wМесто: [\rПлатформа\w]", "0")
}
menu_display(id, gMenu, 0)
}

public Duel_menu_handler(id, menu, item)
{
if ( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item)
{
case 0: choose_playermenu(id, id)
case 1: client_cmd(id, "endduel")
case 2: toggle_offline(id), Duel_Menu(id)
case 3: toggle_most(id), Duel_Menu(id)
}
return PLUGIN_HANDLED;
}


public client_command(id)
{
static const szJoinCommand[] = "jointeam";
static const szJoinCommand1[] = "chooseteam";
static szCommand[10];
read_argv(0, szCommand, 9);
if (equal(szCommand, szJoinCommand)
&& CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT)
{
return PLUGIN_HANDLED;
}
if (equal(szCommand, szJoinCommand1))
{
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}

public hamTouchWeapon(id)
{
return 4;
}
public TakeDMG(victim, idinflictor, attacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
if (victim != attacker)
{
if (in_Duel[victim] && !in_Duel[attacker])
{
return 4;
}
}
return 1;
}

public PlayerKilled(victim, killer, shouldgib)
{
if (is_user_alive(killer))
{
new victimname[32] , attackername[32];
get_user_name(victim, victimname, 31);
get_user_name(killer, attackername, 31);
if (victim != killer && killer != 0 )
{
if (in_Duel[killer] && in_Duel[victim])
{
if (killer)
{
g_DuelK[killer]+=1;
}
if (g_Challenge[killer])
{
g_DuelC[g_Challenge[killer]]+=1;
}
}
}
if (in_Duel[killer] && in_Duel[victim])
{
if(g_DuelK[killer]<get_pcvar_num(rounds) && g_DuelC[g_Challenge[killer]]<get_pcvar_num(rounds))
{
if (!g_Challenge[victim])
{
return PLUGIN_HANDLED;
}
else
{
return PLUGIN_HANDLED;
}
}
else
{
if (victim)
{
client_print_color(0, "!t[!gДуэли!t] ^1%s !t%i!g:!t%i ^1%s!t. Победил - !g%s",
attackername,
g_DuelC[g_Challenge[killer]],
g_DuelK[victim],
victimname,
attackername);
DisableChecks(victim);
set_task(0.5, "GoToSpawn", killer);
set_task(0.5, "GoToSpawn", victim);
}
if (g_Challenge[victim])
{
client_print_color(0, "!t[!gДуэли!t] ^1%s !t%i!g:!t%i ^1%s!t. Победил - !g%s",
attackername,
g_DuelK[killer],
g_DuelC[g_Challenge[victim]],
victimname,
attackername);
DisableChecks(g_Challenge[victim]);
set_task(0.5, "GoToSpawn", killer);
set_task(0.5, "GoToSpawn", victim);
}
g_DuelC[killer] = 0;
g_DuelK[victim] = 0;
g_DuelC[victim] = 0;
g_DuelK[killer] = 0

slash_attack[victim] = false
slash_attack[g_Challenge[victim]] = false
stab_attack[victim] = false
stab_attack[g_Challenge[victim]] = false
hs_attack[victim] = false
hs_attack[g_Challenge[victim]] = false
Non_Stop[victim] = false
Non_Stop[g_Challenge[victim]] = false

slash_attack[killer] = false
slash_attack[g_Challenge[killer]] = false
stab_attack[killer] = false
stab_attack[g_Challenge[killer]] = false
hs_attack[killer] = false
hs_attack[g_Challenge[killer]] = false
Non_Stop[killer] = false
Non_Stop[g_Challenge[killer]] = false
}
}
}
}

public PlayerSpawn(id)
{
if (is_user_alive(id) && in_Duel[id] && is_user_alive(g_Challenge[id] && in_Duel[g_Challenge[id]]))
{
whileinduel(id);
whileinduel(g_Challenge[id]);
set_user_health(id, map_default_hp);
set_user_health(g_Challenge[id], map_default_hp);
}
}

public whileinduel(id)
{

switch (g_Area[id])
{
case 1:
{
set_spawn_positions(id,vOrigin)
set_spawn_positions(g_Challenge[id],vOrigin)
}
case 2:
{
set_spawn_positions(id,fOrigin)
set_spawn_positions(g_Challenge[id],fOrigin)

}
}
}

public GoToSpawn(killer) {ExecuteHamB(Ham_CS_RoundRespawn, killer);}
public DisableChecks(id)
{
if(in_Duel[id])
{
if (!g_Area[id])
{
switch (g_Area[g_Challenge[id]])
{
case 1:
{
Arena1in = false;
}
case 2:
{
Arena2in = false;
}
}
dArena(g_Area[g_Challenge[id]]);
g_Area[g_Challenge[id]] = 0;
}
else
{
switch (g_Area[id])
{
case 1:
{
Arena1in = false;
}
case 2:
{
Arena2in = false;
}
}
dArena(g_Area[id])
g_Area[id] = 0;
}
in_Duel[g_Challenge[id]] = false;
in_Duel[id] = false;
slash_attack[id] = false;
slash_attack[g_Challenge[id]] = false ;
stab_attack[id] = false ;
stab_attack[g_Challenge[id]] = false ;
hs_attack[id] = false ;
hs_attack[g_Challenge[id]] = false;
Non_Stop[id] = false ;
Non_Stop[g_Challenge[id]] = false ;

}
if(g_Challenge[id])
{
g_Challenge[g_Challenge[id]] = 0;
g_Challenge[id] = 0;
}
}
public client_disconnect(id)
{
new cname[32], ccname[32];
get_user_name(g_Challenge[id], ccname, 31);
get_user_name(g_Challenge[g_Challenge[id]], cname, 31);
if (in_Duel[g_Challenge[id]])
{
set_task(0.5, "GoToSpawn", g_Challenge[id]);
client_print_color(g_Challenge[id], "!t[!gДуэли!t] !g%s !tвышел с сервера.", cname);
}
if (in_Duel[g_Challenge[g_Challenge[id]]])
{
set_task(0.5, "GoToSpawn", g_Challenge[g_Challenge[id]]);
client_print_color(g_Challenge[g_Challenge[id]], "!t[!gДуэли!t] !g%s !tвышел с сервера.", ccname);
}
g_DuelC[g_Challenge[id]] = 0;
g_DuelC[id] = 0;
g_DuelK[g_Challenge[id]] = 0;
g_DuelK[id] = 0;

slash_attack[id] = false
slash_attack[g_Challenge[id]] = false
stab_attack[id] = false
stab_attack[g_Challenge[id]] = false
hs_attack[id] = false
hs_attack[g_Challenge[id]] = false
Non_Stop[id] = false
Non_Stop[g_Challenge[id]] = false

DisableChecks(id);
}

public End_Duel(id)
{
new his_name[33]
get_user_name(id,his_name[id],charsmax(his_name))

if(in_Duel[id])
{
set_task(0.5, "GoToSpawn", id);
set_task(0.5, "GoToSpawn", g_Challenge[id]);
g_DuelC[g_Challenge[id]] = 0;
g_DuelC[id] = 0;
g_DuelK[g_Challenge[id]] = 0;
g_DuelK[id] = 0;
DisableChecks(id);

Non_Stop[id] = false;
Non_Stop[g_Challenge[id]] = false;
hs_attack[id] = false;
hs_attack[g_Challenge[id]] = false;
stab_attack[id] = false;
stab_attack[g_Challenge[id]] = false;
slash_attack[id] = false;
slash_attack[g_Challenge[id]] = false;

set_dhudmessage( 255, 0, 0, -1.0, 0.1, 0, 1.0, 5.0, 0.1, 0.2, false )
show_dhudmessage(0, "%s Сдался в дуэли! Лох!", his_name[id])
client_print_color(0, "!g[!tДуэли!g] %s !tрешил сдаться.", his_name[id]);
}

}
public choose_playermenu(Challenger, Challenged)
{
if (!in_Duel[Challenger] && is_user_alive(Challenger))
{
if (Arena1in && Arena2in)
{
client_print_color(Challenger, "!t[!gДуэли!t] Все арены заняты.");
return PLUGIN_HANDLED
}
}
if(his_offline[Challenged])
{
client_print_color(Challenger,"!t[!gДуэли!t] Ты не можешь вызывать на дуэль, когда ты их !gотключил.")
return PLUGIN_HANDLED
}
if(!available_duelers(Challenged))
{
client_print_color(Challenged,"%s^4Некого^1 вызвать на дуэль.",CHAT_TAG)
return PLUGIN_HANDLED
}
if (in_Duel[Challenger])
{
return PLUGIN_HANDLED
}
if (!is_user_alive(Challenger))
{
return PLUGIN_HANDLED
}


new menu = menu_create( "\y[\rДуэль\y]", "choose_playermenu_handler");
menu_additem(menu, "\r[!]\yОбновить список\r[!]^n\wВыбери, кого вызвать:", "0", 0);
new players[32], pnum;
new szName[32], szTempid[32], Desc[64];
get_players(players, pnum);
for (new i; i<pnum; i++)
{
Challenged = players[i];
if (is_user_alive(Challenged) && (Challenger != Challenged))
{
get_user_name(Challenged, szName, charsmax(szName));
formatex(Desc, charsmax(Desc), in_Duel[Challenged] ? "\d%s \y[\rВ дуэли\y]" : "%s", szName);

if(his_offline[Challenged])
{
formatex(Desc, charsmax(Desc), his_offline[Challenged] ? "\d%s \y[\rОтключил дуэли\y]" : "%s", szName);
}
num_to_str(Challenged, szTempid, charsmax(szTempid));
menu_additem(menu, Desc, szTempid, 0, g_MenuCallback);
}

}
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(Challenger, menu, 0);
return PLUGIN_HANDLED
}

public menuitem_callback(Challenger, menu, item)
{
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data, charsmax(data), szName,charsmax(szName), callback);
new tempid = str_to_num(data);
if (in_Duel[tempid] || !is_user_alive(tempid))
{
return ITEM_DISABLED;
}
if(his_offline[tempid])
{
return ITEM_DISABLED;
}
return ITEM_ENABLED;
}
public choose_playermenu_handler(Challenger, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName, charsmax(szName), callback);
new tempid = str_to_num(data);
switch(item)
{
case 0:
{
choose_playermenu(Challenger, Challenger);
}
}
if (is_user_alive(tempid) && !in_Duel[tempid])
{
g_Challenge[Challenger] = tempid;
g_Challenge[tempid] = Challenger;
Questionm(tempid);
}

menu_destroy(menu);
return PLUGIN_HANDLED;
}
public Questionm(Challenged)
{
if (is_user_alive(Challenged) && is_user_alive(g_Challenge[Challenged]))
{
new szAddItemText[555 char], ChallengerName[32];
get_user_name(g_Challenge[Challenged], ChallengerName, 31);
format(szAddItemText, charsmax(szAddItemText), "\r%s \wвызывает тебя на дуэль.^n\yПринять?", ChallengerName);
new menu = menu_create(szAddItemText, "Questionm_handler")
menu_additem(menu, "\wДа!", "1", 0);
menu_additem(menu, "\wНет!", "2", 0);
menu_setprop(menu, MPROP_PERPAGE, 0);
menu_display(Challenged, menu, 0);
return PLUGIN_HANDLED
}
else
{
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public Questionm_handler(Challenged, menu, item)
{
new data[6], szName[64], ccname[32], cname[32];
new access, callback;
menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback);
new key = str_to_num(data);
get_user_name(Challenged, ccname, 31);
get_user_name(g_Challenge[Challenged], cname, 31);
switch(key)
{
case 1:
{
if (in_Duel[g_Challenge[Challenged]])
{
if (task_exists(Challenged))
{
menu_destroy(menu);
remove_task(Challenged);
}
client_print_color(Challenged, "!t[!gДуэли!t] !gТы опоздал, !t%s !gначал другую дуэль.", cname);
DisableChecks(Challenged);
return PLUGIN_HANDLED
}
if (!is_user_alive(Challenged))
{
if (task_exists(Challenged))
{
menu_destroy(menu);
remove_task(Challenged);
}
client_print_color(Challenged, "!t[!gДуэли!t] !gТы !tмёртв.", ccname);
DisableChecks(Challenged);
return PLUGIN_HANDLED
}
if (!is_user_alive(g_Challenge[Challenged]))
{
if (task_exists(Challenged))
{
menu_destroy(menu);
remove_task(Challenged);
}
client_print_color(Challenged, "!t[!gДуэли!t] !g%s !tмертв или вышел.", cname);
DisableChecks(Challenged);
return PLUGIN_HANDLED
}
if (task_exists(Challenged))
{
menu_destroy(menu);
remove_task(Challenged);
}
if (!g_Challenge[Challenged])
{
menu_destroy(menu);
return PLUGIN_HANDLED
}
else
{
choose_area(Challenged);
client_print_color(0, "!t[!gДуэли!t] !tНачалась дуэль !g%s !tпротив !g%s!t.", ccname, cname);
in_Duel[Challenged] = true;
in_Duel[g_Challenge[Challenged]] = true;
}
return PLUGIN_HANDLED
}
case 2:
{
if (task_exists(Challenged))
{
menu_destroy(menu);
remove_task(Challenged);
}
client_print_color(g_Challenge[Challenged], "!t[!gДуэли!t] !g%s !tотклонил твой вызов.", ccname);
DisableChecks(Challenged);
return PLUGIN_HANDLED
}
}
menu_destroy(menu);
return PLUGIN_HANDLED
}

public choose_area(Challenged)
{
if (cs_get_user_team(g_Challenge[Challenged]) == cs_get_user_team(Challenged))
{
switch (cs_get_user_team(g_Challenge[Challenged]))
{
case (CS_TEAM_CT):
{
cs_set_user_team(Challenged, CS_TEAM_T, CS_T_LEET);
}
case (CS_TEAM_T):
{
cs_set_user_team(Challenged, CS_TEAM_CT, CS_CT_GIGN);
}
}
}
g_Area[Challenged] = 1;
switch (g_Area[Challenged])
{
case 1:
{
if (Arena1in) { g_Area[Challenged]+=1; }
switch (g_Area[Challenged])
{
case 2:
{
if (Arena2in)
{
new cccname[32];
get_user_name(Challenged, cccname, 31);
client_print_color(Challenged, "!t[!gДуэли!t] Все арены заняты, ты слишком долго думаешь.");
client_print_color(g_Challenge[Challenged], "!t[!gДуэли!t] Все арены заняты !g%s !tслишком долго думал.", cccname);
DisableChecks(Challenged);
}
}
}
}
}
startduel(Challenged);
}


public startduel(Challenged)
{
if (task_exists(Challenged))
{
remove_task(Challenged);
}

set_user_health(Challenged, map_default_hp);
set_user_health(g_Challenge[Challenged], map_default_hp);
set_user_armor(Challenged, 0);
set_user_armor(g_Challenge[Challenged], 0);
strip_user_weapons(Challenged);
strip_user_weapons(g_Challenge[Challenged]);
give_item(Challenged, "weapon_knife");
give_item(g_Challenge[Challenged], "weapon_knife");
set_user_maxspeed(Challenged, 250.0);
set_user_maxspeed(g_Challenge[Challenged], 250.0);
set_user_gravity(Challenged, 1.0);
set_user_gravity(g_Challenge[Challenged], 1.0);

KDC_Menu( g_Challenge[Challenged] )

switch (g_Area[Challenged])
{
case 1:
{
Arena1in = true;
makewall1()

set_spawn_positions(Challenged,vOrigin)
set_spawn_positions(g_Challenge[Challenged],vOrigin)

}
case 2:
{
Arena2in = true;
makewall2()

set_spawn_positions(Challenged,fOrigin)
set_spawn_positions(g_Challenge[Challenged],fOrigin)
}

}
most = false
return PLUGIN_HANDLED
}



public plugin_precache()
{
precache_model(DATE)
precache_model(DATE2)
}

public client_PostThink(id)
{
if( is_user_alive(id) && in_Duel[id] )
{
new flags = entity_get_int(id, EV_INT_flags);

new Float:origin[3], Float:dest[3];
entity_get_vector(id, EV_VEC_origin, origin);


dest[0] = origin[0];
dest[1] = origin[1];
dest[2] = origin[2] + 340.0;
new ptr = create_tr2();
engfunc(EngFunc_TraceHull, origin, dest, 0, flags & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, id, ptr);
new Float:flFraction;
get_tr2(ptr, TR_flFraction, flFraction);
if( flFraction >= 1.0)
{

ExecuteHamB(Ham_CS_RoundRespawn, id)
//user_kill(id)
client_print_color(id, "!g[!tДуэли!g] !tНе покидай !gарену.");

free_tr2(ptr);
return;
}

get_tr2(ptr, TR_vecPlaneNormal, dest);
free_tr2(ptr);
}
}

public NonStop(id)
{
if(in_Duel[id] && Non_Stop[id] )
{
set_user_health(id, 65)

if(get_user_team(id) == 1)
{
fVelocity[0] = 260.0;
fVelocity[1] = 0.0;
fVelocity[2] = 0.0;

set_pev( id, pev_velocity, fVelocity )
}
if(get_user_team(id) == 2)
{
fVelocity[0] = -260.0;
fVelocity[1] = 0.0;
fVelocity[2] = 0.0;

set_pev( id, pev_velocity, fVelocity )
}
}
}

public pfw_UpdateClientData(id, weapons, cd)
{
if(in_Duel[id] && Non_Stop[id] )
{
set_cd(cd, CD_flNextAttack, 1.0)

if((entity_get_int(id, EV_INT_button) & (IN_BACK | IN_MOVELEFT | IN_MOVERIGHT)))
set_cd(cd, CD_MaxSpeed, 1.0)
static iOldbuttons;
iOldbuttons = entity_get_int(id, EV_INT_oldbuttons)
if( !(iOldbuttons & IN_JUMP & IN_DUCK) )
{
entity_set_int(id, EV_INT_oldbuttons, iOldbuttons | IN_JUMP | IN_DUCK)
return HAM_HANDLED
}
return HAM_IGNORED
}
return FMRES_IGNORED
}

stock dArena(const iarena)
{
new ent = -1;
switch (iarena)
{
case 1:
{
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_A")))
{
remove_entity(ent);
}
}
case 2:
{
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_B")))
{
remove_entity(ent);
}
}
}
}


stock client_print_color(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x04"); // Green Color
replace_all(msg, 190, "!y", "^x01"); // Default Color
replace_all(msg, 190, "!t", "^x03"); // Team Color
if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();

}
}
}
}




public EntityMenu( id )
{
new flags = get_user_flags(id)
if(!(flags & ADMIN_RCON))
{
client_print(id,print_chat,"!gУ тебя !tнет доступа !gк настройке дуэлей")
return PLUGIN_HANDLED
}
new gMenu = menu_create("\yНастройка дуэли", "entity_menu")

menu_additem(gMenu, "\wАрена A", "0")
menu_additem(gMenu, "\wАрена B", "0")
menu_additem(gMenu, "\wДвигать арену", "0")
menu_additem(gMenu, "\wСохранить арену A", "0")
menu_additem(gMenu, "\wСохранить арену B", "0")
menu_additem(gMenu, "\wУдалить арену", "0")

menu_display(id, gMenu, 0)

return PLUGIN_HANDLED;
}

public entity_menu(id, menu, item, code)
{
if ( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item)
{
case 0: Make_Entity(id)
case 1: Make_Entity2(id)
case 2: move_menu(id,code)
case 3: save_first_arena(id)
case 4: save_second_arena(id)
case 5: remove_arena(id)
}
return PLUGIN_HANDLED;
}

public Make_Entity(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED

static Float:xorigin[3];

get_user_hitpoint(id,xorigin)

Entity = create_entity( "info_target" );

if(fake_arena_exists_a(id))
{
client_print_color(id,"%s ^3Maximum arenas reached.^1",CHAT_TAG)
return PLUGIN_HANDLED
}
if( is_valid_ent(Entity) )
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_A");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE );
entity_set_size( Entity , Float:{ -350.0, -230.0, 0.0 }, Float:{ 350.0, 230.0, 10.0 } );
entity_set_origin( Entity, xorigin );
}
EntityMenu(id)

return PLUGIN_HANDLED
}

public Make_Entity2(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED

static Float:xorigin[3];

get_user_hitpoint(id,xorigin)

Entity = create_entity( "info_target" );

if(fake_arena_exists_b(id))
{
client_print_color(id,"%s ^3Maximum arenas reached.^1",CHAT_TAG)
return PLUGIN_HANDLED
}
if( is_valid_ent(Entity) )
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_B");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE );
entity_set_size( Entity , Float:{ -350.0, -230.0, 0.0 }, Float:{ 350.0, 230.0, 10.0 } );

entity_set_origin( Entity, xorigin );
}
EntityMenu(id)

return PLUGIN_HANDLED
}

public remove_arena(id)
{
new ent = -1;

while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_A")))
{
remove_entity(ent);
}
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_B")))
{
remove_entity(ent);
}
EntityMenu(id)
}

public move_menu(id,code)
{
new menu
menu = menu_create( "\rMove arena:", "move_handler" );

new nameu[32];
new code_t[32];
num_to_str(code,code_t,charsmax(code_t))
formatex(nameu,charsmax(nameu), "Move up");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move down");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move front");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move back");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move right");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move left");
menu_additem(menu, nameu, code_t, 0);

formatex(nameu,charsmax(nameu), "Move size: %.2f",move_size[id]);
menu_additem(menu, nameu, code_t, 0);

menu_display(id, menu, 0 );
return PLUGIN_HANDLED
}

public move_handler( id, menu, item )
{
if ( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new szData[32], szName[64];
new _access, item_callback;
menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );
new code = str_to_num(szData)

if(containi(szName,"move size:") != -1)
{
move_size[id]+= 10.0
if(move_size[id] > 100.0)
{
move_size[id] = 10.0
}
}

else if(equali(szName,"move up"))
{
move_the_fake_arena(id,code,MOVE_UP)
}
else if(equali(szName,"move down"))
{
move_the_fake_arena(id,code,MOVE_DOWN)
}
else if(equali(szName,"move right"))
{
move_the_fake_arena(id,code,MOVE_RIGHT)
}
else if(equali(szName,"move left"))
{
move_the_fake_arena(id,code,MOVE_LEFT)
}
else if(equali(szName,"move front"))
{
move_the_fake_arena(id,code,MOVE_FRONT)
}
else if(equali(szName,"move back"))
{
move_the_fake_arena(id,code,MOVE_BACK)
}
menu_destroy( menu );
move_menu(id,code)

return PLUGIN_CONTINUE;
}

public move_the_fake_arena(id,code,moveto)
{
new ent = -1;
new Float:origin[3];

while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_A")))
{
pev(ent,pev_origin,origin);

switch(moveto)
{
case MOVE_UP:
{
origin[2]+=move_size[id]
}
case MOVE_DOWN:
{
origin[2]-=move_size[id]
}
case MOVE_RIGHT:
{
origin[1]+=move_size[id]
}
case MOVE_LEFT:
{
origin[1]-=move_size[id]
}
case MOVE_FRONT:
{
origin[0]+=move_size[id]
}
case MOVE_BACK:
{
origin[0]-=move_size[id]
}
}
engfunc(EngFunc_SetOrigin,ent,origin);
}

while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_B")))
{
pev(ent,pev_origin,origin);

switch(moveto)
{
case MOVE_UP:
{
origin[2]+=move_size[id]
}
case MOVE_DOWN:
{
origin[2]-=move_size[id]
}
case MOVE_RIGHT:
{
origin[1]+=move_size[id]
}
case MOVE_LEFT:
{
origin[1]-=move_size[id]
}
case MOVE_FRONT:
{
origin[0]+=move_size[id]
}
case MOVE_BACK:
{
origin[0]-=move_size[id]
}
}
engfunc(EngFunc_SetOrigin,ent,origin);
}

}

public save_first_arena(id)
{
new found;
new cfgdir[32], mapname[32], urlfile[64]
get_configsdir(cfgdir, charsmax(cfgdir))
get_mapname(mapname, charsmax(mapname))
formatex(urlfile, charsmax(urlfile), ARENA_FILE_AAA, cfgdir, mapname)

if (file_exists(urlfile))
delete_file(urlfile)

new lineset[128]
new Float:origin[3]
new ent=-1;
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_A")))
{
found++
pev(ent,pev_origin,origin);
format(lineset, charsmax(lineset), "%.f %.f %.f", origin[0], origin[1], origin[2])
write_file(urlfile, lineset,found)
}
if(!found)
client_print_color(id, "%s Couldn't save:^3No arenas found.",CHAT_TAG)
else client_print_color(id,"%s %d ^3Arena Number 1 coords saved.",CHAT_TAG,found)
EntityMenu(id)
Load_Coords()
Load_Coords2()

}

public save_second_arena(id)
{
new found;
new cfdir[32], mapname[32], urfile[64]
get_configsdir(cfdir, charsmax(cfdir))
get_mapname(mapname, charsmax(mapname))
formatex(urfile, charsmax(urfile), ARENA_FILE_BBB, cfdir, mapname)

if (file_exists(urfile))
delete_file(urfile)

new lineset[128]
new Float:origin[3]
new ent=-1;
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_B")))
{
found++
pev(ent,pev_origin,origin);
format(lineset, charsmax(lineset), "%.f %.f %.f", origin[0], origin[1], origin[2])
write_file(urfile, lineset,found)
}
if(!found)
client_print_color(id, "%s Couldn't save:^3No arenas found.",CHAT_TAG)
else client_print_color(id,"%s %d ^3Arena Number 2 coords saved.",CHAT_TAG,found)
EntityMenu(id)
Load_Coords()
Load_Coords2()
}

public Load_Coords()
{
new cfgdir[32], mapname[32], filepath[512]
get_configsdir(cfgdir, charsmax(cfgdir))
get_mapname(mapname, charsmax(mapname))

new readdata[128]
new txtlen

formatex(filepath, charsmax(filepath), ARENA_FILE_AAA, cfgdir, mapname)

if ( file_exists(filepath) )
{

new sOrigins[3][16];

new i
new fsize = file_size(filepath,1)
for (new line=0;line<=fsize;line++)
{
read_file(filepath,line,readdata,127,txtlen)

parse(readdata, sOrigins[0], 15, sOrigins[1], 15, sOrigins[2], 15)
for(i = 0; i < 3; i++)
{
vOrigin[i] = str_to_float(sOrigins[i])
}
}
}
return PLUGIN_CONTINUE
}

public Load_Coords2()
{
new cfgdir[32], mapname[32], filepath[512]
get_configsdir(cfgdir, charsmax(cfgdir))
get_mapname(mapname, charsmax(mapname))

new readdata[128]
new txtlen

formatex(filepath, charsmax(filepath), ARENA_FILE_BBB, cfgdir, mapname)

if ( file_exists(filepath) )
{

new sOrigins[3][16];

new i
new fsize = file_size(filepath,1)
for (new line=0;line<=fsize;line++)
{
read_file(filepath,line,readdata,127,txtlen)

parse(readdata, sOrigins[0], 15, sOrigins[1], 15, sOrigins[2], 15)
for(i = 0; i < 3; i++)
{
fOrigin[i] = str_to_float(sOrigins[i])
}
}
}
return PLUGIN_CONTINUE
}

public fake_arena_exists_a(code)
{
new ent = -1
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_A")))
{
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}

public fake_arena_exists_b(code)
{
new ent = -1
while ((ent = find_ent_by_class(ent, "ARENA_NUMBER_B")))
{
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}


public makewall1()
{

Entity = create_entity( "info_target" );

if( is_valid_ent(Entity) )
{
if(most == true)
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_A");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE2 );
entity_set_size( Entity , Float:{ -352.0, -11.0, 0.0 }, Float:{ 352.0, 11.0, 10.0 } );
entity_set_origin( Entity, vOrigin );
}
else
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_A");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE );
entity_set_size( Entity , Float:{ -347.0, -222.0, 0.0 }, Float:{ 347.0, 222.0, 10.0 } );
entity_set_origin( Entity, vOrigin );
}
}

}

public makewall2()
{

Entity = create_entity( "info_target" );

if( is_valid_ent(Entity) )
{
if(most == true)
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_B");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE2 );
entity_set_size( Entity , Float:{ -352.0, -11.0, 0.0 }, Float:{ 352.0, 11.0, 10.0 } );
entity_set_origin( Entity, fOrigin );
}
else
{
entity_set_string( Entity , EV_SZ_classname, "ARENA_NUMBER_B");
entity_set_int( Entity , EV_INT_solid, SOLID_BBOX);
entity_set_model( Entity , DATE );
entity_set_size( Entity , Float:{ -347.0, -222.0, 0.0 }, Float:{ 347.0, 222.0, 10.0 } );
entity_set_origin( Entity, fOrigin );
}
}

}

public set_spawn_positions(id,Float:origin[3])
{
if(get_user_team(id) == 1)
{
his_spawn[id][0] = origin[0]-320.0
his_spawn[id][1] = origin[1]
his_spawn[id][2] = origin[2]+50.0
set_Angle(id, Float:{0.0, 0.0, 0.0})
}
if(get_user_team(id) == 2)
{
his_spawn[id][0] = origin[0]+320.0
his_spawn[id][1] = origin[1]
his_spawn[id][2] = origin[2]+50.0
set_Angle(id, Float:{0.0, 180.0, 0.0})
}
entity_set_origin(id,his_spawn[id])

}

public stuck_check(Float:origin[3],Float:radius)
{
new player=-1;
while((player = find_ent_in_sphere(player,origin,radius)) != 0)
{
if(is_user_alive(player))
{
if(is_player_stuck(player))
{
his_spawn[player][0] = origin[0]
his_spawn[player][1] = origin[1]
his_spawn[player][2] = origin[2]+50.0
entity_set_origin(player,his_spawn[player])
}
}
}
}


stock set_Angle( index , Float:fAngle[ 3 ])
{
entity_set_vector( index , EV_VEC_angles , fAngle );
entity_set_int( index , EV_INT_fixangle , 1 );
}


stock get_user_hitpoint(id,Float:hOrigin[3]) {
if(!is_user_alive(id))
return 0;

new Float:fOrigin[3],Float:fvAngle[3],Float:fvOffset[3],Float:fvOrigin[3],Float:feOrigin[3];
new Float:fTemp[3];

pev(id,pev_origin,fOrigin);
pev(id,pev_v_angle,fvAngle);
pev(id,pev_view_ofs,fvOffset);

xs_vec_add(fOrigin,fvOffset,fvOrigin);

engfunc(EngFunc_AngleVectors,fvAngle,feOrigin,fTemp,fTemp);

xs_vec_mul_scalar(feOrigin,9999.9,feOrigin);
xs_vec_add(fvOrigin,feOrigin,feOrigin);

engfunc(EngFunc_TraceLine,fvOrigin,feOrigin,0,id);
global_get(glb_trace_endpos,hOrigin);

return 1;
}

stock is_player_stuck(id)
{
static Float:originF[3]
pev(id, pev_origin, originF)

engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)

if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
return true;

return false;
}

stock available_duelers(asker)
{
new num;
num = 0 // just incase...
for(new id;id < maxplayers;id++)
{
if(is_user_alive(id))
{
if(/*!in_Duel[id] && */id != asker && !is_user_bot(id))
{
num++
}
}
}
return num
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }
*/
Добрый день! Возникла новая проблема с этим плагином. Не критичная конечно и редко возникающая. Но неприятная.

Постараюсь подробно описать проблему:

Иногда бывают моменты что два игрока одновременно приглашают других игроков на дуэль, Другой игрок принимает дуэль и спавнится на арене со своими опонентом. Дуэль проходит нормально всё ок.

Но во время дуэли принимает вызов на дуэль другой игрок. Который долго думал и тормозил. И вот тут начинается самое интересное. Эти два дуэлянта спавнятся на той же арене что и заспавнились первые 2. По сути дуэль идёт 2 на 2. Но такого быть не должно.

Подскажите. возможно ли сделать так чтобы допусти если первые два дуэлянта начали дуэль, то у всех остальных меню дуэлей и приглашений закрывалось? Ну или им писало бы что все арены заняты в данный момент?

Вроде бы есть такая функция но что-то некорректно работает она.
 

Вложения

  • 38.9 KB Просмотры: 302
Сообщения
67
Реакции
4
В общем я так понял, нет смысла реанимировать старое и корявое.

Лучше найти нормального скриптера, который напишет мне с нуля дуэли за условные 1-2к руб.

Но зато с грамотным кодом, диглами, скаутами, выбором хп, и прочее, на что способна фантазия.

Но в последний раз всё же хочу попробовать реанимировать этот колхоз. Глядишь и прокнет и новых багов не вылезет.
 

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

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