nomy

Untitled

Oct 11th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 208.59 KB | None | 0 0
  1. /*
  2.  * SourceMod Hosties Project
  3.  * by: databomb & dataviruset
  4.  *
  5.  * This file is part of the SM Hosties project.
  6.  *
  7.  * This program is free software; you can redistribute it and/or modify it under
  8.  * the terms of the GNU General Public License, version 3.0, as published by the
  9.  * Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful, but WITHOUT
  12.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13.  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14.  * details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License along with
  17.  * this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  */
  19.  
  20. // Include files
  21. #include <sourcemod>
  22. #include <sdktools>
  23. #include <cstrike>
  24. #include <sdkhooks>
  25. #include <hosties>
  26. #include <lastrequest>
  27.  
  28. // Compiler options
  29. #pragma semicolon 1
  30.  
  31. // Global variables
  32. new bool:g_bIsLRAvailable = true;
  33. new bool:g_bRoundInProgress = true;
  34. new bool:g_bListenersAdded = false;
  35. new bool:g_bAnnouncedThisRound = false;
  36. new bool:g_bInLastRequest[MAXPLAYERS+1];
  37. new bool:g_bIsARebel[MAXPLAYERS+1];
  38. new Handle:gH_BuildLR[MAXPLAYERS+1];
  39. new LastRequest:g_LRLookup[MAXPLAYERS+1];
  40. new g_LR_PermissionLookup[MAXPLAYERS+1];
  41. new Handle:g_GunTossTimer = INVALID_HANDLE;
  42. new Handle:g_ChickenFightTimer = INVALID_HANDLE;
  43. new Handle:g_DodgeballTimer = INVALID_HANDLE;
  44. new Handle:g_BeaconTimer = INVALID_HANDLE;
  45. new Handle:g_RaceTimer = INVALID_HANDLE;
  46. new Handle:g_DelayLREnableTimer = INVALID_HANDLE;
  47. new Handle:g_BeerGogglesTimer = INVALID_HANDLE;
  48. new Handle:g_CountdownTimer = INVALID_HANDLE;
  49. new Handle:g_FarthestJumpTimer = INVALID_HANDLE;
  50.  
  51. new Handle:gH_Frwd_LR_CleanUp = INVALID_HANDLE;
  52. new Handle:gH_Frwd_LR_Start = INVALID_HANDLE;
  53. new Handle:gH_Frwd_LR_Process = INVALID_HANDLE;
  54. new Handle:gH_Frwd_LR_StartGlobal = INVALID_HANDLE;
  55. new Handle:gH_Frwd_LR_Available = INVALID_HANDLE;
  56.  
  57. new BeamSprite = -1;
  58. new HaloSprite = -1;
  59. new LaserSprite = -1;
  60. new LaserHalo = -1;
  61. new greenColor[] = {15, 255, 15, 255};
  62. new redColor[] = {255, 25, 15, 255};
  63. new blueColor[] = {50, 75, 255, 255};
  64. new greyColor[] = {128, 128, 128, 255};
  65. new yellowColor[] = {255, 255, 0, 255};
  66.  
  67. new g_Offset_Health = -1;
  68. new g_Offset_Armor = -1;
  69. new g_Offset_Clip1 = -1;
  70. new g_Offset_Ammo = -1;
  71. new g_Offset_FOV = -1;
  72. new g_Offset_ActiveWeapon = -1;
  73. new g_Offset_GroundEnt = -1;
  74. new g_Offset_DefFOV = -1;
  75. new g_Offset_PunchAngle = -1;
  76. new g_Offset_SecAttack = -1;
  77.  
  78. new Handle:gH_DArray_LastRequests = INVALID_HANDLE;
  79. new Handle:gH_DArray_LR_Partners = INVALID_HANDLE;
  80. new Handle:gH_DArray_Beacons = INVALID_HANDLE;
  81. new Handle:gH_DArray_LR_CustomNames = INVALID_HANDLE;
  82.  
  83. new Handle:gH_Cvar_LR_KnifeFight_On = INVALID_HANDLE;
  84. new Handle:gH_Cvar_LR_Shot4Shot_On = INVALID_HANDLE;
  85. new Handle:gH_Cvar_LR_GunToss_On = INVALID_HANDLE;
  86. new Handle:gH_Cvar_LR_ChickenFight_On = INVALID_HANDLE;
  87. new Handle:gH_Cvar_LR_HotPotato_On = INVALID_HANDLE;
  88. new Handle:gH_Cvar_LR_Dodgeball_On = INVALID_HANDLE;
  89. new Handle:gH_Cvar_LR_NoScope_On = INVALID_HANDLE;
  90. new Handle:gH_Cvar_LR_RockPaperScissors_On = INVALID_HANDLE;
  91. new Handle:gH_Cvar_LR_Rebel_On = INVALID_HANDLE;
  92. new Handle:gH_Cvar_LR_Mag4Mag_On = INVALID_HANDLE;
  93. new Handle:gH_Cvar_LR_Race_On = INVALID_HANDLE;
  94. new Handle:gH_Cvar_LR_RussianRoulette_On = INVALID_HANDLE;
  95. new Handle:gH_Cvar_LR_JumpContest_On = INVALID_HANDLE;
  96. new Handle:gH_Cvar_Announce_Delay_Enable = INVALID_HANDLE;
  97. new Handle:gH_Cvar_LR_HotPotato_Mode = INVALID_HANDLE;
  98. new Handle:gH_Cvar_MaxPrisonersToLR = INVALID_HANDLE;
  99. new Handle:gH_Cvar_RebelAction = INVALID_HANDLE;
  100. new Handle:gH_Cvar_RebelHandling = INVALID_HANDLE;
  101. new Handle:gH_Cvar_SendGlobalMsgs = INVALID_HANDLE;
  102. new Handle:gH_Cvar_ColorRebels = INVALID_HANDLE;
  103. new Handle:gH_Cvar_LR_Enable = INVALID_HANDLE;
  104. new Handle:gH_Cvar_LR_MenuTime = INVALID_HANDLE;
  105. new Handle:gH_Cvar_LR_KillTimeouts = INVALID_HANDLE;
  106. new Handle:gH_Cvar_ColorRebels_Red = INVALID_HANDLE;
  107. new Handle:gH_Cvar_ColorRebels_Blue = INVALID_HANDLE;
  108. new Handle:gH_Cvar_ColorRebels_Green = INVALID_HANDLE;
  109. new Handle:gH_Cvar_LR_Beacons = INVALID_HANDLE;
  110. new Handle:gH_Cvar_LR_HelpBeams = INVALID_HANDLE;
  111. new Handle:gH_Cvar_LR_HelpBeams_Distance = INVALID_HANDLE;
  112. new Handle:gH_Cvar_LR_Beacon_Interval = INVALID_HANDLE;
  113. new Handle:gH_Cvar_RebelOnImpact = INVALID_HANDLE;
  114. new Handle:gH_Cvar_LR_ChickenFight_Slay = INVALID_HANDLE;
  115. new Handle:gH_Cvar_LR_ChickenFight_C_Blue = INVALID_HANDLE;
  116. new Handle:gH_Cvar_LR_ChickenFight_C_Red = INVALID_HANDLE;
  117. new Handle:gH_Cvar_LR_ChickenFight_C_Green = INVALID_HANDLE;
  118. new Handle:gH_Cvar_LR_Dodgeball_CheatCheck = INVALID_HANDLE;
  119. new Handle:gH_Cvar_LR_Dodgeball_SpawnTime = INVALID_HANDLE;
  120. new Handle:gH_Cvar_LR_Dodgeball_Gravity = INVALID_HANDLE;
  121. new Handle:gH_Cvar_LR_HotPotato_MaxTime = INVALID_HANDLE;
  122. new Handle:gH_Cvar_LR_HotPotato_MinTime = INVALID_HANDLE;
  123. new Handle:gH_Cvar_LR_HotPotato_Speed = INVALID_HANDLE;
  124. new Handle:gH_Cvar_LR_NoScope_Sound = INVALID_HANDLE;
  125. new Handle:gH_Cvar_LR_Sound = INVALID_HANDLE;
  126. new Handle:gH_Cvar_LR_NoScope_Weapon = INVALID_HANDLE;
  127. new Handle:gH_Cvar_LR_S4S_DoubleShot = INVALID_HANDLE;
  128. new Handle:gH_Cvar_LR_GunToss_MarkerMode = INVALID_HANDLE;
  129. new Handle:gH_Cvar_LR_GunToss_StartMode = INVALID_HANDLE;
  130. new Handle:gH_Cvar_LR_GunToss_ShowMeter = INVALID_HANDLE;
  131. new Handle:gH_Cvar_LR_Race_AirPoints = INVALID_HANDLE;
  132. new Handle:gH_Cvar_LR_Race_NotifyCTs = INVALID_HANDLE;
  133. new Handle:gH_Cvar_Announce_CT_FreeHit = INVALID_HANDLE;
  134. new Handle:gH_Cvar_Announce_LR = INVALID_HANDLE;
  135. new Handle:gH_Cvar_Announce_Rebel = INVALID_HANDLE;
  136. new Handle:gH_Cvar_Announce_RebelDown = INVALID_HANDLE;
  137. new Handle:gH_Cvar_Announce_Weapon_Attack = INVALID_HANDLE;
  138. new Handle:gH_Cvar_Announce_HotPotato_Eqp = INVALID_HANDLE;
  139. new Handle:gH_Cvar_Announce_Shot4Shot = INVALID_HANDLE;
  140. new Handle:gH_Cvar_LR_NonContKiller_Action = INVALID_HANDLE;
  141. new Handle:gH_Cvar_LR_Delay_Enable_Time = INVALID_HANDLE;
  142. new Handle:gH_Cvar_LR_Damage = INVALID_HANDLE;
  143. new Handle:gH_Cvar_LR_NoScope_Delay = INVALID_HANDLE;
  144. new Handle:gH_Cvar_LR_ChickenFight_Rebel = INVALID_HANDLE;
  145. new Handle:gH_Cvar_LR_HotPotato_Rebel = INVALID_HANDLE;
  146. new Handle:gH_Cvar_LR_KnifeFight_Rebel = INVALID_HANDLE;
  147. new Handle:gH_Cvar_LR_Rebel_MaxTs = INVALID_HANDLE;
  148. new Handle:gH_Cvar_LR_Rebel_MinCTs = INVALID_HANDLE;
  149. new Handle:gH_Cvar_LR_M4M_MagCapacity = INVALID_HANDLE;
  150. new Handle:gH_Cvar_LR_KnifeFight_LowGrav = INVALID_HANDLE;
  151. new Handle:gH_Cvar_LR_KnifeFight_HiSpeed = INVALID_HANDLE;
  152. new Handle:gH_Cvar_LR_KnifeFight_Drunk = INVALID_HANDLE;
  153. new Handle:gH_Cvar_LR_Beacon_Sound = INVALID_HANDLE;
  154. new Handle:gH_Cvar_LR_AutoDisplay = INVALID_HANDLE;
  155. new Handle:gH_Cvar_LR_BlockSuicide = INVALID_HANDLE;
  156. new Handle:gH_Cvar_LR_VictorPoints = INVALID_HANDLE;
  157.  
  158. new g_iLastCT_FreeAttacker = -1;
  159. new gShadow_LR_KnifeFight_On = -1;
  160. new gShadow_LR_Shot4Shot_On = -1;
  161. new gShadow_LR_GunToss_On = -1;
  162. new gShadow_LR_ChickenFight_On = -1;
  163. new gShadow_LR_HotPotato_On = -1;
  164. new gShadow_LR_Dodgeball_On = -1;
  165. new gShadow_LR_NoScope_On = -1;
  166. new gShadow_LR_RockPaperScissors_On = -1;
  167. new gShadow_LR_Rebel_On = -1;
  168. new gShadow_LR_Mag4Mag_On = -1;
  169. new gShadow_LR_Race_On = -1;
  170. new gShadow_LR_RussianRoulette_On = -1;
  171. new gShadow_LR_JumpContest_On = -1;
  172. new Float:gShadow_LR_Beacon_Interval = -1.0;
  173. new bool:gShadow_LR_ChickenFight_Slay = false;
  174. new gShadow_LR_ChickenFight_C_Blue = -1;
  175. new gShadow_LR_ChickenFight_C_Red = -1;
  176. new gShadow_LR_ChickenFight_C_Green = -1;
  177. new bool:gShadow_LR_Dodgeball_CheatCheck = false;
  178. new Float:gShadow_LR_Dodgeball_SpawnTime = -1.0;
  179. new Float:gShadow_LR_Dodgeball_Gravity = -1.0;
  180. new gShadow_RebelOnImpact = -1;
  181. new gShadow_ColorRebels_Red = -1;
  182. new gShadow_ColorRebels_Blue = -1;
  183. new gShadow_ColorRebels_Green = -1;
  184. new gShadow_LR_HotPotato_Mode = -1;
  185. new gShadow_MaxPrisonersToLR = -1;
  186. new gShadow_RebelAction = -1;
  187. new gShadow_RebelHandling = -1;
  188. new gShadow_SendGlobalMsgs = -1;
  189. new gShadow_ColorRebels = -1;
  190. new bool:gShadow_LR_Enable = false;
  191. new gShadow_LR_MenuTime = 0;
  192. new bool:gShadow_LR_AutoDisplay = false;
  193. new bool:gShadow_LR_Beacons = false;
  194. new bool:gShadow_LR_HelpBeams = false;
  195. new Float:gShadow_LR_HelpBeams_Distance = -1.0;
  196. new Float:gShadow_LR_HotPotato_MaxTime = -1.0;
  197. new Float:gShadow_LR_HotPotato_MinTime = -1.0;
  198. new Float:gShadow_LR_HotPotato_Speed = -1.0;
  199. new bool:gShadow_LR_S4S_DoubleShot;
  200. new bool:gShadow_LR_NonContKiller_Action;
  201. new gShadow_LR_GunToss_MarkerMode = -1;
  202. new gShadow_LR_GunToss_StartMode = -1;
  203. new gShadow_LR_GunToss_ShowMeter = -1;
  204. new bool:gShadow_LR_Race_AirPoints = false;
  205. new bool:gShadow_LR_Race_NotifyCTs = false;
  206. new bool:gShadow_Announce_CT_FreeHit = false;
  207. new bool:gShadow_Announce_LR = false;
  208. new bool:gShadow_Announce_Rebel = false;
  209. new bool:gShadow_Announce_RebelDown = false;
  210. new bool:gShadow_Announce_HotPotato_Eqp = false;
  211. new bool:gShadow_Announce_Weapon_Attack = false;
  212. new bool:gShadow_Announce_Shot4Shot = false;
  213. new String:gShadow_LR_NoScope_Sound[PLATFORM_MAX_PATH];
  214. new String:gShadow_LR_Sound[PLATFORM_MAX_PATH];
  215. new gShadow_LR_NoScope_Weapon = -1;
  216. new bool:gShadow_Announce_Delay_Enable = false;
  217. new Float:gShadow_LR_Delay_Enable_Time = 0.0;
  218. new bool:g_bPushedToMenu = false;
  219. new bool:gShadow_LR_Damage = false;
  220. new gShadow_LR_NoScope_Delay = -1;
  221. new gShadow_LR_ChickenFight_Rebel = -1;
  222. new gShadow_LR_HotPotato_Rebel = -1;
  223. new gShadow_LR_KnifeFight_Rebel = -1;
  224. new gShadow_LR_Rebel_MaxTs = -1;
  225. new gShadow_LR_Rebel_MinCTs = -1;
  226. new gShadow_LR_M4M_MagCapacity = -1;
  227. new Float:gShadow_LR_KnifeFight_LowGrav = -1.0;
  228. new Float:gShadow_LR_KnifeFight_HiSpeed = -1.0;
  229. new gShadow_LR_KnifeFight_Drunk = -1;
  230. new String:gShadow_LR_Beacon_Sound[PLATFORM_MAX_PATH];
  231. new bool:gShadow_LR_KillTimeouts = false;
  232. new bool:gShadow_LR_BlockSuicide = false;
  233. new gShadow_LR_VictorPoints = -1;
  234.  
  235. // Autostart
  236. new LastRequest:g_selection[MAXPLAYERS + 1];
  237. new g_LR_Player_Guard[MAXPLAYERS + 1];
  238.  
  239. // Custom types local to the plugin
  240. enum NoScopeWeapon
  241. {
  242.     NSW_AWP = 0,
  243.     NSW_Scout,
  244.     NSW_SG550,
  245.     NSW_G3SG1
  246. };
  247.  
  248. enum PistolWeapon
  249. {
  250.     Pistol_Deagle = 0,
  251.     Pistol_P228,
  252.     Pistol_Glock,
  253.     Pistol_FiveSeven,
  254.     Pistol_Dualies,
  255.     Pistol_USP,
  256.     Pistol_Tec9
  257. };
  258.  
  259. enum KnifeType
  260. {
  261.     Knife_Vintage = 0,
  262.     Knife_Drunk,
  263.     Knife_LowGrav,
  264.     Knife_HiSpeed,
  265.     Knife_Drugs,
  266.     Knife_ThirdPerson,
  267.     Knife_Throwing,
  268.     Knife_Flying
  269. };
  270.  
  271. enum JumpContest
  272. {
  273.     Jump_TheMost = 0,
  274.     Jump_Farthest,
  275.     Jump_BrinkOfDeath
  276. };
  277.  
  278. new String:g_sLastRequestPhrase[LastRequest][MAX_DISPLAYNAME_SIZE];
  279.  
  280. LastRequest_OnPluginStart()
  281. {
  282.     // Populate translation entries
  283.     // no longer pulling LANG_SERVER
  284.     g_sLastRequestPhrase[LR_KnifeFight] = "Knife Fight";
  285.     g_sLastRequestPhrase[LR_Shot4Shot] = "Shot4Shot";
  286.     g_sLastRequestPhrase[LR_GunToss] = "Gun Toss";
  287.     g_sLastRequestPhrase[LR_ChickenFight] = "Chicken Fight";
  288.     g_sLastRequestPhrase[LR_HotPotato] = "Hot Potato";
  289.     g_sLastRequestPhrase[LR_Dodgeball] = "Dodgeball";
  290.     g_sLastRequestPhrase[LR_NoScope] = "No Scope Battle";
  291.     g_sLastRequestPhrase[LR_RockPaperScissors] = "Rock Paper Scissors";
  292.     g_sLastRequestPhrase[LR_Rebel] = "Rebel!";
  293.     g_sLastRequestPhrase[LR_Mag4Mag] = "Mag4Mag";
  294.     g_sLastRequestPhrase[LR_Race] = "Race";
  295.     g_sLastRequestPhrase[LR_RussianRoulette] = "Russian Roulette";
  296.     g_sLastRequestPhrase[LR_JumpContest] = "Jumping Contest";
  297.  
  298.     // Gather all offsets
  299.     g_Offset_Health = FindSendPropOffs("CBasePlayer", "m_iHealth");
  300.     if (g_Offset_Health == -1)
  301.     {
  302.         SetFailState("Unable to find offset for health.");
  303.     }
  304.     g_Offset_Armor = FindSendPropOffs("CCSPlayer", "m_ArmorValue");
  305.     if (g_Offset_Armor == -1)
  306.     {
  307.         SetFailState("Unable to find offset for armor.");
  308.     }
  309.     g_Offset_Clip1 = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
  310.     if (g_Offset_Clip1 == -1)
  311.     {
  312.         SetFailState("Unable to find offset for clip.");
  313.     }
  314.     g_Offset_Ammo = FindSendPropInfo("CCSPlayer", "m_iAmmo");
  315.     if (g_Offset_Ammo == -1)
  316.     {
  317.         SetFailState("Unable to find offset for ammo.");
  318.     }
  319.     g_Offset_FOV = FindSendPropOffs("CBasePlayer", "m_iFOV");
  320.     if (g_Offset_FOV == -1)
  321.     {
  322.         SetFailState("Unable to find offset for FOV.");
  323.     }
  324.     g_Offset_ActiveWeapon = FindSendPropInfo("CCSPlayer", "m_hActiveWeapon");
  325.     if (g_Offset_ActiveWeapon == -1)
  326.     {
  327.         SetFailState("Unable to find offset for active weapon.");
  328.     }
  329.     g_Offset_GroundEnt = FindSendPropOffs("CBasePlayer", "m_hGroundEntity");
  330.     if (g_Offset_GroundEnt == -1)
  331.     {
  332.         SetFailState("Unable to find offset for ground entity.");
  333.     }
  334.     g_Offset_DefFOV = FindSendPropOffs("CBasePlayer", "m_iDefaultFOV");
  335.     if (g_Offset_DefFOV == -1)
  336.     {
  337.         SetFailState("Unable to find offset for default FOV.");
  338.     }
  339.     if (g_Game == Game_CSS)
  340.     {
  341.         g_Offset_PunchAngle = FindSendPropInfo("CBasePlayer", "m_vecPunchAngle");
  342.     }
  343.     else if (g_Game == Game_CSGO)
  344.     {
  345.         g_Offset_PunchAngle = FindSendPropInfo("CBasePlayer", "m_aimPunchAngle");
  346.     }
  347.     if (g_Offset_PunchAngle == -1)
  348.     {
  349.         SetFailState("Unable to find offset for punch angle.");
  350.     }
  351.     g_Offset_SecAttack = FindSendPropOffs("CBaseCombatWeapon", "m_flNextSecondaryAttack");
  352.     if (g_Offset_SecAttack == -1)
  353.     {
  354.         SetFailState("Unable to find offset for next secondary attack.");
  355.     }
  356.    
  357.     // Console commands
  358.     RegConsoleCmd("sm_lr", Command_LastRequest);
  359.     RegConsoleCmd("sm_lastrequest", Command_LastRequest);
  360.    
  361.     // Admin commands
  362.     RegAdminCmd("sm_stoplr", Command_CancelLR, ADMFLAG_SLAY);
  363.     RegAdminCmd("sm_cancellr", Command_CancelLR, ADMFLAG_SLAY);
  364.     RegAdminCmd("sm_abortlr", Command_CancelLR, ADMFLAG_SLAY);
  365.    
  366.     // Events hooks
  367.     HookEvent("round_start", LastRequest_RoundStart);
  368.     HookEvent("round_end", LastRequest_RoundEnd);
  369.     HookEvent("player_hurt", LastRequest_PlayerHurt);
  370.     HookEvent("player_death", LastRequest_PlayerDeath);
  371.     HookEvent("bullet_impact", LastRequest_BulletImpact);
  372.     HookEvent("player_disconnect", LastRequest_PlayerDisconnect);
  373.     HookEvent("weapon_zoom", LastRequest_WeaponZoom, EventHookMode_Pre);
  374.     HookEvent("weapon_fire", LastRequest_WeaponFire);
  375.     HookEvent("player_jump", LastRequest_PlayerJump);
  376.    
  377.     // Make global arrays
  378.     gH_DArray_LastRequests = CreateArray(2);
  379.     gH_DArray_Beacons = CreateArray();
  380.     gH_DArray_LR_CustomNames = CreateArray(MAX_DISPLAYNAME_SIZE);
  381.     gH_DArray_LR_Partners = CreateArray(10);
  382.     // array structure:
  383.     // -- block 0 -> LastRequest type
  384.     // -- block 1 -> Prisoner client index
  385.     // -- block 2 -> Guard client index
  386.     // -- block 3 -> LR Data (Prisoner)
  387.     // -- block 4 -> LR Data (Guard)
  388.     // -- block 5 -> LR Data (Global 1)
  389.     // -- block 6 -> LR Data (Global 2)
  390.     // -- block 7 -> LR Data (Global 3)
  391.     // -- block 8 -> LR Data (Global 4)
  392.     // -- block 9 -> Handle to Additional Data
  393.    
  394.     // Create forwards for custom LR plugins
  395.     gH_Frwd_LR_Available = CreateGlobalForward("OnAvailableLR", ET_Ignore, Param_Cell);
  396.     gH_Frwd_LR_CleanUp = CreateForward(ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
  397.     gH_Frwd_LR_Start = CreateForward(ET_Ignore, Param_Cell, Param_Cell);
  398.     gH_Frwd_LR_Process = CreateForward(ET_Event, Param_Cell, Param_Cell);
  399.     gH_Frwd_LR_StartGlobal = CreateGlobalForward("OnStartLR", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
  400.    
  401.     // Register cvars
  402.     gH_Cvar_LR_Enable = CreateConVar("sm_hosties_lr", "1", "Enable or disable Last Requests (the !lr command): 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  403.     gShadow_LR_Enable = true;
  404.     gH_Cvar_LR_MenuTime = CreateConVar("sm_hosties_lr_menutime", "0", "Sets the time the LR menu is displayed (in seconds)", FCVAR_PLUGIN, true, 0.0);
  405.     gShadow_LR_MenuTime = 0;
  406.     gH_Cvar_LR_KillTimeouts = CreateConVar("sm_hosties_lr_killtimeouts", "0", "Kills Ts who timeout the LR menu and controls whether the exit button is displayed: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  407.     gShadow_LR_KillTimeouts = false;
  408.     gH_Cvar_LR_KnifeFight_On = CreateConVar("sm_hosties_lr_kf_enable", "1", "Enable LR Knife Fight: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  409.     gShadow_LR_KnifeFight_On = true;
  410.     gH_Cvar_LR_Shot4Shot_On = CreateConVar("sm_hosties_lr_s4s_enable", "1", "Enable LR Shot4Shot: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  411.     gShadow_LR_Shot4Shot_On = true;
  412.     gH_Cvar_LR_GunToss_On = CreateConVar("sm_hosties_lr_gt_enable", "1", "Enable LR Gun Toss: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  413.     gShadow_LR_GunToss_On = true;
  414.     gH_Cvar_LR_ChickenFight_On = CreateConVar("sm_hosties_lr_cf_enable", "1", "Enable LR Chicken Fight: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  415.     gShadow_LR_ChickenFight_On = true;
  416.     gH_Cvar_LR_HotPotato_On = CreateConVar("sm_hosties_lr_hp_enable", "1", "Enable LR Hot Potato: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  417.     gShadow_LR_HotPotato_On = true;
  418.     gH_Cvar_LR_Dodgeball_On = CreateConVar("sm_hosties_lr_db_enable", "1", "Enable LR Dodgeball: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  419.     gShadow_LR_Dodgeball_On = true;
  420.     gH_Cvar_LR_NoScope_On = CreateConVar("sm_hosties_lr_ns_enable", "1", "Enable LR No Scope Battle: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  421.     gShadow_LR_NoScope_On = true;
  422.     gH_Cvar_LR_RockPaperScissors_On = CreateConVar("sm_hosties_lr_rps_enable", "1", "Enable LR Rock Paper Scissors: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  423.     gShadow_LR_RockPaperScissors_On = true;
  424.     gH_Cvar_LR_Rebel_On = CreateConVar("sm_hosties_lr_rebel_on", "1", "Enables the LR Rebel: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  425.     gShadow_LR_Rebel_On = true;
  426.     gH_Cvar_LR_Mag4Mag_On = CreateConVar("sm_hosties_lr_mag4mag_on", "1", "Enables the LR Magazine4Magazine: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  427.     gShadow_LR_Mag4Mag_On = true;
  428.     gH_Cvar_LR_Race_On = CreateConVar("sm_hosties_lr_race_on", "1", "Enables the LR Race: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  429.     gShadow_LR_Race_On = true;
  430.     gH_Cvar_LR_RussianRoulette_On = CreateConVar("sm_hosties_lr_russianroulette_on", "1", "Enables the LR Russian Roulette: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  431.     gShadow_LR_RussianRoulette_On = true;
  432.     gH_Cvar_LR_JumpContest_On = CreateConVar("sm_hosties_lr_jumpcontest_on", "1", "Enables the LR Jumping Contest: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);  
  433.     gShadow_LR_JumpContest_On = true;
  434.  
  435.     gH_Cvar_LR_HotPotato_Mode = CreateConVar("sm_hosties_lr_hp_teleport", "2", "Teleport CT to T on hot potato contest start: 0 - disable, 1 - enable, 2 - enable and freeze", FCVAR_PLUGIN, true, 0.0, true, 2.0);
  436.     gShadow_LR_HotPotato_Mode = 2;
  437.     gH_Cvar_SendGlobalMsgs = CreateConVar("sm_hosties_lr_send_global_msgs", "0", "Specifies if non-death related LR messages are sent to everyone or just the active participants in that LR. 0: participants, 1: everyone", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  438.     gShadow_SendGlobalMsgs = 0;
  439.     gH_Cvar_MaxPrisonersToLR = CreateConVar("sm_hosties_lr_ts_max", "2", "The maximum number of terrorists left to enable LR: 0 - LR is always enabled, >0 - maximum number of Ts", FCVAR_PLUGIN, true, 0.0, true, 63.0);
  440.     gShadow_MaxPrisonersToLR = 1;
  441.     gH_Cvar_RebelAction = CreateConVar("sm_hosties_lr_rebel_action", "2", "Decides what to do with those who rebel/interfere during an LR. 1 - Abort, 2 - Slay.", FCVAR_PLUGIN, true, 1.0, true, 2.0);
  442.     gShadow_RebelAction = 2;
  443.     gH_Cvar_RebelHandling = CreateConVar("sm_hosties_lr_rebel_mode", "1", "LR-mode for rebelling terrorists: 0 - Rebelling Ts can never have a LR, 1 - Rebelling Ts must let the CT decide if a LR is OK, 2 - Rebelling Ts can have a LR just like other Ts", FCVAR_PLUGIN, true, 0.0);
  444.     gShadow_RebelHandling = 1;
  445.     gH_Cvar_RebelOnImpact = CreateConVar("sm_hosties_lr_rebel_impact", "0", "Sets terrorists to rebels for firing a bullet. 0 - Disabled, 1 - Enabled.", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  446.     gShadow_RebelOnImpact = 0;
  447.     gH_Cvar_ColorRebels = CreateConVar("sm_hosties_rebel_color", "0", "Turns on coloring rebels", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  448.     gShadow_ColorRebels = 0;
  449.     gH_Cvar_ColorRebels_Red = CreateConVar("sm_hosties_rebel_red", "255", "What color to turn a rebel into (set R, G and B values to 255 to disable) (Rgb): x - red value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  450.     gShadow_ColorRebels_Red = 255;
  451.     gH_Cvar_ColorRebels_Green = CreateConVar("sm_hosties_rebel_green", "0", "What color to turn a rebel into (rGb): x - green value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  452.     gShadow_ColorRebels_Green = 0;
  453.     gH_Cvar_ColorRebels_Blue = CreateConVar("sm_hosties_rebel_blue", "0", "What color to turn a rebel into (rgB): x - blue value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  454.     gShadow_ColorRebels_Blue = 0;
  455.     gH_Cvar_LR_Beacons = CreateConVar("sm_hosties_lr_beacon", "1", "Beacon players on LR or not: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  456.     gShadow_LR_Beacons = true;
  457.     gH_Cvar_LR_HelpBeams = CreateConVar("sm_hosties_lr_beams", "1", "Displays connecting beams between LR contestants: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  458.     gShadow_LR_HelpBeams = true;
  459.     gH_Cvar_LR_HelpBeams_Distance = CreateConVar("sm_hosties_lr_beams_distance", "0.0", "Controls how close LR partners must be before the connecting beams will disappear: 0 - always on, >0 the distance in game units", FCVAR_PLUGIN, true, 0.0);
  460.     gShadow_LR_HelpBeams_Distance = 0.0;
  461.     gH_Cvar_LR_Beacon_Interval = CreateConVar("sm_hosties_lr_beacon_interval", "1.0", "The interval in seconds of which the beacon 'beeps' on LR", FCVAR_PLUGIN, true, 0.1);
  462.     gShadow_LR_Beacon_Interval = 1.0;
  463.     gH_Cvar_LR_ChickenFight_Slay = CreateConVar("sm_hosties_lr_cf_slay", "1", "Slay the loser of a Chicken Fight instantly? 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  464.     gShadow_LR_ChickenFight_Slay = true;
  465.     gH_Cvar_LR_ChickenFight_C_Blue = CreateConVar("sm_hosties_lr_cf_loser_blue", "0", "What color to turn the loser of a chicken fight into (rgB): x - blue value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  466.     gShadow_LR_ChickenFight_C_Blue = 0;
  467.     gH_Cvar_LR_ChickenFight_C_Green = CreateConVar("sm_hosties_lr_cf_loser_green", "255", "What color to turn the loser of a chicken fight into (rGb): x - green value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  468.     gShadow_LR_ChickenFight_C_Green = 255;
  469.     gH_Cvar_LR_ChickenFight_C_Red = CreateConVar("sm_hosties_lr_cf_loser_red", "255", "What color to turn the loser of a chicken fight into (only if sm_hosties_lr_cf_slay == 0, set R, G and B values to 255 to disable) (Rgb): x - red value", FCVAR_PLUGIN, true, 0.0, true, 255.0);
  470.     gShadow_LR_ChickenFight_C_Red = 255;
  471.     gH_Cvar_LR_Dodgeball_CheatCheck = CreateConVar("sm_hosties_lr_db_cheatcheck", "1", "Enable health-checker in LR Dodgeball to prevent contestant cheating (healing themselves): 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  472.     gShadow_LR_Dodgeball_CheatCheck = true;
  473.     gH_Cvar_LR_Dodgeball_SpawnTime = CreateConVar("sm_hosties_lr_db_flash_duration", "1.4", "The amount of time after a thrown flash before a new flash is given to a contestant: float value - delay in seconds", FCVAR_PLUGIN, true, 0.7, true, 6.0);
  474.     gShadow_LR_Dodgeball_SpawnTime = 1.4;
  475.     gH_Cvar_LR_Dodgeball_Gravity = CreateConVar("sm_hosties_lr_db_gravity", "1.0", "What gravity multiplier the dodgeball contestants will get: <1.0 - less/lower, >1.0 - more/higher", FCVAR_PLUGIN, true, 0.1, true, 2.0);
  476.     gShadow_LR_Dodgeball_Gravity = 1.0;
  477.     gH_Cvar_LR_HotPotato_MaxTime = CreateConVar("sm_hosties_lr_hp_maxtime", "20.0", "Maximum time in seconds the Hot Potato contest will last for (time is randomized): float value - time", FCVAR_PLUGIN, true, 8.0, true, 120.0);
  478.     gShadow_LR_HotPotato_MaxTime = 20.0;
  479.     gH_Cvar_LR_HotPotato_MinTime = CreateConVar("sm_hosties_lr_hp_mintime", "10.0", "Minimum time in seconds the Hot Potato contest will last for (time is randomized): float value - time", FCVAR_PLUGIN, true, 0.0, true, 45.0);
  480.     gShadow_LR_HotPotato_MinTime = 10.0;
  481.     gH_Cvar_LR_HotPotato_Speed = CreateConVar("sm_hosties_lr_hp_speed_multipl", "1.5", "What speed multiplier a hot potato contestant who has the deagle is gonna get: <1.0 - slower, >1.0 - faster", FCVAR_PLUGIN, true, 0.8, true, 3.0);
  482.     gShadow_LR_HotPotato_Speed = 1.5;
  483.     gH_Cvar_LR_S4S_DoubleShot = CreateConVar("sm_hosties_lr_s4s_dblsht_action", "1", "What to do with someone who fires 2 shots in a row in Shot4Shot: 0 - nothing (ignore completely), 1 - Follow rebel punishment cvars", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  484.     gShadow_LR_S4S_DoubleShot = false;
  485.     gH_Cvar_LR_NoScope_Sound = CreateConVar("sm_hosties_noscope_sound", "sm_hosties/noscopestart1.mp3", "What sound to play when a No Scope Battle starts, relative to the sound-folder: -1 - disable, path - path to sound file", FCVAR_PLUGIN);
  486.     Format(gShadow_LR_NoScope_Sound, sizeof(gShadow_LR_NoScope_Sound ), "sm_hosties/noscopestart1.mp3");
  487.     gH_Cvar_LR_Sound = CreateConVar("sm_hosties_lr_sound", "sm_hosties/lr1.mp3", "What sound to play when LR gets available, relative to the sound-folder (also requires sm_hosties_announce_lr to be 1): -1 - disable, path - path to sound file", FCVAR_PLUGIN);
  488.     Format(gShadow_LR_Sound, sizeof(gShadow_LR_Sound), "sm_hosties/lr1.mp3");
  489.     gH_Cvar_LR_Beacon_Sound = CreateConVar("sm_hosties_beacon_sound", "buttons/blip1.wav", "What sound to play each second a beacon is 'ping'ed.", FCVAR_PLUGIN);
  490.     Format(gShadow_LR_Beacon_Sound, sizeof(gShadow_LR_Beacon_Sound), "buttons/blip1.wav");
  491.     gH_Cvar_LR_NoScope_Weapon = CreateConVar("sm_hosties_lr_ns_weapon", "2", "Weapon to use in a No Scope Battle: 0 - AWP, 1 - scout, 2 - let the terrorist choose, 3 - SG550, 4 - G3SG1", FCVAR_PLUGIN, true, 0.0, true, 2.0);
  492.     gShadow_LR_NoScope_Weapon = 2;
  493.     gH_Cvar_LR_NonContKiller_Action = CreateConVar("sm_hosties_lr_p_killed_action", "1", "What to do when a LR-player gets killed by a player not in LR during LR: 0 - just abort LR, 1 - abort LR and slay the attacker", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  494.     gShadow_LR_NonContKiller_Action = true;
  495.     gH_Cvar_LR_GunToss_MarkerMode = CreateConVar("sm_hosties_lr_gt_markers", "0", "Deagle marking (requires sm_hosties_lr_gt_mode 1): 0 - markers straight up where the deagles land, 1 - markers starting where the deagle was dropped ending at the deagle landing point", FCVAR_PLUGIN);
  496.     gShadow_LR_GunToss_MarkerMode = 0;
  497.     gH_Cvar_LR_GunToss_StartMode = CreateConVar("sm_hosties_lr_gt_mode", "1", "How Gun Toss will be played: 0 - no double-dropping checking, deagle gets 7 ammo at start, 1 - double dropping check, deagle gets 7 ammo on drop, colouring of deagles, deagle markers", FCVAR_PLUGIN);
  498.     gShadow_LR_GunToss_StartMode = 1;
  499.     gH_Cvar_LR_GunToss_ShowMeter = CreateConVar("sm_hosties_lr_gt_meter", "1", "Displays a distance meter: 0 - do not display, 1 - display", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  500.     gShadow_LR_GunToss_ShowMeter = 1;
  501.     gH_Cvar_LR_Delay_Enable_Time = CreateConVar("sm_hosties_lr_enable_delay", "0.0", "Delay in seconds before a last request can be started: 0.0 - instantly, >0.0 - (float value) delay in seconds", FCVAR_PLUGIN, true, 0.0);
  502.     gShadow_LR_Delay_Enable_Time = 0.0;
  503.     gH_Cvar_LR_Damage = CreateConVar("sm_hosties_lr_damage", "0", "Enables that players can not attack players in LR and players in LR can not attack players outside LR: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  504.     gShadow_LR_Damage = false;  
  505.     gH_Cvar_LR_NoScope_Delay = CreateConVar("sm_hosties_lr_ns_delay", "3", "Delay in seconds before a No Scope Battle begins (to prepare the contestants...)", FCVAR_PLUGIN, true, 0.0);
  506.     gShadow_LR_NoScope_Delay = 3;
  507.     gH_Cvar_LR_ChickenFight_Rebel = CreateConVar("sm_hosties_lr_cf_cheat_action", "1", "What to do with a chicken fighter who attacks the other player with another weapon than knife: 0 - abort LR, 1 - slay player", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  508.     gShadow_LR_ChickenFight_Rebel = 1;
  509.     gH_Cvar_LR_HotPotato_Rebel = CreateConVar("sm_hosties_lr_hp_cheat_action", "1", "What to do with a hot potato contestant who attacks the other player: 0 - abort LR, 1 - slay player", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  510.     gShadow_LR_HotPotato_Rebel = 1;
  511.     gH_Cvar_LR_KnifeFight_Rebel = CreateConVar("sm_hosties_lr_kf_cheat_action", "1", "What to do with a knife fighter who attacks the other player with another weapon than knife: 0 - abort LR, 1 - slay player", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  512.     gShadow_LR_KnifeFight_Rebel = 1;
  513.     gH_Cvar_LR_Race_AirPoints = CreateConVar("sm_hosties_lr_race_airpoints", "0", "Allow prisoners to set race points in the air.", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  514.     gShadow_LR_Race_AirPoints = false;
  515.     gH_Cvar_LR_Race_NotifyCTs = CreateConVar("sm_hosties_lr_race_tell_cts", "1", "Tells all CTs when a T has selected the race option from the LR menu", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  516.     gShadow_LR_Race_NotifyCTs = false;
  517.     gH_Cvar_LR_Rebel_MaxTs = CreateConVar("sm_hosties_lr_rebel_ts", "1", "If the Rebel LR option is enabled, specifies the maximum number of alive terrorists needed for the option to appear in the LR menu.", FCVAR_PLUGIN, true, 1.0);
  518.     gShadow_LR_Rebel_MaxTs = 1;
  519.     gH_Cvar_LR_Rebel_MinCTs = CreateConVar("sm_hosties_lr_rebel_cts", "1", "If the Rebel LR option is enabled, specifies how minimum number of alive counter-terrorists needed for the option to appear in the LR menu.", FCVAR_PLUGIN, true, 1.0);
  520.     gShadow_LR_Rebel_MinCTs = 1;
  521.     gH_Cvar_LR_M4M_MagCapacity = CreateConVar("sm_hosties_lr_m4m_capacity", "7", "The number of bullets in each magazine given to Mag4Mag LR contestants", FCVAR_PLUGIN, true, 2.0);
  522.     gShadow_LR_M4M_MagCapacity = 7;
  523.     gH_Cvar_LR_KnifeFight_LowGrav = CreateConVar("sm_hosties_lr_kf_gravity", "1.0", "The multiplier used for the low-gravity knife fight.", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  524.     gShadow_LR_KnifeFight_LowGrav = 1.0;
  525.     gH_Cvar_LR_KnifeFight_HiSpeed = CreateConVar("sm_hosties_lr_kf_speed", "2.2", "The multiplier used for the high-speed knife fight.", FCVAR_PLUGIN, true, 1.1);
  526.     gShadow_LR_KnifeFight_HiSpeed = 2.2;
  527.     gH_Cvar_LR_KnifeFight_Drunk = CreateConVar("sm_hosties_lr_kf_drunk", "4", "The multiplier used for how drunk the player will be during the drunken boxing knife fight.", FCVAR_PLUGIN, true, 0.0);
  528.     gShadow_LR_KnifeFight_Drunk = 4;
  529.     gH_Cvar_Announce_CT_FreeHit = CreateConVar("sm_hosties_announce_attack", "1", "Enable or disable announcements when a CT attacks a non-rebelling T: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  530.     gShadow_Announce_CT_FreeHit = true;
  531.     gH_Cvar_Announce_LR = CreateConVar("sm_hosties_announce_lr", "1", "Enable or disable chat announcements when Last Requests starts to be available: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  532.     gShadow_Announce_LR = true;
  533.     gH_Cvar_Announce_Rebel = CreateConVar("sm_hosties_announce_rebel", "0", "Enable or disable chat announcements when a terrorist becomes a rebel: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  534.     gShadow_Announce_Rebel = false;
  535.     gH_Cvar_Announce_RebelDown = CreateConVar("sm_hosties_announce_rebel_down", "0", "Enable or disable chat announcements when a rebel is killed: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  536.     gShadow_Announce_RebelDown = false;
  537.     gH_Cvar_Announce_Weapon_Attack = CreateConVar("sm_hosties_announce_wpn_attack", "0", "Enable or disable an announcement telling that a non-rebelling T has a weapon when he gets attacked by a CT (also requires sm_hosties_announce_attack 1): 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  538.     gShadow_Announce_Weapon_Attack = false;
  539.     gH_Cvar_Announce_Shot4Shot = CreateConVar("sm_hosties_lr_s4s_shot_taken", "1", "Enable announcements in Shot4Shot or Mag4Mag when a contestant empties their gun: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  540.     gShadow_Announce_Shot4Shot = false;
  541.     gH_Cvar_Announce_Delay_Enable = CreateConVar("sm_hosties_announce_lr_delay", "1", "Enable or disable chat announcements to tell that last request delaying is activated and how long the delay is: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  542.     gShadow_Announce_Delay_Enable = false;
  543.     gH_Cvar_Announce_HotPotato_Eqp = CreateConVar("sm_hosties_lr_hp_pickupannounce", "0", "Enable announcement when a Hot Potato contestant picks up the hot potato: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  544.     gShadow_Announce_HotPotato_Eqp = false;
  545.     gH_Cvar_LR_AutoDisplay = CreateConVar("sm_hosties_lr_autodisplay", "0", "Automatically display the LR menu to non-rebelers when they become elgible for LR: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  546.     gShadow_LR_AutoDisplay = false;
  547.     gH_Cvar_LR_BlockSuicide = CreateConVar("sm_hosties_lr_blocksuicide", "0", "Blocks LR participants from commiting suicide to avoid deaths: 0 - disable, 1 - enable", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  548.     gShadow_LR_BlockSuicide = false;
  549.     gH_Cvar_LR_VictorPoints = CreateConVar("sm_hosties_lr_victorpoints", "1", "Amount of frags to reward victor in an LR where other player automatically dies", FCVAR_PLUGIN, true, 0.0);
  550.     gShadow_LR_VictorPoints = 1;
  551.    
  552.     // Listen for changes
  553.     HookConVarChange(gH_Cvar_LR_KnifeFight_On, ConVarChanged_LastRequest);
  554.     HookConVarChange(gH_Cvar_LR_Shot4Shot_On, ConVarChanged_LastRequest);
  555.     HookConVarChange(gH_Cvar_LR_GunToss_On, ConVarChanged_LastRequest);
  556.     HookConVarChange(gH_Cvar_LR_ChickenFight_On, ConVarChanged_LastRequest);
  557.     HookConVarChange(gH_Cvar_LR_HotPotato_On, ConVarChanged_LastRequest);
  558.     HookConVarChange(gH_Cvar_LR_Dodgeball_On, ConVarChanged_LastRequest);
  559.     HookConVarChange(gH_Cvar_LR_NoScope_On, ConVarChanged_LastRequest);
  560.     HookConVarChange(gH_Cvar_LR_RockPaperScissors_On, ConVarChanged_LastRequest);
  561.     HookConVarChange(gH_Cvar_LR_Rebel_On, ConVarChanged_LastRequest);
  562.     HookConVarChange(gH_Cvar_LR_Mag4Mag_On, ConVarChanged_LastRequest);
  563.     HookConVarChange(gH_Cvar_LR_Race_On, ConVarChanged_LastRequest);
  564.     HookConVarChange(gH_Cvar_LR_RussianRoulette_On, ConVarChanged_LastRequest);
  565.     HookConVarChange(gH_Cvar_LR_JumpContest_On, ConVarChanged_LastRequest);
  566.    
  567.     HookConVarChange(gH_Cvar_LR_Enable, ConVarChanged_Setting);
  568.     HookConVarChange(gH_Cvar_LR_MenuTime, ConVarChanged_Setting);
  569.     HookConVarChange(gH_Cvar_LR_KillTimeouts, ConVarChanged_Setting);
  570.     HookConVarChange(gH_Cvar_LR_HotPotato_Mode, ConVarChanged_Setting);
  571.     HookConVarChange(gH_Cvar_SendGlobalMsgs, ConVarChanged_Setting);
  572.     HookConVarChange(gH_Cvar_MaxPrisonersToLR, ConVarChanged_Setting);
  573.     HookConVarChange(gH_Cvar_RebelAction, ConVarChanged_Setting);
  574.     HookConVarChange(gH_Cvar_RebelHandling, ConVarChanged_Setting);
  575.     HookConVarChange(gH_Cvar_ColorRebels, ConVarChanged_Setting);
  576.     HookConVarChange(gH_Cvar_LR_Beacons, ConVarChanged_Setting);
  577.     HookConVarChange(gH_Cvar_LR_HelpBeams, ConVarChanged_Setting);
  578.     HookConVarChange(gH_Cvar_LR_HelpBeams_Distance, ConVarChanged_Setting);
  579.     HookConVarChange(gH_Cvar_LR_Beacon_Interval, ConVarChanged_Setting);
  580.     HookConVarChange(gH_Cvar_RebelOnImpact, ConVarChanged_Setting);
  581.     HookConVarChange(gH_Cvar_ColorRebels_Blue, ConVarChanged_Setting)
  582.     HookConVarChange(gH_Cvar_ColorRebels_Green, ConVarChanged_Setting);
  583.     HookConVarChange(gH_Cvar_ColorRebels_Red, ConVarChanged_Setting);
  584.     HookConVarChange(gH_Cvar_LR_ChickenFight_C_Blue, ConVarChanged_Setting);
  585.     HookConVarChange(gH_Cvar_LR_ChickenFight_C_Green, ConVarChanged_Setting);
  586.     HookConVarChange(gH_Cvar_LR_ChickenFight_C_Red, ConVarChanged_Setting);
  587.     HookConVarChange(gH_Cvar_LR_ChickenFight_Slay, ConVarChanged_Setting);
  588.     HookConVarChange(gH_Cvar_LR_Dodgeball_CheatCheck, ConVarChanged_Setting);
  589.     HookConVarChange(gH_Cvar_LR_Dodgeball_Gravity, ConVarChanged_Setting);
  590.     HookConVarChange(gH_Cvar_LR_Dodgeball_SpawnTime, ConVarChanged_Setting);
  591.     HookConVarChange(gH_Cvar_LR_HotPotato_MaxTime, ConVarChanged_Setting);
  592.     HookConVarChange(gH_Cvar_LR_HotPotato_MinTime, ConVarChanged_Setting);
  593.     HookConVarChange(gH_Cvar_LR_HotPotato_Speed, ConVarChanged_Setting);
  594.     HookConVarChange(gH_Cvar_LR_NoScope_Sound, ConVarChanged_Setting);
  595.     HookConVarChange(gH_Cvar_LR_Sound, ConVarChanged_Setting);
  596.     HookConVarChange(gH_Cvar_LR_Beacon_Sound, ConVarChanged_Setting);
  597.     HookConVarChange(gH_Cvar_LR_NoScope_Weapon, ConVarChanged_Setting);
  598.     HookConVarChange(gH_Cvar_LR_NonContKiller_Action, ConVarChanged_Setting);
  599.     HookConVarChange(gH_Cvar_LR_S4S_DoubleShot, ConVarChanged_Setting);
  600.     HookConVarChange(gH_Cvar_LR_GunToss_MarkerMode, ConVarChanged_Setting);
  601.     HookConVarChange(gH_Cvar_LR_GunToss_StartMode, ConVarChanged_Setting);
  602.     HookConVarChange(gH_Cvar_LR_GunToss_ShowMeter, ConVarChanged_Setting);
  603.     HookConVarChange(gH_Cvar_LR_Delay_Enable_Time, ConVarChanged_Setting);
  604.     HookConVarChange(gH_Cvar_LR_Damage, ConVarChanged_Setting);
  605.     HookConVarChange(gH_Cvar_LR_NoScope_Delay, ConVarChanged_Setting);
  606.     HookConVarChange(gH_Cvar_LR_KnifeFight_Rebel, ConVarChanged_Setting);
  607.     HookConVarChange(gH_Cvar_LR_ChickenFight_Rebel, ConVarChanged_Setting);
  608.     HookConVarChange(gH_Cvar_LR_HotPotato_Rebel, ConVarChanged_Setting);
  609.     HookConVarChange(gH_Cvar_LR_Race_AirPoints, ConVarChanged_Setting);
  610.     HookConVarChange(gH_Cvar_LR_Race_NotifyCTs, ConVarChanged_Setting);
  611.     HookConVarChange(gH_Cvar_LR_Rebel_MinCTs, ConVarChanged_Setting);
  612.     HookConVarChange(gH_Cvar_LR_Rebel_MaxTs, ConVarChanged_Setting);
  613.     HookConVarChange(gH_Cvar_LR_M4M_MagCapacity, ConVarChanged_Setting);
  614.     HookConVarChange(gH_Cvar_LR_KnifeFight_LowGrav, ConVarChanged_Setting);
  615.     HookConVarChange(gH_Cvar_LR_KnifeFight_HiSpeed, ConVarChanged_Setting);
  616.     HookConVarChange(gH_Cvar_LR_KnifeFight_Drunk, ConVarChanged_Setting);
  617.     HookConVarChange(gH_Cvar_Announce_CT_FreeHit, ConVarChanged_Setting);
  618.     HookConVarChange(gH_Cvar_Announce_LR, ConVarChanged_Setting);
  619.     HookConVarChange(gH_Cvar_Announce_Rebel, ConVarChanged_Setting);
  620.     HookConVarChange(gH_Cvar_Announce_RebelDown, ConVarChanged_Setting);
  621.     HookConVarChange(gH_Cvar_Announce_Weapon_Attack, ConVarChanged_Setting);
  622.     HookConVarChange(gH_Cvar_Announce_Shot4Shot, ConVarChanged_Setting);
  623.     HookConVarChange(gH_Cvar_Announce_Delay_Enable, ConVarChanged_Setting);
  624.     HookConVarChange(gH_Cvar_Announce_HotPotato_Eqp, ConVarChanged_Setting);
  625.     HookConVarChange(gH_Cvar_LR_AutoDisplay, ConVarChanged_Setting);
  626.     HookConVarChange(gH_Cvar_LR_BlockSuicide, ConVarChanged_Setting);
  627.     HookConVarChange(gH_Cvar_LR_VictorPoints, ConVarChanged_Setting);
  628.    
  629.     // Account for late loading
  630.     for (new idx = 1; idx <= MaxClients ; idx++)
  631.     {
  632.         if (IsClientInGame(idx))
  633.         {
  634.             SDKHook(idx, SDKHook_WeaponDrop, OnWeaponDrop);
  635.             SDKHook(idx, SDKHook_WeaponEquip, OnWeaponEquip);
  636.             SDKHook(idx, SDKHook_WeaponCanUse, OnWeaponDecideUse);
  637.             SDKHook(idx, SDKHook_OnTakeDamage, OnTakeDamage);
  638.         }
  639.         g_bIsARebel[idx] = false;
  640.         g_bInLastRequest[idx] = false;
  641.         gH_BuildLR[idx] = INVALID_HANDLE;
  642.     }
  643. }
  644.  
  645. LastRequest_Menus(Handle:h_TopMenu, TopMenuObject:obj_Hosties)
  646. {
  647.     AddToTopMenu(h_TopMenu, "sm_stoplr", TopMenuObject_Item, AdminMenu_StopLR, obj_Hosties, "sm_stoplr", ADMFLAG_SLAY);
  648. }
  649.  
  650. public AdminMenu_StopLR(Handle:h_TopMenu, TopMenuAction:action, TopMenuObject:object, client, String:buffer[], maxlength)
  651. {
  652.     if (action == TopMenuAction_DisplayOption)
  653.     {
  654.         Format(buffer, maxlength, "Stop All LastRequests");
  655.     }
  656.     else if (action == TopMenuAction_SelectOption)
  657.     {
  658.         StopActiveLRs(client);
  659.     }
  660. }
  661.  
  662. LastRequest_APL()
  663. {
  664.     CreateNative("AddLastRequestToList", Native_LR_AddToList);
  665.     CreateNative("RemoveLastRequestFromList", Native_LR_RemoveFromList);
  666.     CreateNative("IsClientRebel", Native_IsClientRebel);
  667.     CreateNative("IsClientInLastRequest", Native_IsClientInLR);
  668.     CreateNative("ProcessAllLastRequests", Native_ProcessLRs);
  669.     CreateNative("ChangeRebelStatus", Native_ChangeRebelStatus);
  670.     CreateNative("InitializeLR", Native_LR_Initialize);
  671.    
  672.     RegPluginLibrary("lastrequest");
  673. }
  674.  
  675. public Native_ProcessLRs(Handle:h_Plugin, iNumParameters)
  676. {
  677.     new Function:LoopCallback = GetNativeCell(1);
  678.     AddToForward(gH_Frwd_LR_Process, h_Plugin, LoopCallback);
  679.     new LastRequest:thisType = GetNativeCell(2);
  680.        
  681.     new theLRArraySize = GetArraySize(gH_DArray_LR_Partners);
  682.     for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  683.     {
  684.         new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  685.         if (type == thisType)
  686.         {
  687.             Call_StartForward(gH_Frwd_LR_Process);
  688.             Call_PushCell(gH_DArray_LR_Partners);
  689.             Call_PushCell(idx);
  690.             Call_Finish();
  691.         }
  692.     }
  693.    
  694.     RemoveFromForward(gH_Frwd_LR_Process, h_Plugin, LoopCallback);
  695.     return theLRArraySize;
  696. }
  697.  
  698. public Native_LR_AddToList(Handle:h_Plugin, iNumParameters)
  699. {
  700.     new Function:StartCall = GetNativeCell(1);
  701.     new Function:CleanUpCall = GetNativeCell(2);
  702.     AddToForward(gH_Frwd_LR_Start, h_Plugin, StartCall);
  703.     AddToForward(gH_Frwd_LR_CleanUp, h_Plugin, CleanUpCall);
  704.     decl String:sLR_Name[MAX_DISPLAYNAME_SIZE];
  705.     GetNativeString(3, sLR_Name, MAX_DISPLAYNAME_SIZE);
  706.     new bool:AutoStart;
  707.     if (iNumParameters > 3)
  708.     {
  709.         AutoStart = GetNativeCell(4);
  710.     }
  711.     else
  712.     {
  713.         AutoStart = true;
  714.     }
  715.     new iPosition = PushArrayString(gH_DArray_LR_CustomNames, sLR_Name);
  716.     // take the maximum number of LRs + the custom LR index to get new value to push
  717.     iPosition += _:LastRequest;
  718.     new iIndex = PushArrayCell(gH_DArray_LastRequests, iPosition);
  719.     SetArrayCell(gH_DArray_LastRequests, iIndex, AutoStart, 1);
  720.     return iPosition;
  721. }
  722.  
  723. public Native_LR_RemoveFromList(Handle:h_Plugin, iNumParameters)
  724. {
  725.     new Function:StartCall = GetNativeCell(1);
  726.     new Function:CleanUpCall = GetNativeCell(2);
  727.     RemoveFromForward(gH_Frwd_LR_Start, h_Plugin, StartCall);
  728.     RemoveFromForward(gH_Frwd_LR_CleanUp, h_Plugin, CleanUpCall);
  729.     decl String:sLR_Name[MAX_DISPLAYNAME_SIZE];
  730.     GetNativeString(3, sLR_Name, MAX_DISPLAYNAME_SIZE);
  731.     new iPosition = FindStringInArray(gH_DArray_LR_CustomNames, sLR_Name);
  732.     if (iPosition == -1)
  733.     {
  734.         return ThrowNativeError(SP_ERROR_NATIVE, "LR Name (%s) Not Found", sLR_Name);
  735.     }
  736.     else
  737.     {
  738.         RemoveFromArray(gH_DArray_LR_CustomNames, iPosition);
  739.         iPosition += _:LastRequest;
  740.         RemoveFromArray(gH_DArray_LastRequests, iPosition);
  741.     }
  742.     return 1;
  743. }
  744.  
  745. public Native_LR_Initialize(Handle:h_Plugin, iNumParameters)
  746. {
  747.     if(iNumParameters == 1)
  748.     {
  749.         new LR_Player_Prisoner = 0;
  750.         if(GetClientTeam(GetNativeCell(1)) == 2)
  751.         {
  752.             LR_Player_Prisoner = GetNativeCell(1);
  753.         }
  754.         if(LR_Player_Prisoner != 0)
  755.         {
  756.             if(!IsLastRequestAutoStart(g_selection[LR_Player_Prisoner]))
  757.             {
  758.                 new iArrayIndex = PushArrayCell(gH_DArray_LR_Partners, g_selection[LR_Player_Prisoner]);
  759.                 SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, LR_Player_Prisoner, _:Block_Prisoner);
  760.                 SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, g_LR_Player_Guard[LR_Player_Prisoner], _:Block_Guard);
  761.  
  762.                 g_bInLastRequest[LR_Player_Prisoner] = true;
  763.                 g_bInLastRequest[g_LR_Player_Guard[LR_Player_Prisoner]] = true;
  764.  
  765.                 // Fire global
  766.                 Call_StartForward(gH_Frwd_LR_StartGlobal);
  767.                 Call_PushCell(LR_Player_Prisoner);
  768.                 Call_PushCell(g_LR_Player_Guard[LR_Player_Prisoner]);
  769.                 // LR type
  770.                 Call_PushCell(g_selection[LR_Player_Prisoner]);
  771.                 new ignore;
  772.                 Call_Finish(_:ignore);
  773.                
  774.                 // Close datapack
  775.                 if (gH_BuildLR[LR_Player_Prisoner] != INVALID_HANDLE)
  776.                 {
  777.                     CloseHandle(gH_BuildLR[LR_Player_Prisoner]);       
  778.                 }
  779.                 gH_BuildLR[LR_Player_Prisoner] = INVALID_HANDLE;
  780.                
  781.                 // Beacon players
  782.                 if (gShadow_LR_Beacons)
  783.                 {
  784.                     AddBeacon(LR_Player_Prisoner);
  785.                     AddBeacon(g_LR_Player_Guard[LR_Player_Prisoner]);
  786.                 }
  787.             }
  788.         }
  789.         else
  790.         {
  791.             ThrowNativeError(SP_ERROR_NATIVE, "InitializeLR Failure (Invalid client index).");
  792.         }
  793.     }
  794.     else
  795.     {
  796.         ThrowNativeError(SP_ERROR_NATIVE, "InitializeLR Failure (Wrong number of parameters).");
  797.     }
  798. }
  799.  
  800. public Native_IsClientRebel(Handle:h_Plugin, iNumParameters)
  801. {
  802.     new client = GetNativeCell(1);
  803.     if (client > MaxClients || client < 0)
  804.     {
  805.         return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index (%d)", client);
  806.     }
  807.     return bool:g_bIsARebel[client];
  808. }
  809.  
  810. public Native_ChangeRebelStatus(Handle:h_Plugin, iNumParameters)
  811. {
  812.     new client = GetNativeCell(1);
  813.     if (client > MaxClients || client < 0)
  814.     {
  815.         return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index (%d)", client);
  816.     }
  817.     new status = GetNativeCell(2);
  818.     if (status < 0 || status > 1)
  819.     {
  820.         return ThrowNativeError(SP_ERROR_NATIVE, "Invalid rebel status (%d)", status);
  821.     }
  822.     g_bIsARebel[client] = bool:status;
  823.     return 1;
  824. }
  825.  
  826. public Native_IsClientInLR(Handle:h_Plugin, iNumParameters)
  827. {
  828.     new client = GetNativeCell(1);
  829.     if (!IsClientInGame(client))
  830.     {
  831.         return ThrowNativeError(SP_ERROR_NATIVE, "Given client index (%d) not in game", client);
  832.     }
  833.     return Local_IsClientInLR(client);
  834. }
  835.  
  836. Local_IsClientInLR(client)
  837. {
  838.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  839.     for (new idx = 0; idx < iArraySize; idx++)
  840.     {
  841.         new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  842.         new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  843.         if ((LR_Player_Prisoner == client) || (LR_Player_Guard == client))
  844.         {
  845.             // check if a partner exists
  846.             if ((LR_Player_Prisoner == 0) || (LR_Player_Guard == 0))
  847.             {
  848.                 return -1;
  849.             }
  850.             else
  851.             {
  852.                 return (LR_Player_Prisoner == client ? LR_Player_Guard : LR_Player_Prisoner);
  853.             }
  854.         }
  855.     }
  856.     return 0;
  857. }
  858.  
  859. public LastRequest_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
  860. {
  861.     g_bAnnouncedThisRound = false;
  862.    
  863.     // Set variable to know that the round has started
  864.     g_bRoundInProgress = true;
  865.    
  866.     // roundstart done, enable LR if there should be no LR delay (credits to Caza for this :p)
  867.     if (gShadow_LR_Delay_Enable_Time > 0.0)
  868.     {
  869.         g_bIsLRAvailable = false;  
  870.         g_DelayLREnableTimer = CreateTimer(gShadow_LR_Delay_Enable_Time, Timer_EnableLR, _, TIMER_FLAG_NO_MAPCHANGE);
  871.  
  872.         if (gShadow_Announce_Delay_Enable)
  873.         {
  874.             PrintToChatAll(CHAT_BANNER, "LR Delay Announcement", RoundToNearest(gShadow_LR_Delay_Enable_Time));
  875.         }
  876.     }
  877.     else
  878.     {
  879.         g_bIsLRAvailable = true;
  880.     }
  881.    
  882.     for (new idx = 1; idx <= MaxClients; idx++)
  883.     {
  884.         g_bIsARebel[idx] = false;
  885.         g_bInLastRequest[idx] = false;
  886.     }
  887. }
  888.  
  889. public Action:Timer_EnableLR(Handle:timer)
  890. {
  891.     g_bIsLRAvailable = true;
  892.     g_DelayLREnableTimer = INVALID_HANDLE;
  893.     return Plugin_Stop;
  894. }
  895.  
  896. public Action:Command_CancelLR(client, args)
  897. {
  898.     StopActiveLRs(client);
  899.     return Plugin_Handled;
  900. }
  901.  
  902. StopActiveLRs(client)
  903. {
  904.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  905.     while (iArraySize > 0)
  906.     {
  907.         CleanupLastRequest(client, iArraySize-1);
  908.         RemoveFromArray(gH_DArray_LR_Partners, iArraySize-1);
  909.         iArraySize--;
  910.     }
  911.     ShowActivity(client, "%t", "LR Aborted");
  912. }
  913.  
  914. public LastRequest_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
  915. {
  916.     // Block LRs and reset
  917.     g_bIsLRAvailable = false;
  918.    
  919.     // Set variable to know that the round has ended
  920.     g_bRoundInProgress = false;
  921.    
  922.     // Remove all the LR data
  923.     ClearArray(gH_DArray_LR_Partners);
  924.     ClearArray(gH_DArray_Beacons);
  925.    
  926.     // Stop timers for short rounds
  927.     if (g_DelayLREnableTimer != INVALID_HANDLE)
  928.     {
  929.         CloseHandle(g_DelayLREnableTimer);
  930.         g_DelayLREnableTimer = INVALID_HANDLE;
  931.     }
  932.    
  933.     // Cancel menus of all alive prisoners 
  934.     ClosePotentialLRMenus();
  935. }
  936.  
  937. public LastRequest_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
  938. {
  939.     new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  940.     new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  941.  
  942.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  943.     if (iArraySize > 0)
  944.     {
  945.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  946.         {  
  947.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  948.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  949.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  950.            
  951.             if (victim == LR_Player_Prisoner || victim == LR_Player_Guard)
  952.             {                  
  953.                 if (attacker != LR_Player_Prisoner && attacker != LR_Player_Guard \
  954.                     && attacker && (type != LR_Rebel))
  955.                 {
  956.                     if (!gShadow_LR_NonContKiller_Action)
  957.                     {
  958.                         PrintToChatAll(CHAT_BANNER, "Non LR Kill LR Abort", attacker, victim);
  959.                     }
  960.                     else
  961.                     {
  962.                         // follow rebel action
  963.                         DecideRebelsFate(attacker, idx);
  964.                         return;
  965.                     }
  966.                 }
  967.            
  968.                 CleanupLastRequest(victim, idx);            
  969.                 RemoveFromArray(gH_DArray_LR_Partners, idx);            
  970.             }
  971.         }
  972.     }
  973.  
  974.     new Ts, CTs, NumCTsAvailable;
  975.     UpdatePlayerCounts(Ts, CTs, NumCTsAvailable);
  976.    
  977.     if ((Ts > 0) && gShadow_Announce_RebelDown && g_bIsARebel[victim] && attacker && (attacker != victim))
  978.     {
  979.         if (gShadow_SendGlobalMsgs)
  980.         {
  981.             PrintToChatAll(CHAT_BANNER, "Rebel Kill", attacker, victim);
  982.         }
  983.         else
  984.         {
  985.             PrintToChat(attacker, CHAT_BANNER, "Rebel Kill", attacker, victim);
  986.             PrintToChat(victim, CHAT_BANNER, "Rebel Kill", attacker, victim);
  987.         }
  988.     }
  989.    
  990.     if (gShadow_LR_AutoDisplay && gShadow_LR_Enable && (Ts > 0) && (NumCTsAvailable > 0) && (Ts <= gShadow_MaxPrisonersToLR))
  991.     {
  992.         for (new idx = 1; idx <= MaxClients; idx++)
  993.         {
  994.             if (IsClientInGame(idx) && IsPlayerAlive(idx) && GetClientTeam(idx) == CS_TEAM_T && !g_bIsARebel[idx])
  995.             {
  996.                 FakeClientCommand(idx, "sm_lastrequest");
  997.             }
  998.         }
  999.     }
  1000.    
  1001.     if (!g_bAnnouncedThisRound && gShadow_LR_Enable)
  1002.     {
  1003.         if ((Ts == gShadow_MaxPrisonersToLR) && (NumCTsAvailable > 0) && (Ts > 0))
  1004.         {
  1005.             Call_StartForward(gH_Frwd_LR_Available);
  1006.             // announced = yes
  1007.             Call_PushCell(gShadow_Announce_LR);
  1008.             new ignore;
  1009.             Call_Finish(_:ignore);
  1010.        
  1011.             if (gShadow_Announce_LR)
  1012.             {
  1013.                 PrintToChatAll(CHAT_BANNER, "LR Available");
  1014.                
  1015.                 if ((strlen(gShadow_LR_Sound) > 0) && !StrEqual(gShadow_LR_Sound, "-1"))
  1016.                 {
  1017.                     EmitSoundToAll(gShadow_LR_Sound);
  1018.                 }
  1019.             }
  1020.            
  1021.             g_bAnnouncedThisRound = true;
  1022.         }
  1023.     }
  1024. }
  1025.  
  1026. public LastRequest_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
  1027. {
  1028.     new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  1029.     new target = GetClientOfUserId(GetEventInt(event, "userid"));
  1030.    
  1031.     if (Local_IsClientInLR(attacker) || Local_IsClientInLR(target))
  1032.     {
  1033.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1034.         {
  1035.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1036.            
  1037.             if ((type == LR_Rebel) || !attacker || (attacker == target))
  1038.             {
  1039.                 continue;
  1040.             }
  1041.            
  1042.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1043.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1044.            
  1045.             // someone outside the group interfered inside this LR
  1046.             if ((target == LR_Player_Prisoner || target == LR_Player_Guard) && \
  1047.             attacker != LR_Player_Prisoner && attacker != LR_Player_Guard)
  1048.             {
  1049.                 // take action for rebelers
  1050.                 if (!g_bIsARebel[attacker] && (GetClientTeam(attacker) == CS_TEAM_T))
  1051.                 {
  1052.                     g_bIsARebel[attacker] = true;
  1053.                     if (gShadow_Announce_Rebel && IsClientInGame(attacker))
  1054.                     {
  1055.                         if (gShadow_SendGlobalMsgs)
  1056.                         {
  1057.                             PrintToChatAll(CHAT_BANNER, "New Rebel", attacker);
  1058.                         }
  1059.                         else
  1060.                         {
  1061.                             PrintToChat(attacker, CHAT_BANNER, "New Rebel", attacker);
  1062.                             PrintToChat(target, CHAT_BANNER, "New Rebel", attacker);
  1063.                         }
  1064.                     }
  1065.                 }
  1066.             }
  1067.             // someone inside this LR interfered with someone else
  1068.             else if (target != LR_Player_Prisoner && target != LR_Player_Guard && \
  1069.                 (attacker == LR_Player_Prisoner || attacker == LR_Player_Guard))
  1070.             {
  1071.                 DecideRebelsFate(attacker, idx, target);
  1072.             }
  1073.            
  1074.             // if the current LR partner is being attacked
  1075.             if ((attacker == LR_Player_Prisoner || attacker == LR_Player_Guard) && \
  1076.             (target == LR_Player_Prisoner || target == LR_Player_Guard))
  1077.             {
  1078.                 decl String:weapon[32];
  1079.                 GetEventString(event, "weapon", weapon, 32);
  1080.                 new bool:bIsItAKnife = StrEqual(weapon, "knife");
  1081.                
  1082.                 switch (type)
  1083.                 {
  1084.                     case LR_KnifeFight, LR_ChickenFight:
  1085.                     {
  1086.                         if (!bIsItAKnife)
  1087.                         {                          
  1088.                             DecideRebelsFate(attacker, idx, target);
  1089.                         }
  1090.                     }
  1091.                     case LR_NoScope:
  1092.                     {
  1093.                         if (bIsItAKnife)
  1094.                         {
  1095.                             DecideRebelsFate(attacker, idx, target);
  1096.                         }
  1097.                     }
  1098.                     case LR_HotPotato:
  1099.                     {
  1100.                         DecideRebelsFate(attacker, idx, target);
  1101.                     }
  1102.                 }      
  1103.             }
  1104.         }
  1105.     }
  1106.     // if a T attacks a CT and there's no last requests active
  1107.     else if (attacker && target && (GetClientTeam(attacker) == CS_TEAM_T) && (GetClientTeam(target) == CS_TEAM_CT) \
  1108.         && !g_bIsARebel[attacker] && g_bRoundInProgress)
  1109.     {
  1110.         g_bIsARebel[attacker] = true;
  1111.         if (IsClientInGame(attacker))
  1112.         {
  1113.             if (gShadow_Announce_Rebel)
  1114.             {
  1115.                 if (gShadow_SendGlobalMsgs)
  1116.                 {
  1117.                     PrintToChatAll(CHAT_BANNER, "New Rebel", attacker);
  1118.                 }
  1119.                 else
  1120.                 {
  1121.                     PrintToChat(attacker, CHAT_BANNER, "New Rebel", attacker);
  1122.                     PrintToChat(target, CHAT_BANNER, "New Rebel", attacker);
  1123.                 }
  1124.             }
  1125.             if (gShadow_ColorRebels)
  1126.             {
  1127.                 SetEntityRenderColor(attacker, gShadow_ColorRebels_Red, gShadow_ColorRebels_Green,
  1128.                 gShadow_ColorRebels_Blue, 255);
  1129.             }
  1130.         }
  1131.     }
  1132.     else if (attacker && target && (GetClientTeam(attacker) == CS_TEAM_CT) && (GetClientTeam(target) == CS_TEAM_T) \
  1133.         && !g_bIsARebel[target] && g_bRoundInProgress)
  1134.     {
  1135.         new bool:bPrisonerHasGun = PlayerHasGun(target);
  1136.        
  1137.         if (gShadow_Announce_CT_FreeHit && target != g_iLastCT_FreeAttacker)
  1138.         {
  1139.             g_iLastCT_FreeAttacker = target;
  1140.            
  1141.             if (gShadow_Announce_Weapon_Attack && bPrisonerHasGun)
  1142.             {
  1143.                 if (IsClientInGame(target) && IsPlayerAlive(target))
  1144.                 {
  1145.                     for (new idx = 1; idx <= MaxClients; idx++)
  1146.                     {
  1147.                         if (IsClientInGame(idx))
  1148.                         {
  1149.                             PrintToConsole(idx, CHAT_BANNER, "CT Attack T Gun", attacker, target);
  1150.                         }
  1151.                     }
  1152.                 }
  1153.             }
  1154.             else
  1155.             {
  1156.                 for (new idx = 1; idx <= MaxClients; idx++)
  1157.                 {
  1158.                     if (IsClientInGame(idx))
  1159.                     {
  1160.                         PrintToConsole(idx, CHAT_BANNER, "Freeattack", attacker, target);
  1161.                     }
  1162.                 }
  1163.             }
  1164.         }
  1165.        
  1166.         // "freeattack" sound
  1167.         if ((gShadow_Freekill_Sound_Mode == 0) && (strlen(gShadow_Freekill_Sound) > 0) \
  1168.             && !StrEqual(gShadow_Freekill_Sound, "-1") && (!bPrisonerHasGun))
  1169.         {
  1170.             EmitSoundToAll(gShadow_Freekill_Sound);
  1171.         }
  1172.     }
  1173. }
  1174.  
  1175. public LastRequest_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)
  1176. {
  1177.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1178.     if (iArraySize > 0)
  1179.     {
  1180.         new client = GetClientOfUserId(GetEventInt(event, "userid"));
  1181.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1182.         {  
  1183.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1184.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1185.            
  1186.             if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  1187.             {
  1188.                 CleanupLastRequest(client, idx);
  1189.                 RemoveFromArray(gH_DArray_LR_Partners, idx);
  1190.                 PrintToChatAll(CHAT_BANNER, "LR Player Disconnect", client);
  1191.             }
  1192.         }
  1193.     }
  1194. }
  1195.  
  1196. CleanupLastRequest(loser, arrayIndex)
  1197. {
  1198.     new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_LRType);
  1199.     new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_Prisoner);
  1200.     new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_Guard);
  1201.    
  1202.     g_bInLastRequest[LR_Player_Prisoner] = false;
  1203.     g_bInLastRequest[LR_Player_Guard] = false;
  1204.    
  1205.     RemoveBeacon(LR_Player_Prisoner);
  1206.     RemoveBeacon(LR_Player_Guard);
  1207.    
  1208.     new winner = (loser == LR_Player_Prisoner) ? LR_Player_Guard : LR_Player_Prisoner;
  1209.    
  1210.     switch (type)
  1211.     {
  1212.         case LR_KnifeFight:
  1213.         {
  1214.             new KnifeType:KnifeChoice = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_Global1);
  1215.             switch (KnifeChoice)
  1216.             {
  1217.                 case Knife_Drunk, Knife_Drugs:
  1218.                 {
  1219.                     if (IsClientInGame(LR_Player_Prisoner))
  1220.                     {
  1221.                         SetEntData(LR_Player_Prisoner, g_Offset_FOV, NORMAL_VISION, 4, true);
  1222.                         SetEntData(LR_Player_Prisoner, g_Offset_DefFOV, NORMAL_VISION, 4, true);
  1223.                         ShowOverlayToClient(LR_Player_Prisoner, "");
  1224.                     }  
  1225.                     if (IsClientInGame(LR_Player_Guard))
  1226.                     {
  1227.                         SetEntData(LR_Player_Guard, g_Offset_FOV, NORMAL_VISION, 4, true);
  1228.                         SetEntData(LR_Player_Guard, g_Offset_DefFOV, NORMAL_VISION, 4, true);
  1229.                         ShowOverlayToClient(LR_Player_Guard, "");
  1230.                     }  
  1231.                 }
  1232.                 case Knife_LowGrav:
  1233.                 {
  1234.                     if  (IsClientInGame(LR_Player_Prisoner))
  1235.                     {
  1236.                         SetEntityGravity(LR_Player_Prisoner, 1.0);
  1237.                     }
  1238.                     if (IsClientInGame(LR_Player_Guard))
  1239.                     {
  1240.                         SetEntityGravity(LR_Player_Guard, 1.0);
  1241.                     }
  1242.                 }
  1243.                 case Knife_HiSpeed:
  1244.                 {
  1245.                     if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1246.                     {
  1247.                         SetEntPropFloat(winner, Prop_Data, "m_flLaggedMovementValue", 1.0);
  1248.                     }
  1249.                     if (IsClientInGame(loser))
  1250.                     {
  1251.                         SetEntPropFloat(winner, Prop_Data, "m_flLaggedMovementValue", 1.0);
  1252.                     }
  1253.                 }
  1254.                 case Knife_ThirdPerson:
  1255.                 {
  1256.                     if (IsClientInGame(LR_Player_Prisoner))
  1257.                     {
  1258.                         SetFirstPerson(LR_Player_Prisoner);
  1259.                     }
  1260.                     if (IsClientInGame(LR_Player_Guard))
  1261.                     {
  1262.                         SetFirstPerson(LR_Player_Guard);
  1263.                     }
  1264.                 }
  1265.             }
  1266.         }
  1267.         case LR_GunToss:
  1268.         {
  1269.             new GTdeagle1 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_PrisonerData));
  1270.             new GTdeagle2 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_GuardData));
  1271.             if (IsValidEntity(GTdeagle1))
  1272.             {
  1273.                 SetEntityRenderColor(GTdeagle1, 255, 255, 255);
  1274.                 SetEntityRenderMode(GTdeagle1, RENDER_NORMAL);
  1275.             }
  1276.             if (IsValidEntity(GTdeagle2))
  1277.             {
  1278.                 SetEntityRenderColor(GTdeagle2, 255, 255, 255);
  1279.                 SetEntityRenderMode(GTdeagle2, RENDER_NORMAL);
  1280.             }      
  1281.         }
  1282.         case LR_ChickenFight:
  1283.         {
  1284.             if (gShadow_NoBlock)
  1285.             {
  1286.                 if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1287.                 {
  1288.                     UnblockEntity(winner, g_Offset_CollisionGroup);
  1289.                     GivePlayerItem(winner, "weapon_knife");
  1290.                 }  
  1291.             }  
  1292.            
  1293.         }
  1294.         case LR_HotPotato:
  1295.         {
  1296.             if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1297.             {
  1298.                 SetEntPropFloat(winner, Prop_Data, "m_flLaggedMovementValue", 1.0);
  1299.                 SetEntityMoveType(winner, MOVETYPE_WALK);
  1300.                 GivePlayerItem(winner, "weapon_knife");
  1301.             }
  1302.            
  1303.             new HPdeagle = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_Global4);
  1304.             RemoveBeacon(HPdeagle);
  1305.             if (IsValidEntity(HPdeagle))
  1306.             {
  1307.                 SetEntityRenderColor(HPdeagle, 255, 255, 255);
  1308.                 SetEntityRenderMode(HPdeagle, RENDER_NORMAL);
  1309.             }
  1310.         }
  1311.         case LR_RussianRoulette:
  1312.         {
  1313.             if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1314.             {
  1315.                 SetEntityMoveType(winner, MOVETYPE_WALK);
  1316.                 GivePlayerItem(winner, "weapon_knife");
  1317.             }
  1318.         }
  1319.         case LR_Dodgeball:
  1320.         {
  1321.             if  (IsClientInGame(LR_Player_Prisoner))
  1322.             {
  1323.                 SetEntityGravity(LR_Player_Prisoner, 1.0);
  1324.             }
  1325.             if (IsClientInGame(LR_Player_Guard))
  1326.             {
  1327.                 SetEntityGravity(LR_Player_Guard, 1.0);
  1328.             }
  1329.            
  1330.             if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1331.             {
  1332.                 StripAllWeapons(winner);
  1333.                 SetEntData(winner, g_Offset_Ammo + (_:12 * 4), 0, _, true);
  1334.                
  1335.                 SetEntData(winner, g_Offset_Health, 100);
  1336.                 GivePlayerItem(winner, "weapon_knife");
  1337.    
  1338.                 if (gShadow_NoBlock)
  1339.                 {
  1340.                     UnblockEntity(winner, g_Offset_CollisionGroup);
  1341.                 }
  1342.             }
  1343.         }
  1344.         case LR_Race:
  1345.         {
  1346.             // free these resources
  1347.             CloseHandle(GetArrayCell(gH_DArray_LR_Partners, arrayIndex, 9));
  1348.             if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1349.             {
  1350.                 GivePlayerItem(winner, "weapon_knife");
  1351.                
  1352.                 if (!gShadow_NoBlock)
  1353.                 {              
  1354.                     BlockEntity(winner, g_Offset_CollisionGroup);
  1355.                 }          
  1356.             }
  1357.         }
  1358.         case LR_JumpContest:
  1359.         {
  1360.             new JumpContest:JumpType = GetArrayCell(gH_DArray_LR_Partners, arrayIndex, _:Block_Global2);
  1361.  
  1362.             switch (JumpType)
  1363.             {
  1364.                 case Jump_TheMost, Jump_BrinkOfDeath:
  1365.                 {
  1366.                     if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1367.                     {
  1368.                         if (!gShadow_NoBlock)
  1369.                         {
  1370.                             BlockEntity(winner, g_Offset_CollisionGroup);                      
  1371.                         }
  1372.                     }
  1373.                 }
  1374.                 case Jump_Farthest:
  1375.                 {
  1376.                     if (IsClientInGame(winner) && IsPlayerAlive(winner))
  1377.                     {
  1378.                         SetEntityMoveType(winner, MOVETYPE_WALK);
  1379.                         GivePlayerItem(winner, "weapon_knife");
  1380.                     }              
  1381.                 }
  1382.             }
  1383.         }
  1384.         default:
  1385.         {
  1386.             Call_StartForward(gH_Frwd_LR_CleanUp);
  1387.             Call_PushCell(type);
  1388.             Call_PushCell(LR_Player_Prisoner);
  1389.             Call_PushCell(LR_Player_Guard);
  1390.             new ignore;
  1391.             Call_Finish(_:ignore);
  1392.         }
  1393.     }  
  1394. }
  1395.  
  1396. public LastRequest_BulletImpact(Handle:event, const String:name[], bool:dontBroadcast)
  1397. {
  1398.     new attacker = GetClientOfUserId(GetEventInt(event, "userid"));
  1399.     if (!g_bIsARebel[attacker] && gShadow_RebelOnImpact && (GetClientTeam(attacker) == CS_TEAM_T) && !Local_IsClientInLR(attacker))
  1400.     {
  1401.         g_bIsARebel[attacker] = true;
  1402.        
  1403.         if (gShadow_ColorRebels)
  1404.         {
  1405.             SetEntityRenderColor(attacker, gShadow_ColorRebels_Red, gShadow_ColorRebels_Green, gShadow_ColorRebels_Blue, 255);
  1406.         }
  1407.        
  1408.         if (gShadow_Announce_Rebel && IsClientInGame(attacker))
  1409.         {
  1410.             if (gShadow_SendGlobalMsgs)
  1411.             {
  1412.                 PrintToChatAll(CHAT_BANNER, "New Rebel", attacker);
  1413.             }
  1414.             else
  1415.             {
  1416.                 PrintToChat(attacker, CHAT_BANNER, "New Rebel", attacker);
  1417.             }
  1418.         }
  1419.     }
  1420. }
  1421.  
  1422. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
  1423. {
  1424.     for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1425.     {  
  1426.         new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1427.         if (type == LR_NoScope)
  1428.         {
  1429.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1430.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1431.             if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  1432.             {
  1433.                 buttons &= ~IN_ATTACK2;
  1434.             }
  1435.         }
  1436.     }
  1437.     return Plugin_Continue;
  1438. }
  1439.  
  1440. public Action:LastRequest_WeaponZoom(Handle:event, const String:name[], bool:dontBroadcast)
  1441. {
  1442.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1443.     if (iArraySize > 0)
  1444.     {
  1445.         new client = GetClientOfUserId(GetEventInt(event, "userid"));
  1446.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1447.         {  
  1448.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1449.             if (type == LR_NoScope)
  1450.             {
  1451.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1452.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1453.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  1454.                 {
  1455.                     SetEntData(client, g_Offset_FOV, 0, 4, true);
  1456.                     return Plugin_Handled;
  1457.                 }
  1458.             }
  1459.         }
  1460.     }
  1461.    
  1462.     return Plugin_Continue;
  1463. }
  1464.  
  1465. public LastRequest_PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
  1466. {
  1467.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1468.     if (iArraySize > 0)
  1469.     {
  1470.         new client = GetClientOfUserId(GetEventInt(event, "userid"));
  1471.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1472.         {  
  1473.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1474.             if (type == LR_JumpContest)
  1475.             {
  1476.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1477.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1478.                 new JumpContest:JumpType = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  1479.                
  1480.                 switch (JumpType)
  1481.                 {
  1482.                     case Jump_TheMost:
  1483.                     {
  1484.                         new iJumpCount = 0;
  1485.                         if (client == LR_Player_Prisoner)
  1486.                         {
  1487.                             iJumpCount = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  1488.                             SetArrayCell(gH_DArray_LR_Partners, idx, ++iJumpCount, _:Block_PrisonerData);
  1489.                         }
  1490.                         else if (client == LR_Player_Guard)
  1491.                         {
  1492.                             iJumpCount = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  1493.                             SetArrayCell(gH_DArray_LR_Partners, idx, ++iJumpCount, _:Block_GuardData);
  1494.                         }                  
  1495.                     }
  1496.                     case Jump_Farthest:
  1497.                     {
  1498.                         new bool:Prisoner_Jumped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  1499.                         new bool:Guard_Jumped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  1500.                        
  1501.                         if ((client == LR_Player_Prisoner) && !Prisoner_Jumped)
  1502.                         {
  1503.                             // record position
  1504.                             decl Float:Prisoner_Position[3];
  1505.                             GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  1506.                             new Handle:JumpPackPosition = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);                    
  1507.                             SetPackPosition(JumpPackPosition, 0);
  1508.                             WritePackFloat(JumpPackPosition, Prisoner_Position[0]);
  1509.                             WritePackFloat(JumpPackPosition, Prisoner_Position[1]);
  1510.                             WritePackFloat(JumpPackPosition, Prisoner_Position[2]);
  1511.                         }
  1512.                         else if ((client == LR_Player_Guard) && !Guard_Jumped)
  1513.                         {
  1514.                             // record position
  1515.                             decl Float:Guard_Position[3];
  1516.                             GetClientAbsOrigin(LR_Player_Guard, Guard_Position);
  1517.                             new Handle:JumpPackPosition = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);                        
  1518.                             SetPackPosition(JumpPackPosition, 24);
  1519.                             WritePackFloat(JumpPackPosition, Guard_Position[0]);
  1520.                             WritePackFloat(JumpPackPosition, Guard_Position[1]);
  1521.                             WritePackFloat(JumpPackPosition, Guard_Position[2]);
  1522.                         }
  1523.                     }
  1524.                 }
  1525.             }
  1526.             else if (type == LR_GunToss)
  1527.             {
  1528.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1529.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1530.                 new GTp1dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  1531.                 new GTp2dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  1532.  
  1533.                 // we want to grab the last jump position *before* they throw their gun
  1534.                 if (client == LR_Player_Prisoner && !GTp1dropped)
  1535.                 {
  1536.                     // record position
  1537.                     decl Float:Prisoner_Position[3];
  1538.                     GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  1539.                     new Handle:JumpPackPosition = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);
  1540.                     SetPackPosition(JumpPackPosition, 96);
  1541.                     WritePackFloat(JumpPackPosition, Prisoner_Position[0]);
  1542.                     WritePackFloat(JumpPackPosition, Prisoner_Position[1]);
  1543.                     WritePackFloat(JumpPackPosition, Prisoner_Position[2]);
  1544.                 }
  1545.                 else if (client == LR_Player_Guard && !GTp2dropped)
  1546.                 {
  1547.                     // record position
  1548.                     decl Float:Guard_Position[3];
  1549.                     GetClientAbsOrigin(LR_Player_Guard, Guard_Position);
  1550.                     new Handle:JumpPackPosition = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);
  1551.                     SetPackPosition(JumpPackPosition, 120);
  1552.                     WritePackFloat(JumpPackPosition, Guard_Position[0]);
  1553.                     WritePackFloat(JumpPackPosition, Guard_Position[1]);
  1554.                     WritePackFloat(JumpPackPosition, Guard_Position[2]);
  1555.                 }
  1556.             }
  1557.         }
  1558.     }
  1559. }
  1560.  
  1561. public LastRequest_WeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
  1562. {
  1563.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1564.     if (iArraySize > 0)
  1565.     {
  1566.         new client = GetClientOfUserId(GetEventInt(event, "userid"));
  1567.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1568.         {
  1569.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1570.             if (type == LR_Mag4Mag)
  1571.             {
  1572.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1573.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1574.                
  1575.                 if ((client == LR_Player_Prisoner) || (client == LR_Player_Guard))
  1576.                 {
  1577.                     new M4M_Prisoner_Weapon = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  1578.                     new M4M_Guard_Weapon = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  1579.                     new M4M_RoundsFired = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  1580.                     new M4M_Ammo = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);
  1581.                    
  1582.                     decl String:FiredWeapon[32];
  1583.                     GetEventString(event, "weapon", FiredWeapon, sizeof(FiredWeapon));
  1584.                     new iClientWeapon = GetEntDataEnt2(client, g_Offset_ActiveWeapon)
  1585.                    
  1586.                     // set the time to enable burst value to a high value
  1587.                     SetEntDataFloat(iClientWeapon, g_Offset_SecAttack, 5000.0);
  1588.                    
  1589.                     if (iClientWeapon != M4M_Prisoner_Weapon && iClientWeapon != M4M_Guard_Weapon && !StrEqual(FiredWeapon, "knife"))
  1590.                     {
  1591.                         DecideRebelsFate(client, idx, -1);
  1592.                     }
  1593.                     else if (!StrEqual(FiredWeapon, "knife"))
  1594.                     {
  1595.                         new currentAmmo = GetEntData(iClientWeapon, g_Offset_Clip1);
  1596.                         // check if a shot was actually fired
  1597.                         if (currentAmmo != M4M_Ammo)
  1598.                         {
  1599.                             SetArrayCell(gH_DArray_LR_Partners, idx, currentAmmo, _:Block_Global3);
  1600.                             SetArrayCell(gH_DArray_LR_Partners, idx, ++M4M_RoundsFired, _:Block_Global2);
  1601.                            
  1602.                             if (M4M_RoundsFired >= gShadow_LR_M4M_MagCapacity)
  1603.                             {
  1604.                                 M4M_RoundsFired = 0;
  1605.                                 SetArrayCell(gH_DArray_LR_Partners, idx, M4M_RoundsFired, _:Block_Global2);
  1606.                                 if (gShadow_Announce_Shot4Shot)
  1607.                                 {
  1608.                                     if (gShadow_SendGlobalMsgs)
  1609.                                     {
  1610.                                         PrintToChatAll(CHAT_BANNER, "M4M Mag Used", client);
  1611.                                     }
  1612.                                     else
  1613.                                     {
  1614.                                         PrintToChat(LR_Player_Guard, CHAT_BANNER, "M4M Mag Used", client);
  1615.                                         PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "M4M Mag Used", client);
  1616.                                     }
  1617.                                 }
  1618.  
  1619.                                 // send it to the next player
  1620.                                 if (LR_Player_Prisoner == client)
  1621.                                 {
  1622.                                     SetEntData(M4M_Guard_Weapon, g_Offset_Clip1, gShadow_LR_M4M_MagCapacity);
  1623.                                     SetArrayCell(gH_DArray_LR_Partners, idx, LR_Player_Guard, _:Block_Global1);
  1624.                                 }
  1625.                                 else if (LR_Player_Guard == client)
  1626.                                 {
  1627.                                     SetEntData(M4M_Prisoner_Weapon, g_Offset_Clip1, gShadow_LR_M4M_MagCapacity);
  1628.                                     SetArrayCell(gH_DArray_LR_Partners, idx, LR_Player_Prisoner, _:Block_Global1);
  1629.                                 }
  1630.                             }
  1631.                         }
  1632.                     }          
  1633.                 }          
  1634.             }
  1635.             else if (type == LR_RussianRoulette)
  1636.             {
  1637.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1638.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1639.                 if ((client == LR_Player_Prisoner) || (client == LR_Player_Guard))
  1640.                 {                          
  1641.                     new Prisoner_Weapon = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData));
  1642.                     new Guard_Weapon = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData));
  1643.  
  1644.                     if (gShadow_Announce_Shot4Shot)
  1645.                     {
  1646.                         if (gShadow_SendGlobalMsgs)
  1647.                         {
  1648.                             PrintToChatAll(CHAT_BANNER, "S4S Shot Taken", client);
  1649.                         }
  1650.                         else
  1651.                         {
  1652.                             PrintToChat(LR_Player_Guard, CHAT_BANNER, "S4S Shot Taken", client);
  1653.                             PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "S4S Shot Taken", client);
  1654.                         }
  1655.                     }
  1656.                    
  1657.                     // give the opposite LR player 1 bullet in their deagle
  1658.                     if (client == LR_Player_Prisoner)
  1659.                     {
  1660.                         // modify deagle 2s ammo
  1661.                         SetEntData(Guard_Weapon, g_Offset_Clip1, 1);
  1662.                     }
  1663.                     else if (client == LR_Player_Guard)
  1664.                     {
  1665.                         // modify deagle 1s ammo
  1666.                         SetEntData(Prisoner_Weapon, g_Offset_Clip1, 1);
  1667.                     }
  1668.                    
  1669.                     ChangeEdictState(Prisoner_Weapon, g_Offset_Clip1);
  1670.                     ChangeEdictState(Guard_Weapon, g_Offset_Clip1);                
  1671.                 }
  1672.             }
  1673.             else if (type == LR_Shot4Shot)
  1674.             {
  1675.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1676.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1677.                 if ((client == LR_Player_Prisoner) || (client == LR_Player_Guard))
  1678.                 {
  1679.                     new Prisoner_S4S_Pistol = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  1680.                     new Guard_S4S_Pistol = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  1681.                     new S4Slastshot = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  1682.                    
  1683.                     decl String:FiredWeapon[32];
  1684.                     GetEventString(event, "weapon", FiredWeapon, sizeof(FiredWeapon));
  1685.                    
  1686.                     // get the entity index of the pistol
  1687.                     new iClientWeapon = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY);
  1688.                    
  1689.                     // check if we have the same weapon
  1690.                     new String:LR_WeaponName[32];
  1691.                     if (iClientWeapon != -1)
  1692.                     {
  1693.                         GetEdictClassname(iClientWeapon, LR_WeaponName, sizeof(LR_WeaponName));
  1694.                         ReplaceString(LR_WeaponName, sizeof(LR_WeaponName), "weapon_", "");
  1695.                     }
  1696.                    
  1697.                     if (StrEqual(LR_WeaponName, FiredWeapon))
  1698.                     {
  1699.                         // update who took the last shot
  1700.                         SetArrayCell(gH_DArray_LR_Partners, idx, client, _:Block_Global1);
  1701.                        
  1702.                         // they picked up an identical gun and are using it instead
  1703.                         if (iClientWeapon != Prisoner_S4S_Pistol && iClientWeapon != Guard_S4S_Pistol)             
  1704.                         {
  1705.                             DecideRebelsFate(client, idx, -1);
  1706.                         }
  1707.                         // firing weapon IS correct
  1708.                         else
  1709.                         {              
  1710.                             // check for double shot situation (if they picked up another deagle with more ammo between shots)
  1711.                             if (gShadow_LR_S4S_DoubleShot && (S4Slastshot == client))
  1712.                             {
  1713.                                 // this should no longer be possible to do without extra manipulation                              
  1714.                                 DecideRebelsFate(client, idx, -1);                             
  1715.                             }
  1716.                             else // if we didn't repeat
  1717.                             {      
  1718.                                 if (gShadow_Announce_Shot4Shot)
  1719.                                 {
  1720.                                     if (gShadow_SendGlobalMsgs)
  1721.                                     {
  1722.                                         PrintToChatAll(CHAT_BANNER, "S4S Shot Taken", client);
  1723.                                     }
  1724.                                     else
  1725.                                     {
  1726.                                         PrintToChat(LR_Player_Guard, CHAT_BANNER, "S4S Shot Taken", client);
  1727.                                         PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "S4S Shot Taken", client);
  1728.                                     }
  1729.                                 }
  1730.                                
  1731.                                 // give the opposite LR player 1 bullet in their deagle
  1732.                                 if (client == LR_Player_Prisoner)
  1733.                                 {
  1734.                                     // modify deagle 2s ammo
  1735.                                     SetEntData(Guard_S4S_Pistol, g_Offset_Clip1, 1);
  1736.                                 }
  1737.                                 else if (client == LR_Player_Guard)
  1738.                                 {
  1739.                                     // modify deagle 1s ammo
  1740.                                     SetEntData(Prisoner_S4S_Pistol, g_Offset_Clip1, 1);
  1741.                                 }              
  1742.  
  1743.                                 // propogate the ammo immediately! (thanks psychonic)
  1744.                                 ChangeEdictState(Prisoner_S4S_Pistol, g_Offset_Clip1);
  1745.                                 ChangeEdictState(Guard_S4S_Pistol, g_Offset_Clip1);
  1746.                             }
  1747.                         }                                      
  1748.                     }
  1749.                     else if (!StrEqual(FiredWeapon, "knife"))
  1750.                     {
  1751.                         DecideRebelsFate(client, idx, -1);
  1752.                     }
  1753.                 }  
  1754.             }          
  1755.             else if (type == LR_NoScope)
  1756.             {
  1757.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1758.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1759.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  1760.                 {
  1761.                     // grab weapon choice
  1762.                     new NoScopeWeapon:NS_Selection;
  1763.                     NS_Selection = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);                  
  1764.                     switch (NS_Selection)
  1765.                     {
  1766.                         case NSW_AWP:
  1767.                         {
  1768.                             CreateTimer(1.8, Timer_ResetZoom, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
  1769.                         }
  1770.                         case NSW_Scout:
  1771.                         {
  1772.                             CreateTimer(1.3, Timer_ResetZoom, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
  1773.                         }
  1774.                         default:
  1775.                         {
  1776.                             CreateTimer(0.5, Timer_ResetZoom, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
  1777.                         }
  1778.                     }
  1779.                 }
  1780.             }
  1781.         }
  1782.     }
  1783. } // end LastRequest_WeaponFire
  1784.  
  1785. public Action:Timer_ResetZoom(Handle:timer, any:UserId)
  1786. {
  1787.     new client = GetClientOfUserId(UserId);
  1788.     if (client)
  1789.     {
  1790.         SetEntData(client, g_Offset_FOV, 0, 4, true);
  1791.     }
  1792.     return Plugin_Handled;
  1793. }
  1794.  
  1795. public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3])
  1796. {
  1797.     if ((victim != attacker) && (victim > 0) && (victim <= MaxClients) && (attacker > 0) && (attacker <= MaxClients))
  1798.     {
  1799.         new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1800.         if (iArraySize > 0)
  1801.         {
  1802.             for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1803.             {
  1804.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1805.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1806.                 new LastRequest:Type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1807.                
  1808.                 // if a roulette player is hurting the other contestant
  1809.                 if ((Type == LR_RussianRoulette) && (attacker == LR_Player_Guard || attacker == LR_Player_Prisoner) && \
  1810.                     (victim == LR_Player_Guard || victim == LR_Player_Prisoner))
  1811.                 {
  1812.                     // determine if LR weapon is being used
  1813.                     new Pistol_Prisoner = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData));
  1814.                     new Pistol_Guard = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData));
  1815.                    
  1816.                     if ((weapon != -1) && (weapon != Pistol_Prisoner) && (weapon != Pistol_Guard))
  1817.                     {
  1818.                         DecideRebelsFate(attacker, idx, victim);
  1819.                     }
  1820.                    
  1821.                     // null any damage
  1822.                     damage = 0.0;
  1823.                    
  1824.                     // decide if there's a winner
  1825.                     new bullet = GetRandomInt(1,6);
  1826.                     switch (bullet)
  1827.                     {
  1828.                         case 1:
  1829.                         {
  1830.                             KillAndReward(victim, attacker);
  1831.                             PrintToChatAll(CHAT_BANNER, "Russian Roulette - Hit", victim);
  1832.  
  1833.                         }
  1834.                         default:
  1835.                         {
  1836.                             if (gShadow_SendGlobalMsgs)
  1837.                             {                      
  1838.                                 PrintToChatAll(CHAT_BANNER, "Russian Roulette - Miss");
  1839.                             }
  1840.                             else
  1841.                             {
  1842.                                 PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Russian Roulette - Miss");
  1843.                                 PrintToChat(LR_Player_Guard, CHAT_BANNER, "Russian Roulette - Miss");
  1844.                             }
  1845.                         }
  1846.                     }
  1847.  
  1848.                     return Plugin_Handled;
  1849.                 }
  1850.                 else if (!gShadow_LR_Damage)
  1851.                 {
  1852.                     return Plugin_Continue;
  1853.                 }
  1854.                 else if (Type == LR_Rebel)
  1855.                 {
  1856.                     return Plugin_Continue;
  1857.                 }              
  1858.                 // Allow LR contestants to attack each other
  1859.                 else if ((victim == LR_Player_Prisoner && attacker == LR_Player_Guard) || (victim == LR_Player_Guard && attacker == LR_Player_Prisoner))
  1860.                 {
  1861.                     return Plugin_Continue;
  1862.                 }
  1863.                 // Don't allow attacks outside or inside the Last Request
  1864.                 else if (victim == LR_Player_Prisoner || victim == LR_Player_Guard || attacker == LR_Player_Prisoner || attacker == LR_Player_Guard)
  1865.                 {
  1866.                     damage = 0.0;
  1867.                     return Plugin_Changed;
  1868.                 }
  1869.             }
  1870.         }
  1871.     }
  1872.     return Plugin_Continue;
  1873. }  
  1874.  
  1875. public Action:OnWeaponDecideUse(client, weapon)
  1876. {
  1877.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1878.     if (iArraySize > 0)
  1879.     {
  1880.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1881.         {
  1882.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1883.  
  1884.             if (type == LR_HotPotato)
  1885.             {
  1886.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1887.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1888.                 new HPdeagle = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global4);
  1889.                
  1890.                 // check if someone else picked up the hot potato
  1891.                 if (client != LR_Player_Guard && client != LR_Player_Prisoner && weapon == HPdeagle)
  1892.                 {
  1893.                     return Plugin_Handled;
  1894.                 }              
  1895.             }
  1896.             else if (type == LR_GunToss)
  1897.             {
  1898.                 new GTp1done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);
  1899.                 new GTp2done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global4);
  1900.                 new GTdeagle1 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData));
  1901.                 new GTdeagle2 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData));
  1902.                
  1903.                 if ((weapon == GTdeagle1 && !GTp1done) || (weapon == GTdeagle2 && !GTp2done))
  1904.                 {
  1905.                     return Plugin_Handled;
  1906.                 }
  1907.             }
  1908.         }
  1909.     }
  1910.     return Plugin_Continue;
  1911. }
  1912.  
  1913. public Action:OnWeaponEquip(client, weapon)
  1914. {
  1915.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  1916.     if (iArraySize > 0)
  1917.     {
  1918.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  1919.         {  
  1920.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  1921.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  1922.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  1923.  
  1924.             if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  1925.             {
  1926.                 if (type == LR_GunToss)
  1927.                 {
  1928.                     new GTp1dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  1929.                     new GTp2dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  1930.                     new GTp1done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);
  1931.                     new GTp2done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global4);
  1932.                    
  1933.                     if (client == LR_Player_Prisoner && GTp1dropped && !GTp1done)
  1934.                     {
  1935.                         decl String:weapon_name[32];
  1936.                         GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
  1937.                         if (StrEqual(weapon_name, "weapon_deagle"))
  1938.                         {
  1939.                             SetArrayCell(gH_DArray_LR_Partners, idx, true, _:Block_Global3);
  1940.                         }          
  1941.                     }
  1942.                     else if (client == LR_Player_Guard && GTp2dropped && !GTp2done)
  1943.                     {
  1944.                         decl String:weapon_name[32];
  1945.                         GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
  1946.                         if (StrEqual(weapon_name, "weapon_deagle"))
  1947.                         {
  1948.                             SetArrayCell(gH_DArray_LR_Partners, idx, true, _:Block_Global4);
  1949.                         }                      
  1950.                     }  
  1951.                 }
  1952.                 else if (type == LR_HotPotato)
  1953.                 {
  1954.                     new HPdeagle = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global4);
  1955.                     if (weapon == HPdeagle)
  1956.                     {
  1957.                         SetArrayCell(gH_DArray_LR_Partners, idx, client, _:Block_Global1); // HPloser
  1958.                         if (gShadow_LR_HotPotato_Mode != 2)
  1959.                         {
  1960.                             SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", gShadow_LR_HotPotato_Speed);
  1961.                             // reset other player's speed
  1962.                             SetEntPropFloat((client == LR_Player_Prisoner ? LR_Player_Guard : LR_Player_Prisoner),
  1963.                                 Prop_Data, "m_flLaggedMovementValue", 1.0);
  1964.                         }
  1965.                        
  1966.                         if (gShadow_Announce_HotPotato_Eqp)
  1967.                         {
  1968.                             if (gShadow_SendGlobalMsgs)
  1969.                             {
  1970.                                 PrintToChatAll(CHAT_BANNER, "Hot Potato PickUp", client);
  1971.                             }
  1972.                             else
  1973.                             {
  1974.                                 PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Hot Potato Pickup", client);
  1975.                                 PrintToChat(LR_Player_Guard, CHAT_BANNER, "Hot Potato Pickup", client);
  1976.                             }
  1977.                         }
  1978.                     }
  1979.                     else
  1980.                     {
  1981.                         // prevent them from picking up any other pistol
  1982.                         decl String:weapon_name[32];
  1983.                         GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
  1984.                         if (StrEqual(weapon_name, "weapon_p228") ||
  1985.                             StrEqual(weapon_name, "weapon_deagle") ||
  1986.                             StrEqual(weapon_name, "weapon_elite") ||
  1987.                             StrEqual(weapon_name, "weapon_fiveseven") ||
  1988.                             StrEqual(weapon_name, "weapon_glock") ||
  1989.                             StrEqual(weapon_name, "weapon_p250") ||
  1990.                             StrEqual(weapon_name, "weapon_hkp2000") ||
  1991.                             StrEqual(weapon_name, "weapon_tec9") ||
  1992.                             StrEqual(weapon_name, "weapon_usp"))
  1993.                         {
  1994.                             return Plugin_Handled;
  1995.                         }
  1996.                     }
  1997.                 }
  1998.             }
  1999.         }
  2000.     }
  2001.  
  2002.     return Plugin_Continue;
  2003. }
  2004.  
  2005. public Action:OnWeaponDrop(client, weapon)
  2006. {
  2007.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  2008.     if (iArraySize > 0)
  2009.     {
  2010.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  2011.         {  
  2012.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  2013.             if (type == LR_RussianRoulette)
  2014.             {
  2015.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  2016.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  2017.                
  2018.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  2019.                 {
  2020.                     return Plugin_Handled;
  2021.                 }
  2022.             }
  2023.             else if (type == LR_GunToss)
  2024.             {
  2025.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  2026.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  2027.                
  2028.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  2029.                 {
  2030.                     new GTdeagle1 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData));
  2031.                     new GTdeagle2 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData));
  2032.                     new GTp1dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  2033.                     new GTp2dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  2034.                    
  2035.                     if (((client == LR_Player_Prisoner && GTp1dropped) ||
  2036.                         (client == LR_Player_Guard && GTp2dropped)) && (gShadow_LR_GunToss_StartMode == 1))
  2037.                     {
  2038.                         if (IsValidEntity(weapon))
  2039.                         {
  2040.                             decl String:weapon_name[32];
  2041.                             GetEdictClassname(weapon, weapon_name, sizeof(weapon_name));
  2042.                             if (StrEqual(weapon_name, "weapon_deagle"))
  2043.                             {
  2044.                                 PrintToChat(client, CHAT_BANNER, "Already Dropped Deagle");
  2045.                                 return Plugin_Handled;
  2046.                             }
  2047.                         }
  2048.                     }
  2049.                     else
  2050.                     {
  2051.                         new Handle:PositionDataPack = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);
  2052.                         if (client == LR_Player_Prisoner)
  2053.                         {
  2054.                             if (IsValidEntity(GTdeagle1))
  2055.                             {
  2056.                                 SetEntData(GTdeagle1, g_Offset_Clip1, 7);
  2057.                             }
  2058.                            
  2059.                             if (weapon == GTdeagle1)
  2060.                             {
  2061.  
  2062.                                 decl Float:GTp1droppos[3];
  2063.                                 GetClientAbsOrigin(LR_Player_Prisoner, GTp1droppos);
  2064.                                 SetPackPosition(PositionDataPack, 48);
  2065.                                 WritePackFloat(PositionDataPack, GTp1droppos[0]);
  2066.                                 WritePackFloat(PositionDataPack, GTp1droppos[1]);
  2067.                                 WritePackFloat(PositionDataPack, GTp1droppos[2]);
  2068.                                 SetArrayCell(gH_DArray_LR_Partners, idx, true, _:Block_Global1);
  2069.                             }
  2070.                         }
  2071.                         else if (client == LR_Player_Guard)
  2072.                         {
  2073.                             if (IsValidEntity(GTdeagle2))
  2074.                             {
  2075.                                 SetEntData(GTdeagle2, g_Offset_Clip1, 7);
  2076.                             }
  2077.  
  2078.                             if (weapon == GTdeagle2)
  2079.                             {
  2080.                                 decl Float:GTp2droppos[3];
  2081.                                 GetClientAbsOrigin(LR_Player_Guard, GTp2droppos);
  2082.                                 SetPackPosition(PositionDataPack, 72);
  2083.                                 WritePackFloat(PositionDataPack, GTp2droppos[0]);
  2084.                                 WritePackFloat(PositionDataPack, GTp2droppos[1]);
  2085.                                 WritePackFloat(PositionDataPack, GTp2droppos[2]);
  2086.                                
  2087.                                 SetArrayCell(gH_DArray_LR_Partners, idx, true, _:Block_Global2);
  2088.                             }
  2089.                         }  
  2090.                        
  2091.                         if (g_GunTossTimer == INVALID_HANDLE && (weapon == GTdeagle1 || weapon == GTdeagle2))
  2092.                         {
  2093.                             if (g_Game == Game_CSS)
  2094.                             {
  2095.                                 g_GunTossTimer = CreateTimer(0.1, Timer_GunToss, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  2096.                             }
  2097.                             else if (g_Game == Game_CSGO)
  2098.                             {
  2099.                                 g_GunTossTimer = CreateTimer(1.0, Timer_GunToss, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  2100.                         }   }
  2101.                     }
  2102.                 }
  2103.             }
  2104.         }
  2105.     }
  2106.     return Plugin_Continue;
  2107. }
  2108.  
  2109. LastRequest_OnMapStart()
  2110. {
  2111.     // Precache any materials needed
  2112.     if (g_Game == Game_CSS)
  2113.     {
  2114.         BeamSprite = PrecacheModel("materials/sprites/laser.vmt");
  2115.         HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");
  2116.         LaserSprite = PrecacheModel("materials/sprites/lgtning.vmt");
  2117.         LaserHalo = PrecacheModel("materials/sprites/plasmahalo.vmt");
  2118.     }
  2119.     else if (g_Game == Game_CSGO)
  2120.     {
  2121.         BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
  2122.         HaloSprite = PrecacheModel("materials/sprites/glow01.vmt");
  2123.         LaserSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
  2124.         LaserHalo = PrecacheModel("materials/sprites/light_glow02.vmt");
  2125.     }
  2126.    
  2127.     // Fix for problems with g_BeaconTimer not being set to INVALID_HANDLE on timer terminating (TIMER_FLAG_NO_MAPCHANGE)
  2128.     if (g_BeaconTimer != INVALID_HANDLE)
  2129.     {
  2130.         g_BeaconTimer = INVALID_HANDLE;
  2131.     }
  2132.     // Fix for the same problem with g_CountdownTimer
  2133.     if (g_CountdownTimer != INVALID_HANDLE)
  2134.     {
  2135.         g_CountdownTimer = INVALID_HANDLE;
  2136.     }
  2137. }
  2138.  
  2139. LastRequest_OnConfigsExecuted()
  2140. {
  2141.     if (!g_bPushedToMenu)
  2142.     {
  2143.         new iIndex = 0;
  2144.         // Check LRs
  2145.         gShadow_LR_KnifeFight_On = GetConVarBool(gH_Cvar_LR_KnifeFight_On);
  2146.         if (gShadow_LR_KnifeFight_On)
  2147.         {
  2148.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_KnifeFight);
  2149.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2150.         }
  2151.         gShadow_LR_Shot4Shot_On = GetConVarBool(gH_Cvar_LR_Shot4Shot_On);
  2152.         if (gShadow_LR_Shot4Shot_On)
  2153.         {
  2154.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_Shot4Shot);
  2155.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2156.         }
  2157.         gShadow_LR_GunToss_On = GetConVarBool(gH_Cvar_LR_GunToss_On);
  2158.         if (gShadow_LR_GunToss_On)
  2159.         {
  2160.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_GunToss);
  2161.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2162.         }
  2163.         gShadow_LR_ChickenFight_On = GetConVarBool(gH_Cvar_LR_ChickenFight_On);
  2164.         if (gShadow_LR_ChickenFight_On)
  2165.         {
  2166.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_ChickenFight);
  2167.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2168.         }
  2169.         gShadow_LR_HotPotato_On = GetConVarBool(gH_Cvar_LR_HotPotato_On);
  2170.         if (gShadow_LR_HotPotato_On)
  2171.         {
  2172.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_HotPotato);
  2173.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2174.         }
  2175.         gShadow_LR_Dodgeball_On = GetConVarBool(gH_Cvar_LR_Dodgeball_On);
  2176.         if (gShadow_LR_Dodgeball_On)
  2177.         {
  2178.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_Dodgeball);
  2179.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2180.         }
  2181.         gShadow_LR_NoScope_On = GetConVarBool(gH_Cvar_LR_NoScope_On);
  2182.         if (gShadow_LR_NoScope_On)
  2183.         {
  2184.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_NoScope);
  2185.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2186.         }
  2187.         gShadow_LR_RockPaperScissors_On = GetConVarBool(gH_Cvar_LR_RockPaperScissors_On);
  2188.         if (gShadow_LR_RockPaperScissors_On)
  2189.         {
  2190.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_RockPaperScissors);
  2191.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2192.         }
  2193.         gShadow_LR_Rebel_On = GetConVarBool(gH_Cvar_LR_Rebel_On);
  2194.         if (gShadow_LR_Rebel_On)
  2195.         {
  2196.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_Rebel);
  2197.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2198.         }
  2199.         gShadow_LR_Mag4Mag_On = GetConVarBool(gH_Cvar_LR_Mag4Mag_On);
  2200.         if (gShadow_LR_Mag4Mag_On)
  2201.         {
  2202.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_Mag4Mag);
  2203.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2204.         }
  2205.         gShadow_LR_Race_On = GetConVarBool(gH_Cvar_LR_Race_On);
  2206.         if (gShadow_LR_Race_On)
  2207.         {
  2208.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_Race);
  2209.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2210.         }
  2211.         gShadow_LR_RussianRoulette_On = GetConVarBool(gH_Cvar_LR_RussianRoulette_On);
  2212.         if (gShadow_LR_RussianRoulette_On)
  2213.         {
  2214.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_RussianRoulette);
  2215.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2216.         }
  2217.         gShadow_LR_JumpContest_On = GetConVarBool(gH_Cvar_LR_JumpContest_On);
  2218.         if (gShadow_LR_JumpContest_On)
  2219.         {
  2220.             iIndex = PushArrayCell(gH_DArray_LastRequests, LR_JumpContest);
  2221.             SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2222.         }
  2223.     }
  2224.     g_bPushedToMenu = true;
  2225.    
  2226.     // check for -1 for backward compatibility
  2227.     new MediaType:soundfile = type_Sound;
  2228.     GetConVarString(gH_Cvar_LR_NoScope_Sound, gShadow_LR_NoScope_Sound, sizeof(gShadow_LR_NoScope_Sound));
  2229.     if ((strlen(gShadow_LR_NoScope_Sound) > 0) && !StrEqual(gShadow_LR_NoScope_Sound, "-1"))
  2230.     {      
  2231.         CacheTheFile(gShadow_LR_NoScope_Sound, soundfile);
  2232.     }
  2233.     GetConVarString(gH_Cvar_LR_Sound, gShadow_LR_Sound, sizeof(gShadow_LR_Sound));
  2234.     if ((strlen(gShadow_LR_Sound) > 0) && !StrEqual(gShadow_LR_Sound, "-1"))
  2235.     {
  2236.         CacheTheFile(gShadow_LR_Sound, soundfile);
  2237.     }
  2238.     GetConVarString(gH_Cvar_LR_Beacon_Sound, gShadow_LR_Beacon_Sound, sizeof(gShadow_LR_Beacon_Sound));
  2239.     if ((strlen(gShadow_LR_Beacon_Sound) > 0) && !StrEqual(gShadow_LR_Beacon_Sound, "-1"))
  2240.     {
  2241.         CacheTheFile(gShadow_LR_Beacon_Sound, soundfile);
  2242.     }
  2243.    
  2244.     // update settings from configs
  2245.     gShadow_LR_Enable = bool:GetConVarInt(gH_Cvar_LR_Enable);
  2246.     gShadow_LR_MenuTime = GetConVarInt(gH_Cvar_LR_MenuTime);
  2247.     gShadow_LR_KillTimeouts = bool:GetConVarInt(gH_Cvar_LR_KillTimeouts);
  2248.     gShadow_LR_HotPotato_Mode = GetConVarInt(gH_Cvar_LR_HotPotato_Mode);
  2249.     gShadow_SendGlobalMsgs = GetConVarInt(gH_Cvar_SendGlobalMsgs);
  2250.     gShadow_MaxPrisonersToLR = GetConVarInt(gH_Cvar_MaxPrisonersToLR);
  2251.     gShadow_RebelAction = GetConVarInt(gH_Cvar_RebelAction);
  2252.     gShadow_RebelHandling = GetConVarInt(gH_Cvar_RebelHandling);
  2253.     gShadow_ColorRebels = GetConVarInt(gH_Cvar_ColorRebels);
  2254.     gShadow_Announce_CT_FreeHit = bool:GetConVarInt(gH_Cvar_Announce_CT_FreeHit);
  2255.     gShadow_Announce_LR = bool:GetConVarInt(gH_Cvar_Announce_LR);
  2256.     gShadow_Announce_Rebel = bool:GetConVarInt(gH_Cvar_Announce_Rebel);
  2257.     gShadow_Announce_RebelDown = bool:GetConVarInt(gH_Cvar_Announce_RebelDown);    
  2258.     gShadow_Announce_Weapon_Attack = bool:GetConVarInt(gH_Cvar_Announce_Weapon_Attack);
  2259.     gShadow_Announce_HotPotato_Eqp = bool:GetConVarInt(gH_Cvar_Announce_HotPotato_Eqp);
  2260.     gShadow_LR_AutoDisplay = bool:GetConVarInt(gH_Cvar_LR_AutoDisplay);
  2261.     gShadow_LR_BlockSuicide = bool:GetConVarInt(gH_Cvar_LR_BlockSuicide);
  2262.     gShadow_LR_VictorPoints = GetConVarInt(gH_Cvar_LR_VictorPoints);
  2263.     if (gShadow_LR_BlockSuicide && !g_bListenersAdded)
  2264.     {
  2265.         AddCommandListener(Suicide_Check, "kill");
  2266.         AddCommandListener(Suicide_Check, "explode");
  2267.         AddCommandListener(Suicide_Check, "jointeam");
  2268.         AddCommandListener(Suicide_Check, "spectate");
  2269.         g_bListenersAdded = true;
  2270.     }
  2271.     else if (!gShadow_LR_BlockSuicide && g_bListenersAdded)
  2272.     {
  2273.         RemoveCommandListener(Suicide_Check, "kill");
  2274.         RemoveCommandListener(Suicide_Check, "explode");
  2275.         RemoveCommandListener(Suicide_Check, "jointeam");
  2276.         RemoveCommandListener(Suicide_Check, "spectate");
  2277.         g_bListenersAdded = false;
  2278.     }
  2279.     gShadow_LR_Race_AirPoints = bool:GetConVarInt(gH_Cvar_LR_Race_AirPoints);
  2280.     gShadow_LR_Race_NotifyCTs = bool:GetConVarInt(gH_Cvar_LR_Race_NotifyCTs);
  2281.     gShadow_LR_Beacons = bool:GetConVarInt(gH_Cvar_LR_Beacons);
  2282.     gShadow_LR_HelpBeams = bool:GetConVarInt(gH_Cvar_LR_HelpBeams);
  2283.     gShadow_LR_HelpBeams_Distance = GetConVarFloat(gH_Cvar_LR_HelpBeams_Distance);
  2284.     gShadow_LR_Beacon_Interval = GetConVarFloat(gH_Cvar_LR_Beacon_Interval);
  2285.     gShadow_RebelOnImpact = bool:GetConVarInt(gH_Cvar_RebelOnImpact);
  2286.     gShadow_ColorRebels_Blue = GetConVarInt(gH_Cvar_ColorRebels_Blue);
  2287.     gShadow_ColorRebels_Green = GetConVarInt(gH_Cvar_ColorRebels_Green);
  2288.     gShadow_ColorRebels_Red = GetConVarInt(gH_Cvar_ColorRebels_Red);
  2289.     gShadow_LR_ChickenFight_C_Blue = GetConVarInt(gH_Cvar_LR_ChickenFight_C_Blue);
  2290.     gShadow_LR_ChickenFight_C_Green = GetConVarInt(gH_Cvar_LR_ChickenFight_C_Green);
  2291.     gShadow_LR_ChickenFight_C_Red = GetConVarInt(gH_Cvar_LR_ChickenFight_C_Red);
  2292.     gShadow_LR_ChickenFight_Slay = bool:GetConVarInt(gH_Cvar_LR_ChickenFight_Slay);
  2293.     gShadow_LR_Dodgeball_CheatCheck = bool:GetConVarInt(gH_Cvar_LR_Dodgeball_CheatCheck);
  2294.     gShadow_LR_Dodgeball_Gravity = GetConVarFloat(gH_Cvar_LR_Dodgeball_Gravity);
  2295.     gShadow_LR_Dodgeball_SpawnTime = GetConVarFloat(gH_Cvar_LR_Dodgeball_SpawnTime);
  2296.     gShadow_LR_HotPotato_MaxTime = GetConVarFloat(gH_Cvar_LR_HotPotato_MaxTime);
  2297.     gShadow_LR_HotPotato_MinTime = GetConVarFloat(gH_Cvar_LR_HotPotato_MinTime);
  2298.     gShadow_LR_HotPotato_Speed = GetConVarFloat(gH_Cvar_LR_HotPotato_Speed);
  2299.     GetConVarString(gH_Cvar_LR_NoScope_Sound, gShadow_LR_NoScope_Sound, sizeof(gShadow_LR_NoScope_Sound));
  2300.     GetConVarString(gH_Cvar_LR_Sound, gShadow_LR_Sound, sizeof(gShadow_LR_Sound));
  2301.     GetConVarString(gH_Cvar_LR_Beacon_Sound, gShadow_LR_Beacon_Sound, sizeof(gShadow_LR_Beacon_Sound));
  2302.     gShadow_LR_NoScope_Weapon = GetConVarInt(gH_Cvar_LR_NoScope_Weapon);
  2303.     gShadow_Announce_Shot4Shot = bool:GetConVarInt(gH_Cvar_Announce_Shot4Shot);
  2304.     gShadow_LR_NonContKiller_Action = bool:GetConVarInt(gH_Cvar_LR_NonContKiller_Action);
  2305.     gShadow_LR_S4S_DoubleShot = bool:GetConVarInt(gH_Cvar_LR_S4S_DoubleShot);
  2306.     gShadow_LR_GunToss_MarkerMode = GetConVarInt(gH_Cvar_LR_GunToss_MarkerMode);
  2307.     gShadow_LR_GunToss_StartMode = GetConVarInt(gH_Cvar_LR_GunToss_StartMode);
  2308.     gShadow_LR_GunToss_ShowMeter = GetConVarInt(gH_Cvar_LR_GunToss_ShowMeter);
  2309.     gShadow_LR_Delay_Enable_Time = GetConVarFloat(gH_Cvar_LR_Delay_Enable_Time);
  2310.     gShadow_Announce_Delay_Enable = bool:GetConVarInt(gH_Cvar_Announce_Delay_Enable);
  2311.     gShadow_LR_Damage = bool:GetConVarInt(gH_Cvar_LR_Damage);  
  2312.     gShadow_LR_NoScope_Delay = GetConVarInt(gH_Cvar_LR_NoScope_Delay);
  2313.     gShadow_LR_KnifeFight_Rebel = GetConVarInt(gH_Cvar_LR_KnifeFight_Rebel);
  2314.     gShadow_LR_ChickenFight_Rebel = GetConVarInt(gH_Cvar_LR_ChickenFight_Rebel);
  2315.     gShadow_LR_HotPotato_Rebel = GetConVarInt(gH_Cvar_LR_HotPotato_Rebel)
  2316.     gShadow_LR_Rebel_MaxTs = GetConVarInt(gH_Cvar_LR_Rebel_MaxTs);
  2317.     gShadow_LR_Rebel_MinCTs = GetConVarInt(gH_Cvar_LR_Rebel_MinCTs);
  2318.     gShadow_LR_M4M_MagCapacity = GetConVarInt(gH_Cvar_LR_M4M_MagCapacity);
  2319.     gShadow_LR_KnifeFight_LowGrav = GetConVarFloat(gH_Cvar_LR_KnifeFight_LowGrav);
  2320.     gShadow_LR_KnifeFight_HiSpeed = GetConVarFloat(gH_Cvar_LR_KnifeFight_HiSpeed);
  2321.     gShadow_LR_KnifeFight_Drunk = GetConVarInt(gH_Cvar_LR_KnifeFight_Drunk);
  2322. }
  2323.  
  2324. public ConVarChanged_Setting(Handle:cvar, const String:oldValue[], const String:newValue[])
  2325. {  
  2326.     if (cvar == gH_Cvar_LR_Enable)
  2327.     {
  2328.         gShadow_LR_Enable = bool:StringToInt(newValue);
  2329.     }
  2330.     else if (cvar == gH_Cvar_LR_MenuTime)
  2331.     {
  2332.         gShadow_LR_MenuTime = StringToInt(newValue);
  2333.     }
  2334.     else if (cvar == gH_Cvar_LR_KillTimeouts)
  2335.     {
  2336.         gShadow_LR_KillTimeouts = bool:StringToInt(newValue);
  2337.     }
  2338.     else if (cvar == gH_Cvar_LR_HotPotato_Mode)
  2339.     {
  2340.         gShadow_LR_HotPotato_Mode = StringToInt(newValue);
  2341.     }  
  2342.     else if (cvar == gH_Cvar_SendGlobalMsgs)
  2343.     {
  2344.         gShadow_SendGlobalMsgs = StringToInt(newValue);
  2345.     }
  2346.     else if (cvar == gH_Cvar_MaxPrisonersToLR)
  2347.     {
  2348.         gShadow_MaxPrisonersToLR = StringToInt(newValue);
  2349.     }
  2350.     else if (cvar == gH_Cvar_RebelAction)
  2351.     {
  2352.         gShadow_RebelAction = StringToInt(newValue);
  2353.     }
  2354.     else if (cvar == gH_Cvar_RebelHandling)
  2355.     {
  2356.         gShadow_RebelHandling = StringToInt(newValue);
  2357.     }
  2358.     else if (cvar == gH_Cvar_ColorRebels)
  2359.     {
  2360.         gShadow_ColorRebels = StringToInt(newValue);
  2361.     }
  2362.     else if (cvar == gH_Cvar_Announce_CT_FreeHit)
  2363.     {
  2364.         gShadow_Announce_CT_FreeHit = bool:StringToInt(newValue);
  2365.     }
  2366.     else if (cvar == gH_Cvar_Announce_LR)
  2367.     {
  2368.         gShadow_Announce_LR = bool:StringToInt(newValue);
  2369.     }
  2370.     else if (cvar == gH_Cvar_Announce_Rebel)
  2371.     {
  2372.         gShadow_Announce_Rebel = bool:StringToInt(newValue);
  2373.     }
  2374.     else if (cvar == gH_Cvar_Announce_RebelDown)
  2375.     {
  2376.         gShadow_Announce_RebelDown = bool:StringToInt(newValue);       
  2377.     }
  2378.     else if (cvar == gH_Cvar_Announce_Weapon_Attack)
  2379.     {
  2380.         gShadow_Announce_Weapon_Attack = bool:StringToInt(newValue);
  2381.     }
  2382.     else if (cvar == gH_Cvar_LR_Race_AirPoints)
  2383.     {
  2384.         gShadow_LR_Race_AirPoints = bool:StringToInt(newValue);
  2385.     }
  2386.     else if (cvar == gH_Cvar_LR_Race_NotifyCTs)
  2387.     {
  2388.         gShadow_LR_Race_NotifyCTs = bool:StringToInt(newValue);
  2389.     }
  2390.     else if (cvar == gH_Cvar_LR_Beacons)
  2391.     {
  2392.         gShadow_LR_Beacons = bool:StringToInt(newValue);
  2393.     }
  2394.     else if (cvar == gH_Cvar_LR_HelpBeams)
  2395.     {
  2396.         gShadow_LR_HelpBeams = bool:StringToInt(newValue);
  2397.     }
  2398.     else if (cvar == gH_Cvar_LR_HelpBeams_Distance)
  2399.     {
  2400.         gShadow_LR_HelpBeams_Distance = StringToFloat(newValue);
  2401.     }  
  2402.     else if (cvar == gH_Cvar_LR_Beacon_Interval)
  2403.     {
  2404.         gShadow_LR_Beacon_Interval = StringToFloat(newValue);
  2405.     }
  2406.     else if (cvar == gH_Cvar_RebelOnImpact)
  2407.     {
  2408.         gShadow_RebelOnImpact = bool:StringToInt(newValue);
  2409.     }
  2410.     else if (cvar == gH_Cvar_ColorRebels_Blue)
  2411.     {
  2412.         gShadow_ColorRebels_Blue = StringToInt(newValue);
  2413.     }
  2414.     else if (cvar == gH_Cvar_ColorRebels_Green)
  2415.     {
  2416.         gShadow_ColorRebels_Green = StringToInt(newValue);
  2417.     }
  2418.     else if (cvar == gH_Cvar_ColorRebels_Red)
  2419.     {
  2420.         gShadow_ColorRebels_Red = StringToInt(newValue);
  2421.     }
  2422.     else if (cvar == gH_Cvar_LR_ChickenFight_C_Blue)
  2423.     {
  2424.         gShadow_LR_ChickenFight_C_Blue = StringToInt(newValue);
  2425.     }
  2426.     else if (cvar == gH_Cvar_LR_ChickenFight_C_Green)
  2427.     {
  2428.         gShadow_LR_ChickenFight_C_Green = StringToInt(newValue);
  2429.     }
  2430.     else if (cvar == gH_Cvar_LR_ChickenFight_C_Red)
  2431.     {
  2432.         gShadow_LR_ChickenFight_C_Red = StringToInt(newValue);
  2433.     }
  2434.     else if (cvar == gH_Cvar_LR_ChickenFight_Slay)
  2435.     {
  2436.         gShadow_LR_ChickenFight_Slay = bool:StringToInt(newValue);
  2437.     }
  2438.     else if (cvar == gH_Cvar_LR_Dodgeball_CheatCheck)
  2439.     {
  2440.         gShadow_LR_Dodgeball_CheatCheck = bool:StringToInt(newValue);
  2441.     }
  2442.     else if (cvar == gH_Cvar_LR_Dodgeball_Gravity)
  2443.     {
  2444.         gShadow_LR_Dodgeball_Gravity = StringToFloat(newValue);
  2445.     }
  2446.     else if (cvar == gH_Cvar_LR_Dodgeball_SpawnTime)
  2447.     {
  2448.         gShadow_LR_Dodgeball_SpawnTime = StringToFloat(newValue);
  2449.     }  
  2450.     else if (cvar == gH_Cvar_LR_HotPotato_MaxTime)
  2451.     {
  2452.         gShadow_LR_HotPotato_MaxTime = StringToFloat(newValue);
  2453.     }
  2454.     else if (cvar == gH_Cvar_LR_HotPotato_MinTime)
  2455.     {
  2456.         gShadow_LR_HotPotato_MinTime = StringToFloat(newValue);
  2457.     }
  2458.     else if (cvar == gH_Cvar_LR_HotPotato_Speed)
  2459.     {
  2460.         gShadow_LR_HotPotato_Speed = StringToFloat(newValue);
  2461.     }
  2462.     else if (cvar == gH_Cvar_LR_NoScope_Sound)
  2463.     {
  2464.         Format(gShadow_LR_NoScope_Sound, sizeof(gShadow_LR_NoScope_Sound), newValue);
  2465.     }
  2466.     else if (cvar == gH_Cvar_LR_Sound)
  2467.     {
  2468.         Format(gShadow_LR_Sound, sizeof(gShadow_LR_Sound), newValue);
  2469.     }
  2470.     else if (cvar == gH_Cvar_LR_Beacon_Sound)
  2471.     {
  2472.         Format(gShadow_LR_Beacon_Sound, sizeof(gShadow_LR_Beacon_Sound), newValue);
  2473.     }
  2474.     else if (cvar == gH_Cvar_LR_NoScope_Weapon)
  2475.     {
  2476.         gShadow_LR_NoScope_Weapon = StringToInt(newValue);
  2477.     }
  2478.     else if (cvar == gH_Cvar_Announce_Shot4Shot)
  2479.     {
  2480.         gShadow_Announce_Shot4Shot = bool:StringToInt(newValue);
  2481.     }
  2482.     else if (cvar == gH_Cvar_LR_NonContKiller_Action)
  2483.     {
  2484.         gShadow_LR_NonContKiller_Action = bool:StringToInt(newValue);
  2485.     }
  2486.     else if (cvar == gH_Cvar_LR_S4S_DoubleShot)
  2487.     {
  2488.         gShadow_LR_S4S_DoubleShot = bool:StringToInt(newValue);
  2489.     }
  2490.     else if (cvar == gH_Cvar_LR_GunToss_MarkerMode)
  2491.     {
  2492.         gShadow_LR_GunToss_MarkerMode = StringToInt(newValue);
  2493.     }
  2494.     else if (cvar == gH_Cvar_LR_GunToss_StartMode)
  2495.     {
  2496.         gShadow_LR_GunToss_StartMode = StringToInt(newValue);
  2497.     }
  2498.     else if (cvar == gH_Cvar_LR_GunToss_ShowMeter)
  2499.     {
  2500.         gShadow_LR_GunToss_ShowMeter = StringToInt(newValue);
  2501.     }
  2502.     else if (cvar == gH_Cvar_LR_Delay_Enable_Time)
  2503.     {
  2504.         gShadow_LR_Delay_Enable_Time = StringToFloat(newValue);
  2505.     }
  2506.     else if (cvar == gH_Cvar_Announce_Delay_Enable)
  2507.     {
  2508.         gShadow_Announce_Delay_Enable = bool:StringToInt(newValue);
  2509.     }
  2510.     else if (cvar == gH_Cvar_Announce_HotPotato_Eqp)
  2511.     {
  2512.         gShadow_Announce_HotPotato_Eqp = bool:StringToInt(newValue);
  2513.     }
  2514.     else if (cvar == gH_Cvar_LR_AutoDisplay)
  2515.     {
  2516.         gShadow_LR_AutoDisplay = bool:StringToInt(newValue);
  2517.     }
  2518.     else if (cvar == gH_Cvar_LR_BlockSuicide)
  2519.     {
  2520.         gShadow_LR_BlockSuicide = bool:StringToInt(newValue);
  2521.         if (gShadow_LR_BlockSuicide && !g_bListenersAdded)
  2522.         {
  2523.             AddCommandListener(Suicide_Check, "kill");
  2524.             AddCommandListener(Suicide_Check, "explode");
  2525.             AddCommandListener(Suicide_Check, "jointeam");
  2526.             AddCommandListener(Suicide_Check, "spectate");
  2527.             g_bListenersAdded = true;
  2528.         }
  2529.         else if (!gShadow_LR_BlockSuicide && g_bListenersAdded)
  2530.         {
  2531.             RemoveCommandListener(Suicide_Check, "kill");
  2532.             RemoveCommandListener(Suicide_Check, "explode");
  2533.             RemoveCommandListener(Suicide_Check, "jointeam");
  2534.             RemoveCommandListener(Suicide_Check, "spectate");
  2535.             g_bListenersAdded = false;
  2536.         }
  2537.        
  2538.     }
  2539.     else if (cvar == gH_Cvar_LR_VictorPoints)
  2540.     {
  2541.         gShadow_LR_VictorPoints = StringToInt(newValue);
  2542.     }
  2543.     else if (cvar == gH_Cvar_LR_Damage)
  2544.     {
  2545.         gShadow_LR_Damage = bool:StringToInt(newValue);
  2546.     }  
  2547.     else if (cvar == gH_Cvar_LR_NoScope_Delay)
  2548.     {
  2549.         gShadow_LR_NoScope_Delay = StringToInt(newValue);
  2550.     }
  2551.     else if (cvar == gH_Cvar_LR_KnifeFight_Rebel)
  2552.     {
  2553.         gShadow_LR_KnifeFight_Rebel = StringToInt(newValue);
  2554.     }
  2555.     else if (cvar == gH_Cvar_LR_ChickenFight_Rebel)
  2556.     {
  2557.         gShadow_LR_ChickenFight_Rebel = StringToInt(newValue);
  2558.     }
  2559.     else if (cvar == gH_Cvar_LR_HotPotato_Rebel)
  2560.     {
  2561.         gShadow_LR_HotPotato_Rebel = StringToInt(newValue);
  2562.     }
  2563.     else if (cvar == gH_Cvar_LR_Rebel_MaxTs)
  2564.     {
  2565.         gShadow_LR_Rebel_MaxTs = StringToInt(newValue);
  2566.     }
  2567.     else if (cvar == gH_Cvar_LR_Rebel_MinCTs)
  2568.     {
  2569.         gShadow_LR_Rebel_MinCTs = StringToInt(newValue);
  2570.     }
  2571.     else if (cvar == gH_Cvar_LR_M4M_MagCapacity)
  2572.     {
  2573.         gShadow_LR_M4M_MagCapacity = StringToInt(newValue);
  2574.     }
  2575.     else if (cvar == gH_Cvar_LR_KnifeFight_LowGrav)
  2576.     {
  2577.         gShadow_LR_KnifeFight_LowGrav = StringToFloat(newValue);
  2578.     }
  2579.     else if (cvar == gH_Cvar_LR_KnifeFight_HiSpeed)
  2580.     {
  2581.         gShadow_LR_KnifeFight_HiSpeed = StringToFloat(newValue);
  2582.     }
  2583.     else if (cvar == gH_Cvar_LR_KnifeFight_Drunk)
  2584.     {
  2585.         gShadow_LR_KnifeFight_Drunk = StringToInt(newValue);
  2586.     }
  2587. }
  2588.  
  2589. public ConVarChanged_LastRequest(Handle:cvar, const String:oldValue[], const String:newValue[])
  2590. {
  2591.     // Perform boolean checking
  2592.     new iNewValue = StringToInt(newValue);
  2593.     new iOldValue = StringToInt(oldValue);
  2594.     if (iNewValue == iOldValue || !g_bPushedToMenu)
  2595.     {
  2596.         return;
  2597.     }
  2598.    
  2599.     if (cvar == gH_Cvar_LR_KnifeFight_On)
  2600.     {
  2601.         gShadow_LR_KnifeFight_On = bool:iNewValue;
  2602.         UpdateLastRequestArray(LR_KnifeFight);
  2603.     }
  2604.     else if (cvar == gH_Cvar_LR_Shot4Shot_On)
  2605.     {
  2606.         gShadow_LR_Shot4Shot_On = bool:iNewValue;
  2607.         UpdateLastRequestArray(LR_Shot4Shot);
  2608.     }
  2609.     else if (cvar == gH_Cvar_LR_GunToss_On)
  2610.     {
  2611.         gShadow_LR_GunToss_On = bool:iNewValue;
  2612.         UpdateLastRequestArray(LR_GunToss);
  2613.     }
  2614.     else if (cvar == gH_Cvar_LR_ChickenFight_On)
  2615.     {
  2616.         gShadow_LR_ChickenFight_On = bool:iNewValue;
  2617.         UpdateLastRequestArray(LR_ChickenFight);
  2618.     }
  2619.     else if (cvar == gH_Cvar_LR_HotPotato_On)
  2620.     {
  2621.         gShadow_LR_HotPotato_On = bool:iNewValue;
  2622.         UpdateLastRequestArray(LR_HotPotato);
  2623.     }
  2624.     else if (cvar == gH_Cvar_LR_Dodgeball_On)
  2625.     {
  2626.         gShadow_LR_Dodgeball_On = bool:iNewValue;
  2627.         UpdateLastRequestArray(LR_Dodgeball);
  2628.     }
  2629.     else if (cvar == gH_Cvar_LR_NoScope_On)
  2630.     {
  2631.         gShadow_LR_NoScope_On = bool:iNewValue;
  2632.         UpdateLastRequestArray(LR_NoScope);
  2633.     }
  2634.     else if (cvar == gH_Cvar_LR_RockPaperScissors_On)
  2635.     {
  2636.         gShadow_LR_RockPaperScissors_On = bool:iNewValue;
  2637.         UpdateLastRequestArray(LR_RockPaperScissors);
  2638.     }
  2639.     else if (cvar == gH_Cvar_LR_Rebel_On)
  2640.     {
  2641.         gShadow_LR_Rebel_On = bool:iNewValue;
  2642.         UpdateLastRequestArray(LR_Rebel);
  2643.     }
  2644.     else if (cvar == gH_Cvar_LR_Mag4Mag_On)
  2645.     {
  2646.         gShadow_LR_Mag4Mag_On = bool:iNewValue;
  2647.         UpdateLastRequestArray(LR_Mag4Mag);
  2648.     }
  2649.     else if (cvar == gH_Cvar_LR_Race_On)
  2650.     {
  2651.         gShadow_LR_Race_On = bool:iNewValue;
  2652.         UpdateLastRequestArray(LR_Race);
  2653.     }
  2654.     else if (cvar == gH_Cvar_LR_RussianRoulette_On)
  2655.     {
  2656.         gShadow_LR_RussianRoulette_On = bool:iNewValue;
  2657.         UpdateLastRequestArray(LR_RussianRoulette);
  2658.     }
  2659.     else if (cvar == gH_Cvar_LR_JumpContest_On)
  2660.     {
  2661.         gShadow_LR_JumpContest_On = bool:iNewValue;
  2662.         UpdateLastRequestArray(LR_JumpContest);
  2663.     }
  2664. }
  2665.  
  2666. public Action:Suicide_Check(client, const String:command[], args)
  2667. {
  2668.     if (client && IsClientInGame(client) && Local_IsClientInLR(client))
  2669.     {
  2670.         return Plugin_Handled;
  2671.     }
  2672.     return Plugin_Continue;
  2673. }
  2674.  
  2675. UpdateLastRequestArray(LastRequest:entry)
  2676. {
  2677.     new iArrayIndex = FindValueInArray(gH_DArray_LastRequests, entry);
  2678.     if (iArrayIndex == -1)
  2679.     {
  2680.         new iIndex = PushArrayCell(gH_DArray_LastRequests, entry);
  2681.         SetArrayCell(gH_DArray_LastRequests, iIndex, true, 1);
  2682.     }
  2683.     else
  2684.     {
  2685.         RemoveFromArray(gH_DArray_LastRequests, iArrayIndex);
  2686.     }
  2687. }
  2688.  
  2689. bool:IsLastRequestAutoStart(LastRequest:game)
  2690. {
  2691.     new iArrayIndex = FindValueInArray(gH_DArray_LastRequests, game);
  2692.     if (iArrayIndex == -1)
  2693.     {
  2694.         return false;
  2695.     }
  2696.     else
  2697.     {
  2698.         return bool:GetArrayCell(gH_DArray_LastRequests, iArrayIndex, 1);
  2699.     }
  2700. }
  2701.  
  2702. LastRequest_ClientPutInServer(client)
  2703. {
  2704.     SDKHook(client, SDKHook_WeaponDrop, OnWeaponDrop);
  2705.     SDKHook(client, SDKHook_WeaponEquip, OnWeaponEquip);
  2706.     SDKHook(client, SDKHook_WeaponCanUse, OnWeaponDecideUse);
  2707.     SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
  2708. }
  2709.  
  2710. public Action:Command_LastRequest(client, args)
  2711. {
  2712.     if (gShadow_LR_Enable)
  2713.     {
  2714.         if (g_bIsLRAvailable)
  2715.         {
  2716.             if (!g_bInLastRequest[client])
  2717.             {
  2718.                 if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  2719.                 {
  2720.                     if (g_bIsARebel[client] && !gShadow_RebelHandling)
  2721.                     {
  2722.                         PrintToChat(client, CHAT_BANNER, "LR Rebel Not Allowed");
  2723.                     }
  2724.                     else
  2725.                     {
  2726.                         // check the number of terrorists still alive
  2727.                         new Ts, CTs, NumCTsAvailable;
  2728.                         UpdatePlayerCounts(Ts, CTs, NumCTsAvailable);
  2729.  
  2730.                         if (Ts <= gShadow_MaxPrisonersToLR || gShadow_MaxPrisonersToLR == 0)
  2731.                         {
  2732.                             if (CTs > 0)
  2733.                             {
  2734.                                 if (NumCTsAvailable > 0)
  2735.                                 {
  2736.                                     DisplayLastRequestMenu(client, Ts, CTs);
  2737.                                 }
  2738.                                 else
  2739.                                 {
  2740.                                     PrintToChat(client, "No CTs Are Available");
  2741.                                 }
  2742.                             }
  2743.                             else
  2744.                             {
  2745.                                 PrintToChat(client, CHAT_BANNER, "No CTs Alive");
  2746.                             }
  2747.                         }
  2748.                         else
  2749.                         {
  2750.                             PrintToChat(client, CHAT_BANNER, "Too Many Ts");
  2751.                         }
  2752.                     }
  2753.                 }
  2754.                 else
  2755.                 {
  2756.                     PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  2757.                 }
  2758.             }
  2759.             else
  2760.             {
  2761.                 PrintToChat(client, CHAT_BANNER, "Another LR In Progress");
  2762.             }
  2763.         }
  2764.         else
  2765.         {
  2766.             PrintToChat(client, CHAT_BANNER, "LR Not Available");
  2767.         }
  2768.     }
  2769.     else
  2770.     {
  2771.         PrintToChat(client, CHAT_BANNER, "LR Not Available");
  2772.     }
  2773.  
  2774.     return Plugin_Handled;
  2775. }
  2776.  
  2777. DisplayLastRequestMenu(client, Ts, CTs)
  2778. {
  2779.     gH_BuildLR[client] = CreateDataPack();
  2780.     new Handle:menu = CreateMenu(LR_Selection_Handler);
  2781.     SetMenuTitle(menu, "%T", "LR Choose", client);
  2782.    
  2783.     decl String:sDataField[MAX_DATAENTRY_SIZE];
  2784.     decl String:sTitleField[MAX_DISPLAYNAME_SIZE];
  2785.     new LastRequest:entry; 
  2786.     new iLR_ArraySize = GetArraySize(gH_DArray_LastRequests);
  2787.     new iCustomCount = 0;
  2788.     new iCustomLR_Size = GetArraySize(gH_DArray_LR_CustomNames);
  2789.     for (new iLR_Index = 0; iLR_Index < iLR_ArraySize; iLR_Index++)
  2790.     {
  2791.         entry = GetArrayCell(gH_DArray_LastRequests, iLR_Index);
  2792.         if (entry < LastRequest)
  2793.         {
  2794.             if (LastRequest:entry != LR_Rebel || (LastRequest:entry == LR_Rebel && Ts <= gShadow_LR_Rebel_MaxTs && CTs >= gShadow_LR_Rebel_MinCTs))
  2795.             {
  2796.                 Format(sDataField, sizeof(sDataField), "%d", entry);
  2797.                 Format(sTitleField, sizeof(sTitleField), "%T", g_sLastRequestPhrase[entry], client);
  2798.                 AddMenuItem(menu, sDataField, sTitleField);
  2799.             }
  2800.         }
  2801.         else
  2802.         {
  2803.             if (iCustomCount < iCustomLR_Size)
  2804.             {
  2805.                 Format(sDataField, sizeof(sDataField), "%d", entry);
  2806.                 GetArrayString(gH_DArray_LR_CustomNames, iCustomCount, sTitleField, MAX_DISPLAYNAME_SIZE);
  2807.                 AddMenuItem(menu, sDataField, sTitleField);
  2808.                 iCustomCount++;
  2809.             }
  2810.         }
  2811.     }
  2812.    
  2813.     SetMenuExitButton(menu, gShadow_LR_KillTimeouts ? false : true);
  2814.     DisplayMenu(menu, client, gShadow_LR_MenuTime);
  2815. }
  2816.  
  2817. public LR_Selection_Handler(Handle:menu, MenuAction:action, client, iButtonChoice)
  2818. {
  2819.     switch (action)
  2820.     {
  2821.         case MenuAction_Select:
  2822.         {
  2823.             if (g_bIsLRAvailable)
  2824.             {
  2825.                 if (!g_bInLastRequest[client])
  2826.                 {
  2827.                     if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  2828.                     {
  2829.                         decl String:sData[MAX_DATAENTRY_SIZE];
  2830.                         GetMenuItem(menu, iButtonChoice, sData, sizeof(sData));
  2831.                         new LastRequest:choice = LastRequest:StringToInt(sData);
  2832.                         g_LRLookup[client] = choice;
  2833.                        
  2834.                         switch (choice)
  2835.                         {
  2836.                             case LR_KnifeFight:
  2837.                             {
  2838.                                 new Handle:KnifeFightMenu = CreateMenu(SubLRType_MenuHandler);                             
  2839.                                 SetMenuTitle(KnifeFightMenu, "%T", "Knife Fight Selection Menu", client);
  2840.                                
  2841.                                 decl String:sSubTypeName[MAX_DISPLAYNAME_SIZE];
  2842.                                 decl String:sDataField[MAX_DATAENTRY_SIZE];
  2843.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_Vintage);
  2844.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_Vintage", client);
  2845.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2846.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_Drunk);
  2847.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_Drunk", client);
  2848.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2849.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_LowGrav);
  2850.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_LowGrav", client);
  2851.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2852.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_HiSpeed);
  2853.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_HiSpeed", client);
  2854.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2855.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_Drugs);
  2856.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_Drugs", client);
  2857.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2858.                                 Format(sDataField, sizeof(sDataField), "%d", Knife_ThirdPerson);
  2859.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Knife_ThirdPerson", client);
  2860.                                 AddMenuItem(KnifeFightMenu, sDataField, sSubTypeName);
  2861.                                
  2862.                                 SetMenuExitBackButton(KnifeFightMenu, true);
  2863.                                 DisplayMenu(KnifeFightMenu, client, 10);
  2864.                             }
  2865.                             case LR_Shot4Shot, LR_Mag4Mag:
  2866.                             {
  2867.                                 new Handle:SubWeaponMenu = CreateMenu(SubLRType_MenuHandler);
  2868.                                 SetMenuTitle(SubWeaponMenu, "%T", "Pistol Selection Menu", client);
  2869.                                
  2870.                                 decl String:sSubTypeName[MAX_DISPLAYNAME_SIZE];
  2871.                                 decl String:sDataField[MAX_DATAENTRY_SIZE];
  2872.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_Deagle);
  2873.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_Deagle", client);
  2874.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);
  2875.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_P228);
  2876.                                 if (g_Game == Game_CSS)
  2877.                                 {
  2878.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_P228", client);
  2879.                                 }
  2880.                                 else if (g_Game == Game_CSGO)
  2881.                                 {
  2882.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_P250", client);
  2883.                                 }
  2884.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);                              
  2885.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_Glock);
  2886.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_Glock", client);
  2887.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);      
  2888.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_FiveSeven);
  2889.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_FiveSeven", client);
  2890.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);      
  2891.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_Dualies);
  2892.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_Dualies", client);
  2893.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);      
  2894.                                 Format(sDataField, sizeof(sDataField), "%d", Pistol_USP);
  2895.                                 if (g_Game == Game_CSS)
  2896.                                 {
  2897.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_USP", client);
  2898.                                 }
  2899.                                 else if (g_Game == Game_CSGO)
  2900.                                 {
  2901.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_P2000", client);
  2902.                                 }
  2903.                                 AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);
  2904.                                 if (g_Game == Game_CSGO)
  2905.                                 {
  2906.                                     Format(sDataField, sizeof(sDataField), "%d", Pistol_Tec9);
  2907.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Pistol_Tec9", client);
  2908.                                     AddMenuItem(SubWeaponMenu, sDataField, sSubTypeName);
  2909.                                 }
  2910.                                
  2911.                                 SetMenuExitBackButton(SubWeaponMenu, true);
  2912.                                 DisplayMenu(SubWeaponMenu, client, 10);
  2913.                             }                  
  2914.                             case LR_NoScope:
  2915.                             {
  2916.                                 if (gShadow_LR_NoScope_Weapon == 2)
  2917.                                 {
  2918.                                     new Handle:NSweaponMenu = CreateMenu(SubLRType_MenuHandler);
  2919.                                     SetMenuTitle(NSweaponMenu, "%T", "NS Weapon Chooser Menu", client);
  2920.  
  2921.                                     decl String:sSubTypeName[MAX_DISPLAYNAME_SIZE];
  2922.                                     decl String:sDataField[MAX_DATAENTRY_SIZE];
  2923.                                     Format(sDataField, sizeof(sDataField), "%d", NSW_AWP);
  2924.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_AWP", client);   
  2925.                                     AddMenuItem(NSweaponMenu, sDataField, sSubTypeName);
  2926.                                     Format(sDataField, sizeof(sDataField), "%d", NSW_Scout);
  2927.                                     if (g_Game == Game_CSS)
  2928.                                     {
  2929.                                         Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_Scout", client);
  2930.                                     }
  2931.                                     else if (g_Game == Game_CSGO)
  2932.                                     {
  2933.                                         Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_SSG08", client);
  2934.                                     }
  2935.                                     AddMenuItem(NSweaponMenu, sDataField, sSubTypeName);
  2936.                                     Format(sDataField, sizeof(sDataField), "%d", NSW_SG550);
  2937.                                     if (g_Game == Game_CSS)
  2938.                                     {
  2939.                                         Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_SG550", client);
  2940.                                     }
  2941.                                     else if (g_Game == Game_CSGO)
  2942.                                     {
  2943.                                         Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_SCAR20", client);
  2944.                                     }
  2945.                                     AddMenuItem(NSweaponMenu, sDataField, sSubTypeName);
  2946.                                     Format(sDataField, sizeof(sDataField), "%d", NSW_G3SG1);
  2947.                                     Format(sSubTypeName, sizeof(sSubTypeName), "%T", "NSW_G3SG1", client)
  2948.                                     AddMenuItem(NSweaponMenu, sDataField, sSubTypeName);
  2949.            
  2950.                                     SetMenuExitButton(NSweaponMenu, true);
  2951.                                     DisplayMenu(NSweaponMenu, client, 10);                     
  2952.                                 }
  2953.                                 else
  2954.                                 {
  2955.                                     CreateMainPlayerHandler(client);
  2956.                                 }
  2957.                             }
  2958.                             case LR_Race:
  2959.                             {                              
  2960.                                 // create menu for T to choose start point
  2961.                                 new Handle:racemenu1 = CreateMenu(RaceStartPointHandler);
  2962.                                 SetMenuTitle(racemenu1, "%T", "Find a Starting Location", client);
  2963.                                 decl String:sMenuText[MAX_DISPLAYNAME_SIZE];
  2964.                                 Format(sMenuText, sizeof(sMenuText), "%T", "Use Current Position", client);
  2965.                                 AddMenuItem(racemenu1, "startloc", sMenuText);
  2966.                                 SetMenuExitButton(racemenu1, true);
  2967.                                 DisplayMenu(racemenu1, client, MENU_TIME_FOREVER);                     
  2968.                                
  2969.                                 if (gShadow_LR_Race_NotifyCTs)
  2970.                                 {
  2971.                                     for (new idx = 1; idx <= MaxClients; idx++)
  2972.                                     {
  2973.                                         if (IsClientInGame(idx) && IsPlayerAlive(idx) && (GetClientTeam(idx) == CS_TEAM_CT))
  2974.                                         {
  2975.                                             PrintToChat(idx, CHAT_BANNER, "Race Could Start Soon", client);
  2976.                                         }
  2977.                                     }
  2978.                                 }
  2979.                                
  2980.                                 #if 0
  2981.                                 // Add trail
  2982.                                 #endif
  2983.                                
  2984.                             }
  2985.                             case LR_Rebel:
  2986.                             {
  2987.                                 new LastRequest:gametype = g_LRLookup[client];
  2988.                                 new iArrayIndex = PushArrayCell(gH_DArray_LR_Partners, gametype);
  2989.                                 SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, client, _:Block_Prisoner);
  2990.                                 SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, client, _:Block_Guard);
  2991.                                 g_bInLastRequest[client] = true;
  2992.                                 g_bIsARebel[client] = true;
  2993.                                 InitializeGame(iArrayIndex);           
  2994.                             }
  2995.                             case LR_JumpContest:
  2996.                             {
  2997.                                 new Handle:SubJumpMenu = CreateMenu(SubLRType_MenuHandler);
  2998.                                 SetMenuTitle(SubJumpMenu, "%T", "Jump Contest Menu", client);
  2999.                                
  3000.                                 decl String:sSubTypeName[MAX_DISPLAYNAME_SIZE];
  3001.                                 decl String:sDataField[MAX_DATAENTRY_SIZE];
  3002.                                
  3003.                                 Format(sDataField, sizeof(sDataField), "%d", Jump_TheMost);
  3004.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Jump_TheMost", client);
  3005.                                 AddMenuItem(SubJumpMenu, sDataField, sSubTypeName);
  3006.                                 Format(sDataField, sizeof(sDataField), "%d", Jump_Farthest);
  3007.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Jump_Farthest", client);
  3008.                                 AddMenuItem(SubJumpMenu, sDataField, sSubTypeName);                            
  3009.                                 Format(sDataField, sizeof(sDataField), "%d", Jump_BrinkOfDeath);
  3010.                                 Format(sSubTypeName, sizeof(sSubTypeName), "%T", "Jump_BrinkOfDeath", client);
  3011.                                 AddMenuItem(SubJumpMenu, sDataField, sSubTypeName);    
  3012.                                
  3013.                                 SetMenuExitBackButton(SubJumpMenu, true);
  3014.                                 DisplayMenu(SubJumpMenu, client, 10);                          
  3015.                             }
  3016.                             default:
  3017.                             {
  3018.                                 CreateMainPlayerHandler(client);
  3019.                             }
  3020.                         }
  3021.                     }
  3022.                     else
  3023.                     {
  3024.                         PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3025.                     }
  3026.                 }
  3027.                 else
  3028.                 {
  3029.                     PrintToChat(client, CHAT_BANNER, "Another LR In Progress");
  3030.                 }
  3031.             }
  3032.             else
  3033.             {
  3034.                 PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3035.             }
  3036.         }
  3037.         case MenuAction_End:
  3038.         {
  3039.             if (client > 0 && client < MAXPLAYERS+1)
  3040.             {
  3041.                 if (gH_BuildLR[client] != INVALID_HANDLE)
  3042.                 {
  3043.                     CloseHandle(gH_BuildLR[client]);
  3044.                     gH_BuildLR[client] = INVALID_HANDLE;
  3045.                 }
  3046.             }
  3047.             CloseHandle(menu);
  3048.         }
  3049.         case MenuAction_Cancel:
  3050.         {
  3051.             if (gShadow_LR_KillTimeouts)
  3052.             {
  3053.                 ForcePlayerSuicide(client);
  3054.             }
  3055.         }
  3056.     }
  3057. }
  3058.  
  3059. CreateMainPlayerHandler(client)
  3060. {
  3061.     new Handle:playermenu = CreateMenu(MainPlayerHandler);
  3062.     SetMenuTitle(playermenu, "%T", "Choose A Player", client);
  3063.  
  3064.     new iNumCTsAvailable = 0;
  3065.     new iUserId = 0;
  3066.     decl String:sClientName[MAX_DISPLAYNAME_SIZE];
  3067.     decl String:sDataField[MAX_DATAENTRY_SIZE];
  3068.     for(new i = 1; i <= MaxClients; i++)
  3069.     {
  3070.         // if player is alive and CT and not in another LR
  3071.         if (IsClientInGame(i) && IsPlayerAlive(i) && (GetClientTeam(i) == CS_TEAM_CT) && !g_bInLastRequest[i])
  3072.         {
  3073.             Format(sClientName, sizeof(sClientName), "%N", i);
  3074.             iUserId = GetClientUserId(i);
  3075.             Format(sDataField, sizeof(sDataField), "%d", iUserId);
  3076.             AddMenuItem(playermenu, sDataField, sClientName);
  3077.             iNumCTsAvailable++;
  3078.         }
  3079.     }
  3080.  
  3081.     if (iNumCTsAvailable == 0)
  3082.     {
  3083.         PrintToChat(client, CHAT_BANNER, "LR No CTs Available");
  3084.         if (client > 0 && client < MAXPLAYERS+1)
  3085.         {
  3086.             if (gH_BuildLR[client] != INVALID_HANDLE)
  3087.             {
  3088.                 CloseHandle(gH_BuildLR[client]);
  3089.                 gH_BuildLR[client] = INVALID_HANDLE;
  3090.             }
  3091.         }
  3092.         CloseHandle(playermenu);
  3093.     }
  3094.     else
  3095.     {
  3096.         SetMenuExitButton(playermenu, true);
  3097.         DisplayMenu(playermenu, client, gShadow_LR_MenuTime);
  3098.     }
  3099. }
  3100.  
  3101. public SubLRType_MenuHandler(Handle:SelectionMenu, MenuAction:action, client, iMenuChoice)
  3102. {
  3103.     if (action == MenuAction_Select)
  3104.     {
  3105.         if (g_bIsLRAvailable)
  3106.         {
  3107.             if (!g_bInLastRequest[client])
  3108.             {
  3109.                 if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  3110.                 {
  3111.                     WritePackCell(gH_BuildLR[client], iMenuChoice);
  3112.                     CreateMainPlayerHandler(client);
  3113.                 }
  3114.                 else
  3115.                 {
  3116.                     PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3117.                 }
  3118.             }
  3119.             else
  3120.             {
  3121.                 PrintToChat(client, CHAT_BANNER, "Too Slow Another LR In Progress");
  3122.             }
  3123.         }
  3124.         else
  3125.         {
  3126.             PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3127.         }
  3128.     }
  3129.     else if (action == MenuAction_End)
  3130.     {
  3131.         if (client > 0 && client < MAXPLAYERS+1)
  3132.         {
  3133.             if (gH_BuildLR[client] != INVALID_HANDLE)
  3134.             {
  3135.                 CloseHandle(gH_BuildLR[client]);
  3136.                 gH_BuildLR[client] = INVALID_HANDLE;
  3137.             }
  3138.         }
  3139.         CloseHandle(SelectionMenu);
  3140.     }
  3141. }
  3142.  
  3143. public RaceEndPointHandler(Handle:menu, MenuAction:action, client, param2)
  3144. {
  3145.     if (action == MenuAction_Select)
  3146.     {
  3147.         if (g_bIsLRAvailable)
  3148.         {
  3149.             if (!g_bInLastRequest[client])
  3150.             {
  3151.                 if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  3152.                 {
  3153.                     if (gShadow_LR_Race_AirPoints || (GetEntityFlags(client) & FL_ONGROUND))
  3154.                     {
  3155.                         // use this location
  3156.                         new Float:f_EndLocation[3];
  3157.                         GetClientAbsOrigin(client, f_EndLocation);
  3158.                         f_EndLocation[2] += 10;
  3159.                        
  3160.                         WritePackFloat(gH_BuildLR[client], f_EndLocation[0]);
  3161.                         WritePackFloat(gH_BuildLR[client], f_EndLocation[1]);
  3162.                         WritePackFloat(gH_BuildLR[client], f_EndLocation[2]);
  3163.                        
  3164.                         // get start location
  3165.                         new Float:f_StartLocation[3];
  3166.                         ResetPack(gH_BuildLR[client]);
  3167.                         f_StartLocation[0] = ReadPackFloat(gH_BuildLR[client]);
  3168.                         f_StartLocation[1] = ReadPackFloat(gH_BuildLR[client]);
  3169.                         f_StartLocation[2] = ReadPackFloat(gH_BuildLR[client]);
  3170.                        
  3171.                         // check how far the requested end is from the start
  3172.                         new Float:distanceBetweenPoints = GetVectorDistance(f_StartLocation, f_EndLocation, false);
  3173.                        
  3174.                         if (distanceBetweenPoints > 300.0)
  3175.                         {
  3176.                             TE_SetupBeamRingPoint(f_EndLocation, 100.0, 130.0, BeamSprite, HaloSprite, 0, 15, 20.0, 7.0, 0.0, greenColor, 1, 0);
  3177.                             TE_SendToAll();                    
  3178.                             // allow them to choose a player finally
  3179.                             CreateMainPlayerHandler(client);
  3180.                         }
  3181.                         else
  3182.                         {
  3183.                             PrintToChat(client, CHAT_BANNER, "Race Points too Close");
  3184.                         }
  3185.                     }
  3186.                     else
  3187.                     {
  3188.                         PrintToChat(client, CHAT_BANNER, "Must Be On Ground");
  3189.                     }
  3190.                 }
  3191.                 else
  3192.                 {
  3193.                     PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3194.                 }
  3195.             }
  3196.             else
  3197.             {
  3198.                 PrintToChat(client, CHAT_BANNER, "Too Slow Another LR In Progress");
  3199.             }
  3200.         }
  3201.         else
  3202.         {
  3203.             PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3204.         }
  3205.     }
  3206.     else if (action == MenuAction_End)
  3207.     {
  3208.         if (client > 0 && client < MAXPLAYERS+1)
  3209.         {
  3210.             if (gH_BuildLR[client] != INVALID_HANDLE)
  3211.             {
  3212.                 CloseHandle(gH_BuildLR[client]);
  3213.                 gH_BuildLR[client] = INVALID_HANDLE;
  3214.             }
  3215.         }
  3216.         CloseHandle(menu);
  3217.     }
  3218. }
  3219.  
  3220. public RaceStartPointHandler(Handle:menu, MenuAction:action, client, param2)
  3221. {
  3222.     if (action == MenuAction_Select)
  3223.     {
  3224.         if (g_bIsLRAvailable)
  3225.         {
  3226.             if (!g_bInLastRequest[client])
  3227.             {
  3228.                 if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  3229.                 {
  3230.                     if (gShadow_LR_Race_AirPoints || (GetEntityFlags(client) & FL_ONGROUND))
  3231.                     {
  3232.                         // use this location
  3233.                         new Float:f_StartPoint[3];
  3234.                         GetClientAbsOrigin(client, f_StartPoint);
  3235.                         f_StartPoint[2] += 10;
  3236.  
  3237.                         TE_SetupBeamRingPoint(f_StartPoint, 100.0, 130.0, BeamSprite, HaloSprite, 0, 15, 30.0, 7.0, 0.0, yellowColor, 1, 0);
  3238.                         TE_SendToAll();
  3239.                        
  3240.                         // write start point
  3241.                         WritePackFloat(gH_BuildLR[client], f_StartPoint[0]);
  3242.                         WritePackFloat(gH_BuildLR[client], f_StartPoint[1]);
  3243.                         WritePackFloat(gH_BuildLR[client], f_StartPoint[2]);
  3244.                        
  3245.                         CreateRaceEndPointMenu(client);
  3246.                     }
  3247.                     else
  3248.                     {
  3249.                         PrintToChat(client, CHAT_BANNER, "Must Be On Ground");
  3250.                     }
  3251.                 }
  3252.                 else
  3253.                 {
  3254.                     PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3255.                 }
  3256.             }
  3257.             else
  3258.             {
  3259.                 PrintToChat(client, CHAT_BANNER, "Too Slow Another LR In Progress");
  3260.             }
  3261.         }
  3262.         else
  3263.         {
  3264.             PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3265.         }
  3266.     }
  3267.     else if (action == MenuAction_End)
  3268.     {
  3269.         if (client > 0 && client < MAXPLAYERS+1)
  3270.         {
  3271.             if (gH_BuildLR[client] != INVALID_HANDLE)
  3272.             {
  3273.                 CloseHandle(gH_BuildLR[client]);
  3274.                 gH_BuildLR[client] = INVALID_HANDLE;
  3275.             }
  3276.         }
  3277.         CloseHandle(menu);
  3278.     }
  3279. }
  3280.  
  3281. CreateRaceEndPointMenu(client)
  3282. {
  3283.     new Handle:EndPointMenu = CreateMenu(RaceEndPointHandler);
  3284.     SetMenuTitle(EndPointMenu, "%T", "Choose an End Point", client);
  3285.     decl String:sMenuText[MAX_DISPLAYNAME_SIZE];
  3286.     Format (sMenuText, sizeof(sMenuText), "%T", "Use Current Position", client);
  3287.     AddMenuItem(EndPointMenu, "endpoint", sMenuText);
  3288.     SetMenuExitButton(EndPointMenu, true);
  3289.     DisplayMenu(EndPointMenu, client, MENU_TIME_FOREVER);
  3290. }
  3291.  
  3292. public MainPlayerHandler(Handle:playermenu, MenuAction:action, client, iButtonChoice)
  3293. {
  3294.     switch (action)
  3295.     {
  3296.         case MenuAction_Select:
  3297.         {
  3298.             if (g_bIsLRAvailable)
  3299.             {
  3300.                 if (!g_bInLastRequest[client])
  3301.                 {
  3302.                     if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_T))
  3303.                     {
  3304.                         decl String:sData[MAX_DATAENTRY_SIZE];
  3305.                         GetMenuItem(playermenu, iButtonChoice, sData, sizeof(sData));
  3306.                         new ClientIdxOfCT = GetClientOfUserId(StringToInt(sData));
  3307.                        
  3308.                         if (ClientIdxOfCT && IsClientInGame(ClientIdxOfCT) && IsPlayerAlive(ClientIdxOfCT) && (GetClientTeam(ClientIdxOfCT) == CS_TEAM_CT))
  3309.                         {
  3310.                             // check the number of terrorists still alive
  3311.                             new Ts, CTs, iNumCTsAvailable;
  3312.                             UpdatePlayerCounts(Ts, CTs, iNumCTsAvailable);
  3313.                            
  3314.                             if (Ts <= gShadow_MaxPrisonersToLR || gShadow_MaxPrisonersToLR == 0)
  3315.                             {
  3316.                                 if (CTs > 0)
  3317.                                 {
  3318.                                     if (iNumCTsAvailable > 0)
  3319.                                     {
  3320.                                         if (!IsFakeClient(ClientIdxOfCT))
  3321.                                         {
  3322.                                             if (!g_bIsARebel[client] || (gShadow_RebelHandling == 2))
  3323.                                             {
  3324.                                                 if (!g_bInLastRequest[ClientIdxOfCT])
  3325.                                                 {
  3326.                                                     new LastRequest:game = g_LRLookup[client];
  3327.                                                     if ((game == LR_HotPotato || game == LR_RussianRoulette) && IsClientTooNearObstacle(client))
  3328.                                                     {
  3329.                                                         PrintToChat(client, CHAT_BANNER, "Too Near Obstruction");
  3330.                                                     }
  3331.                                                     // player isn't on ground
  3332.                                                     else if ((game == LR_JumpContest) && !(GetEntityFlags(client) & FL_ONGROUND|FL_INWATER))
  3333.                                                     {
  3334.                                                         PrintToChat(client, CHAT_BANNER, "Must Be On Ground");
  3335.                                                     }
  3336.                                                     // make sure they're not ducked
  3337.                                                     else if ((game == LR_JumpContest) && (GetEntityFlags(client) & FL_DUCKING))
  3338.                                                     {
  3339.                                                         PrintToChat(client, CHAT_BANNER, "Too Near Obstruction");
  3340.                                                     }
  3341.                                                     else if (IsLastRequestAutoStart(game))
  3342.                                                     {
  3343.                                                         // lock in this LR pair
  3344.                                                         new iArrayIndex = PushArrayCell(gH_DArray_LR_Partners, game);
  3345.                                                         SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, client, _:Block_Prisoner);
  3346.                                                         SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, ClientIdxOfCT, _:Block_Guard);
  3347.                                                         g_bInLastRequest[client] = true;
  3348.                                                         g_bInLastRequest[ClientIdxOfCT] = true;
  3349.                                                         InitializeGame(iArrayIndex);
  3350.                                                     }
  3351.                                                     else
  3352.                                                     {
  3353.                                                         new iArrayIndex = PushArrayCell(gH_DArray_LR_Partners, game);
  3354.                                                         SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, client, _:Block_Prisoner);
  3355.                                                         SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, ClientIdxOfCT, _:Block_Guard);
  3356.                                                         InitializeGame(iArrayIndex);
  3357.                                                     }
  3358.                                                 }
  3359.                                                 else
  3360.                                                 {
  3361.                                                     PrintToChat(client, CHAT_BANNER, "Another LR In Progress");
  3362.                                                 }
  3363.                                             }
  3364.                                             else
  3365.                                             {
  3366.                                                 // if rebel, send a menu to the CT asking for permission
  3367.                                                 new Handle:askmenu = CreateMenu(MainAskHandler);
  3368.                                                 decl String:lrname[MAX_DISPLAYNAME_SIZE];
  3369.                                                 if (g_LRLookup[client] < LastRequest)
  3370.                                                 {
  3371.                                                     Format(lrname, sizeof(lrname), "%T", g_sLastRequestPhrase[g_LRLookup[client]], ClientIdxOfCT);     
  3372.                                                 }
  3373.                                                 else
  3374.                                                 {
  3375.                                                     GetArrayString(gH_DArray_LR_CustomNames, _:(g_LRLookup[client] - LastRequest), lrname, MAX_DISPLAYNAME_SIZE);
  3376.                                                 }
  3377.                                                 SetMenuTitle(askmenu, "%T", "Rebel Ask CT For LR", ClientIdxOfCT, client, lrname);
  3378.        
  3379.                                                 decl String:yes[8];
  3380.                                                 decl String:no[8];
  3381.                                                 Format(yes, sizeof(yes), "%T", "Yes", ClientIdxOfCT);
  3382.                                                 Format(no, sizeof(no), "%T", "No", ClientIdxOfCT);
  3383.                                                 AddMenuItem(askmenu, "yes", yes);
  3384.                                                 AddMenuItem(askmenu, "no", no);
  3385.        
  3386.                                                 g_LR_PermissionLookup[ClientIdxOfCT] = client;
  3387.                                                 SetMenuExitButton(askmenu, true);
  3388.                                                 DisplayMenu(askmenu, ClientIdxOfCT, 6);
  3389.        
  3390.                                                 PrintToChat(client, CHAT_BANNER, "Asking For Permission", ClientIdxOfCT);
  3391.                                             }
  3392.                                         }
  3393.                                         else
  3394.                                         {
  3395.                                             PrintToChat(client, CHAT_BANNER, "LR Not With Bot");
  3396.                                         }
  3397.                                     }
  3398.                                     else
  3399.                                     {
  3400.                                         PrintToChat(client, "LR No CTs Available");
  3401.                                     }
  3402.                                 }
  3403.                                 else
  3404.                                 {
  3405.                                     PrintToChat(client, CHAT_BANNER, "No CTs Alive");
  3406.                                 }
  3407.                             }
  3408.                             else
  3409.                             {
  3410.                                 PrintToChat(client, CHAT_BANNER, "Too Many Ts");
  3411.                             }
  3412.                         }
  3413.                         else
  3414.                         {
  3415.                             PrintToChat(client, CHAT_BANNER, "Target Is Not Alive Or In Wrong Team");
  3416.                         }
  3417.                     }
  3418.                     else
  3419.                     {
  3420.                         PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3421.                     }
  3422.                 }
  3423.                 else
  3424.                 {
  3425.                     PrintToChat(client, CHAT_BANNER, "Another LR In Progress");
  3426.                 }
  3427.             }
  3428.             else
  3429.             {
  3430.                 PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3431.             }  
  3432.         }
  3433.         case MenuAction_End:
  3434.         {
  3435.             if (client > 0 && client < MAXPLAYERS+1)
  3436.             {
  3437.                 if (gH_BuildLR[client] != INVALID_HANDLE)
  3438.                 {
  3439.                     CloseHandle(gH_BuildLR[client]);
  3440.                     gH_BuildLR[client] = INVALID_HANDLE;
  3441.                 }
  3442.             }
  3443.             CloseHandle(playermenu);
  3444.         }
  3445.     }
  3446. }
  3447.  
  3448. public MainAskHandler(Handle:askmenu, MenuAction:action, client, param2)
  3449. {
  3450.     switch (action)
  3451.     {
  3452.         case MenuAction_Select:
  3453.         {
  3454.             if (g_bIsLRAvailable)
  3455.             {
  3456.                 // client here is the guard
  3457.                 if (!g_bInLastRequest[g_LR_PermissionLookup[client]])
  3458.                 {
  3459.                     if ((IsClientInGame(g_LR_PermissionLookup[client])) && (IsPlayerAlive(g_LR_PermissionLookup[client])))
  3460.                     {
  3461.                         if (IsPlayerAlive(client) && (GetClientTeam(client) == CS_TEAM_CT))
  3462.                         {
  3463.                             // param2, 0 -> yes
  3464.                             if (param2 == 0 || (client != 0 && IsFakeClient(client)) )
  3465.                             {
  3466.                                 if (!g_bInLastRequest[client])
  3467.                                 {
  3468.                                     new LastRequest:game = g_LRLookup[g_LR_PermissionLookup[client]];
  3469.                                    
  3470.                                     // lock in this LR pair
  3471.                                     new iArrayIndex = PushArrayCell(gH_DArray_LR_Partners, game);
  3472.                                     SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, g_LR_PermissionLookup[client], _:Block_Prisoner);
  3473.                                     SetArrayCell(gH_DArray_LR_Partners, iArrayIndex, client, _:Block_Guard);
  3474.                                     InitializeGame(iArrayIndex);
  3475.                                    
  3476.                                     if(IsLastRequestAutoStart(game))
  3477.                                     {
  3478.                                         g_bInLastRequest[client] = true;
  3479.                                         g_bInLastRequest[g_LR_PermissionLookup[client]] = true;
  3480.                                     }
  3481.                                 }
  3482.                                 else
  3483.                                 {
  3484.                                     PrintToChat(client, CHAT_BANNER, "Too Slow Another LR In Progress");
  3485.                                 }
  3486.                             }
  3487.                             else
  3488.                             {
  3489.                                 PrintToChat(g_LR_PermissionLookup[client], CHAT_BANNER, "Declined LR Request", client);
  3490.                             }
  3491.                         }
  3492.                         else
  3493.                         {
  3494.                             PrintToChat(client, CHAT_BANNER, "Not Alive Or In Wrong Team");
  3495.                         }
  3496.                     }
  3497.                     else
  3498.                     {
  3499.                         PrintToChat(client, CHAT_BANNER, "LR Partner Died");
  3500.                     }
  3501.                 }
  3502.                 else
  3503.                 {
  3504.                     PrintToChat(client, CHAT_BANNER, "Too Slow Another LR In Progress");
  3505.                 }
  3506.             }
  3507.             else
  3508.             {
  3509.                 PrintToChat(client, CHAT_BANNER, "LR Not Available");
  3510.             }
  3511.         }
  3512.         case MenuAction_Cancel:
  3513.         {
  3514.             if (IsClientInGame(g_LR_PermissionLookup[client]))
  3515.             {
  3516.                 PrintToChat(g_LR_PermissionLookup[client], CHAT_BANNER, "LR Request Decline Or Too Long", client);
  3517.             }
  3518.         }
  3519.         case MenuAction_End:
  3520.         {
  3521.             if (client > 0 && client < MAXPLAYERS+1)
  3522.             {
  3523.                 if (gH_BuildLR[g_LR_PermissionLookup[client]] != INVALID_HANDLE)
  3524.                 {
  3525.                     CloseHandle(gH_BuildLR[g_LR_PermissionLookup[client]]);
  3526.                     gH_BuildLR[g_LR_PermissionLookup[client]] = INVALID_HANDLE;
  3527.                 }
  3528.             }
  3529.             CloseHandle(askmenu);
  3530.         }
  3531.     }
  3532. }
  3533.  
  3534. InitializeGame(iPartnersIndex)
  3535. {
  3536.     // grab the info
  3537.     new LastRequest:selection = GetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, _:Block_LRType);
  3538.     new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, _:Block_Prisoner);
  3539.     new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, _:Block_Guard);
  3540.    
  3541.     // log the event for stats engines
  3542.     if (selection < LastRequest)
  3543.     {
  3544.         LogToGame("\"%L\" started a LR game (\"%s\") with \"%L\"", LR_Player_Prisoner, g_sLastRequestPhrase[selection], LR_Player_Guard);
  3545.     }
  3546.     else
  3547.     {
  3548.         decl String:LR_Name[MAX_DISPLAYNAME_SIZE];
  3549.         GetArrayString(gH_DArray_LR_CustomNames, _:(selection - LastRequest), LR_Name, MAX_DISPLAYNAME_SIZE);
  3550.         LogToGame("\"%L\" started a LR game (\"%s\") with \"%L\"", LR_Player_Prisoner, LR_Name, LR_Player_Guard);
  3551.     }
  3552.    
  3553.     switch (selection)
  3554.     {
  3555.         case LR_KnifeFight:
  3556.         {
  3557.             StripAllWeapons(LR_Player_Prisoner);
  3558.             StripAllWeapons(LR_Player_Guard);
  3559.  
  3560.             new KnifeType:KnifeChoice;
  3561.             ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  3562.             KnifeChoice = KnifeType:ReadPackCell(gH_BuildLR[LR_Player_Prisoner]);
  3563.            
  3564.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, KnifeChoice, _:Block_Global1);
  3565.            
  3566.             switch (KnifeChoice)
  3567.             {
  3568.                 case Knife_Drunk:
  3569.                 {
  3570.                     SetEntData(LR_Player_Prisoner, g_Offset_FOV, 105, 4, true);
  3571.                     SetEntData(LR_Player_Prisoner, g_Offset_DefFOV, 105, 4, true)
  3572.                     ShowOverlayToClient(LR_Player_Prisoner, "effects/strider_pinch_dudv");
  3573.                     SetEntData(LR_Player_Guard, g_Offset_FOV, 105, 4, true);
  3574.                     SetEntData(LR_Player_Guard, g_Offset_DefFOV, 105, 4, true);
  3575.                     ShowOverlayToClient(LR_Player_Guard, "effects/strider_pinch_dudv");
  3576.                     if (g_BeerGogglesTimer == INVALID_HANDLE)
  3577.                     {
  3578.                         g_BeerGogglesTimer = CreateTimer(1.0, Timer_BeerGoggles, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  3579.                     }
  3580.                 }
  3581.                 case Knife_LowGrav:
  3582.                 {
  3583.                     SetEntityGravity(LR_Player_Prisoner, gShadow_LR_KnifeFight_LowGrav);
  3584.                     SetEntityGravity(LR_Player_Guard, gShadow_LR_KnifeFight_LowGrav);
  3585.                 }
  3586.                 case Knife_HiSpeed:
  3587.                 {
  3588.                     SetEntPropFloat(LR_Player_Prisoner, Prop_Data, "m_flLaggedMovementValue", gShadow_LR_KnifeFight_HiSpeed);
  3589.                     SetEntPropFloat(LR_Player_Guard, Prop_Data, "m_flLaggedMovementValue", gShadow_LR_KnifeFight_HiSpeed);
  3590.                 }
  3591.                 case Knife_ThirdPerson:
  3592.                 {
  3593.                     SetThirdPerson(LR_Player_Prisoner);
  3594.                     SetThirdPerson(LR_Player_Guard);
  3595.                 }
  3596.                 case Knife_Drugs:
  3597.                 {
  3598.                     ShowOverlayToClient(LR_Player_Prisoner, "models/effects/portalfunnel_sheet");
  3599.                     ShowOverlayToClient(LR_Player_Guard, "models/effects/portalfunnel_sheet");
  3600.                 }
  3601.             }
  3602.            
  3603.             // set HP
  3604.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  3605.             SetEntData(LR_Player_Guard, g_Offset_Health, 100);
  3606.  
  3607.             // give knives
  3608.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  3609.             GivePlayerItem(LR_Player_Guard, "weapon_knife");
  3610.  
  3611.             // announce LR
  3612.             PrintToChatAll(CHAT_BANNER, "LR KF Start", LR_Player_Prisoner, LR_Player_Guard);
  3613.         }
  3614.         case LR_Shot4Shot:
  3615.         {
  3616.             StripAllWeapons(LR_Player_Prisoner);
  3617.             StripAllWeapons(LR_Player_Guard);
  3618.  
  3619.             // grab weapon choice
  3620.             new PistolWeapon:PistolChoice;
  3621.             ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  3622.             PistolChoice = PistolWeapon:ReadPackCell(gH_BuildLR[LR_Player_Prisoner]);
  3623.    
  3624.             new Pistol_Prisoner, Pistol_Guard;
  3625.             switch (PistolChoice)
  3626.             {
  3627.                 case Pistol_Deagle:
  3628.                 {
  3629.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  3630.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  3631.                 }
  3632.                 case Pistol_P228:
  3633.                 {
  3634.                     if (g_Game == Game_CSS)
  3635.                     {
  3636.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_p228");
  3637.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_p228");
  3638.                     }
  3639.                     else if (g_Game == Game_CSGO)
  3640.                     {
  3641.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_p250");
  3642.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_p250");
  3643.                     }
  3644.                 }
  3645.                 case Pistol_Glock:
  3646.                 {
  3647.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_glock");
  3648.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_glock");
  3649.                 }
  3650.                 case Pistol_FiveSeven:
  3651.                 {
  3652.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_fiveseven");
  3653.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_fiveseven");
  3654.                 }
  3655.                 case Pistol_Dualies:
  3656.                 {
  3657.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_elite");
  3658.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_elite");
  3659.                 }
  3660.                 case Pistol_USP:
  3661.                 {
  3662.                     if(g_Game == Game_CSS)
  3663.                     {
  3664.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_usp");
  3665.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_usp");
  3666.                     }
  3667.                     else if(g_Game == Game_CSGO)
  3668.                     {
  3669.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_hkp2000");
  3670.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_hkp2000");
  3671.                     }
  3672.                 }
  3673.                 case Pistol_Tec9:
  3674.                 {
  3675.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_tec9");
  3676.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_tec9");
  3677.                 }
  3678.                 default:
  3679.                 {
  3680.                     LogError("hit default S4S");
  3681.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  3682.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  3683.                 }
  3684.             }
  3685.            
  3686.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  3687.             GivePlayerItem(LR_Player_Guard, "weapon_knife");
  3688.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_Prisoner, _:Block_PrisonerData);
  3689.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_Guard, _:Block_GuardData);
  3690.            
  3691.             PrintToChatAll(CHAT_BANNER, "LR S4S Start", LR_Player_Prisoner, LR_Player_Guard);
  3692.            
  3693.             // randomize who starts first
  3694.             new s4sPlayerFirst = GetRandomInt(0, 1);
  3695.             if (s4sPlayerFirst == 0)
  3696.             {
  3697.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, 0);
  3698.                 SetEntData(Pistol_Guard, g_Offset_Clip1, 1);
  3699.                 SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, LR_Player_Prisoner, _:Block_Global1);
  3700.                 if (gShadow_SendGlobalMsgs)
  3701.                 {
  3702.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  3703.                 }
  3704.                 else
  3705.                 {
  3706.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  3707.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  3708.                 }
  3709.             }
  3710.             else
  3711.             {
  3712.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, 1);
  3713.                 SetEntData(Pistol_Guard, g_Offset_Clip1, 0);           
  3714.                 SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, LR_Player_Guard, _:Block_Global1);
  3715.                 if (gShadow_SendGlobalMsgs)
  3716.                 {
  3717.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  3718.                 }
  3719.                 else
  3720.                 {
  3721.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  3722.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);              
  3723.                 }
  3724.             }
  3725.  
  3726.             // set secondary ammo to 0
  3727.             new iAmmoType = GetEntProp(Pistol_Prisoner, Prop_Send, "m_iPrimaryAmmoType");
  3728.             SetEntData(LR_Player_Guard, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  3729.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  3730.  
  3731.             // set HP
  3732.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  3733.             SetEntData(LR_Player_Guard, g_Offset_Health, 100);
  3734.         }
  3735.         case LR_GunToss:
  3736.         {
  3737.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, false, _:Block_Global1); // GTp1dropped
  3738.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, false, _:Block_Global2); // GTp2dropped
  3739.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, false, _:Block_Global3); // GTp1done
  3740.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, false, _:Block_Global4); // GTp2done
  3741.            
  3742.             new Handle:DataPackPosition = CreateDataPack();
  3743.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, DataPackPosition, _:Block_DataPackHandle); // position handle
  3744.             WritePackFloat(DataPackPosition, Float:0.0);
  3745.             WritePackFloat(DataPackPosition, Float:0.0);
  3746.             WritePackFloat(DataPackPosition, Float:0.0); // GTdeagle1lastpos
  3747.             WritePackFloat(DataPackPosition, Float:0.0);
  3748.             WritePackFloat(DataPackPosition, Float:0.0);
  3749.             WritePackFloat(DataPackPosition, Float:0.0); // GTdeagle2lastpos
  3750.             WritePackFloat(DataPackPosition, Float:0.0);
  3751.             WritePackFloat(DataPackPosition, Float:0.0);
  3752.             WritePackFloat(DataPackPosition, Float:0.0); //
  3753.             WritePackFloat(DataPackPosition, Float:0.0);
  3754.             WritePackFloat(DataPackPosition, Float:0.0);
  3755.             WritePackFloat(DataPackPosition, Float:0.0); //
  3756.             WritePackFloat(DataPackPosition, Float:0.0);
  3757.             WritePackFloat(DataPackPosition, Float:0.0);
  3758.             WritePackFloat(DataPackPosition, Float:0.0); // player 1 last jump position
  3759.             WritePackFloat(DataPackPosition, Float:0.0);
  3760.             WritePackFloat(DataPackPosition, Float:0.0);
  3761.             WritePackFloat(DataPackPosition, Float:0.0); // player 2 last jump position
  3762.  
  3763.             StripAllWeapons(LR_Player_Prisoner);
  3764.             StripAllWeapons(LR_Player_Guard);
  3765.  
  3766.             // give knives and deagles
  3767.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  3768.             GivePlayerItem(LR_Player_Guard, "weapon_knife");
  3769.             new GTdeagle1 = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  3770.             new GTdeagle2 = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  3771.             new Prisoner_GunEntRef = EntIndexToEntRef(GTdeagle1);
  3772.             new Guard_GunEntRef = EntIndexToEntRef(GTdeagle2);
  3773.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Prisoner_GunEntRef, _:Block_PrisonerData);
  3774.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Guard_GunEntRef, _:Block_GuardData);
  3775.  
  3776.             // set ammo (Clip2) 0 -- we don't need any extra ammo...
  3777.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo+(1*4), 0);
  3778.             SetEntData(LR_Player_Guard, g_Offset_Ammo+(1*4), 0);
  3779.  
  3780.             if (gShadow_LR_GunToss_StartMode > 0)
  3781.             {
  3782.                 // set ammo (Clip1)
  3783.                 SetEntData(GTdeagle1, g_Offset_Clip1, 0);
  3784.                 SetEntData(GTdeagle2, g_Offset_Clip1, 0);
  3785.                
  3786.                 SetEntityRenderMode(GTdeagle1, RENDER_TRANSCOLOR);
  3787.                 SetEntityRenderColor(GTdeagle1, 255, 0, 0);
  3788.                 SetEntityRenderMode(GTdeagle2, RENDER_TRANSCOLOR);
  3789.                 SetEntityRenderColor(GTdeagle2, 0, 0, 255);
  3790.             }
  3791.  
  3792.             // announce LR
  3793.             PrintToChatAll(CHAT_BANNER, "LR GT Start", LR_Player_Prisoner, LR_Player_Guard);
  3794.         }
  3795.         case LR_ChickenFight:
  3796.         {
  3797.             StripAllWeapons(LR_Player_Prisoner);
  3798.             StripAllWeapons(LR_Player_Guard);
  3799.  
  3800.             if (g_ChickenFightTimer == INVALID_HANDLE)
  3801.             {
  3802.                 g_ChickenFightTimer = CreateTimer(0.2, Timer_ChickenFight, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  3803.             }
  3804.  
  3805.             if (gShadow_NoBlock)
  3806.             {
  3807.                 BlockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  3808.                 BlockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  3809.             }
  3810.  
  3811.             // announce LR
  3812.             PrintToChatAll(CHAT_BANNER, "LR CF Start", LR_Player_Prisoner, LR_Player_Guard);
  3813.         }
  3814.         case LR_HotPotato:
  3815.         {
  3816.             StripAllWeapons(LR_Player_Prisoner);
  3817.             StripAllWeapons(LR_Player_Guard);
  3818.  
  3819.             // always give potato to the prisoner
  3820.             new potatoClient = LR_Player_Prisoner;
  3821.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, potatoClient, _:Block_Global1); // HPloser
  3822.  
  3823.             // create the potato deagle
  3824.             new HPdeagle = CreateEntityByName("weapon_deagle");
  3825.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, HPdeagle, _:Block_Global4);
  3826.             DispatchSpawn(HPdeagle);
  3827.             EquipPlayerWeapon(potatoClient, HPdeagle);
  3828.  
  3829.             // set ammo (Clip2) 0
  3830.             SetEntData(potatoClient, g_Offset_Ammo+(1*4), 0);
  3831.             // set ammo (Clip1) 0
  3832.             SetEntData(HPdeagle, g_Offset_Clip1, 0);
  3833.  
  3834.             SetEntityRenderMode(HPdeagle, RENDER_TRANSCOLOR);
  3835.             SetEntityRenderColor(HPdeagle, 255, 255, 0);
  3836.  
  3837.             decl Float:p1pos[3], Float:p2pos[3];
  3838.             GetClientAbsOrigin(LR_Player_Prisoner, p1pos);
  3839.            
  3840.             decl Float:f_PrisonerAngles[3], Float:f_SubtractFromPrisoner[3];
  3841.             GetClientEyeAngles(LR_Player_Prisoner, f_PrisonerAngles);          
  3842.             // zero out pitch/yaw
  3843.             f_PrisonerAngles[0] = 0.0;         
  3844.             GetAngleVectors(f_PrisonerAngles, f_SubtractFromPrisoner, NULL_VECTOR, NULL_VECTOR);
  3845.             decl Float:f_GuardDirection[3];
  3846.             f_GuardDirection = f_SubtractFromPrisoner;
  3847.             if (g_Game == Game_CSS)
  3848.             {
  3849.                 ScaleVector(f_SubtractFromPrisoner, -70.0);        
  3850.             }
  3851.             else if (g_Game == Game_CSGO)
  3852.             {
  3853.                 ScaleVector(f_SubtractFromPrisoner, -115.0);       
  3854.             }
  3855.             MakeVectorFromPoints(f_SubtractFromPrisoner, p1pos, p2pos);
  3856.  
  3857.             if (g_Game == Game_CSGO)
  3858.             {
  3859.                 p1pos[2] -= 20.0;
  3860.             }
  3861.            
  3862.             // create 'unique' ID for this hot potato
  3863.             new uniqueID = GetRandomInt(1, 31337);
  3864.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, uniqueID, _:Block_Global3);
  3865.            
  3866.             // create timer to end hot potato
  3867.             new Float:rndEnd = GetRandomFloat(gShadow_LR_HotPotato_MinTime, gShadow_LR_HotPotato_MaxTime);
  3868.             CreateTimer(rndEnd, Timer_HotPotatoDone, uniqueID, TIMER_FLAG_NO_MAPCHANGE);
  3869.  
  3870.             if (gShadow_LR_HotPotato_Mode == 2)
  3871.             {
  3872.                 SetEntityMoveType(LR_Player_Prisoner, MOVETYPE_NONE);
  3873.                 SetEntityMoveType(LR_Player_Guard, MOVETYPE_NONE);         
  3874.                 ScaleVector(f_GuardDirection, -1.0);
  3875.                 TeleportEntity(LR_Player_Guard, p2pos, f_GuardDirection, NULL_VECTOR);
  3876.             }
  3877.             else
  3878.             {
  3879.                 if (gShadow_LR_HotPotato_Mode == 1)
  3880.                 {
  3881.                     if (gShadow_NoBlock)
  3882.                     {
  3883.                         UnblockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  3884.                         UnblockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  3885.                     }
  3886.                     TeleportEntity(LR_Player_Guard, p2pos, f_GuardDirection, NULL_VECTOR);
  3887.                 }
  3888.                
  3889.                 SetEntPropFloat(LR_Player_Prisoner, Prop_Data, "m_flLaggedMovementValue", gShadow_LR_HotPotato_Speed);             
  3890.             }
  3891.            
  3892.             TeleportEntity(HPdeagle, p1pos, NULL_VECTOR, NULL_VECTOR);
  3893.            
  3894.             if (gShadow_LR_Beacons)
  3895.             {
  3896.                 AddBeacon(HPdeagle);
  3897.             }
  3898.            
  3899.             // announce LR
  3900.             PrintToChatAll(CHAT_BANNER, "LR HP Start", LR_Player_Prisoner, LR_Player_Guard);
  3901.         }
  3902.         case LR_Dodgeball:
  3903.         {
  3904.             StripAllWeapons(LR_Player_Prisoner);
  3905.             StripAllWeapons(LR_Player_Guard);
  3906.  
  3907.             // bug fix...
  3908.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo + (_:12 * 4), 0, _, true);
  3909.             SetEntData(LR_Player_Guard, g_Offset_Ammo + (_:12 * 4), 0, _, true);
  3910.  
  3911.             // set HP
  3912.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 1);
  3913.             SetEntData(LR_Player_Guard, g_Offset_Health, 1);
  3914.             SetEntData(LR_Player_Prisoner, g_Offset_Armor, 0);
  3915.             SetEntData(LR_Player_Guard, g_Offset_Armor, 0);
  3916.  
  3917.             // give flashbangs
  3918.             new flash1 = CreateEntityByName("weapon_flashbang");
  3919.             new flash2 = CreateEntityByName("weapon_flashbang");
  3920.             DispatchSpawn(flash1);
  3921.             DispatchSpawn(flash2);
  3922.             EquipPlayerWeapon(LR_Player_Prisoner, flash1);
  3923.             EquipPlayerWeapon(LR_Player_Guard, flash2);
  3924.  
  3925.             SetEntityGravity(LR_Player_Prisoner, gShadow_LR_Dodgeball_Gravity);
  3926.             SetEntityGravity(LR_Player_Guard, gShadow_LR_Dodgeball_Gravity);
  3927.  
  3928.             if (gShadow_NoBlock)
  3929.             {
  3930.                 BlockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  3931.                 BlockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  3932.             }
  3933.  
  3934.             // timer making sure DB contestants stay @ 1 HP (if enabled by cvar)
  3935.             if ((g_DodgeballTimer == INVALID_HANDLE) && gShadow_LR_Dodgeball_CheatCheck)
  3936.             {
  3937.                 g_DodgeballTimer = CreateTimer(1.0, Timer_DodgeballCheckCheaters, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  3938.             }
  3939.  
  3940.             // announce LR
  3941.             PrintToChatAll(CHAT_BANNER, "LR DB Start", LR_Player_Prisoner, LR_Player_Guard);
  3942.         }
  3943.         case LR_NoScope:
  3944.         {
  3945.             StripAllWeapons(LR_Player_Prisoner);
  3946.             StripAllWeapons(LR_Player_Guard);
  3947.  
  3948.             // set HP
  3949.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  3950.             SetEntData(LR_Player_Guard, g_Offset_Health, 100);
  3951.  
  3952.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  3953.             GivePlayerItem(LR_Player_Guard, "weapon_knife");
  3954.  
  3955.             new NoScopeWeapon:WeaponChoice;
  3956.             switch (gShadow_LR_NoScope_Weapon)
  3957.             {
  3958.                 case 0:
  3959.                 {
  3960.                     WeaponChoice = NSW_AWP;
  3961.                 }
  3962.                 case 1:
  3963.                 {
  3964.                     WeaponChoice = NSW_Scout;
  3965.                 }
  3966.                 case 2:
  3967.                 {
  3968.                     ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  3969.                     WeaponChoice = NoScopeWeapon:ReadPackCell(gH_BuildLR[LR_Player_Prisoner]);             
  3970.                 }
  3971.                 case 3:
  3972.                 {
  3973.                     WeaponChoice = NSW_SG550;
  3974.                 }
  3975.                 case 4:
  3976.                 {
  3977.                     WeaponChoice = NSW_G3SG1;
  3978.                 }
  3979.             }
  3980.            
  3981.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, WeaponChoice, _:Block_Global2);
  3982.            
  3983.             PrintToChatAll(CHAT_BANNER, "LR NS Start", LR_Player_Prisoner, LR_Player_Guard);
  3984.            
  3985.             if (gShadow_LR_NoScope_Delay > 0)
  3986.             {
  3987.                 SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, gShadow_LR_NoScope_Delay, _:Block_Global1);
  3988.                 if (g_CountdownTimer == INVALID_HANDLE)
  3989.                 {
  3990.                     g_CountdownTimer = CreateTimer(1.0, Timer_Countdown, iPartnersIndex, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  3991.                 }
  3992.             }
  3993.             // launch now if there's no countdown requested
  3994.             else
  3995.             {              
  3996.                 new NSW_Prisoner, NSW_Guard;
  3997.                 switch (WeaponChoice)
  3998.                 {
  3999.                     case NSW_AWP:
  4000.                     {
  4001.                         NSW_Prisoner = CreateEntityByName("weapon_awp");
  4002.                         NSW_Guard = CreateEntityByName("weapon_awp");
  4003.                     }
  4004.                     case NSW_Scout:
  4005.                     {
  4006.                         if (g_Game == Game_CSS)
  4007.                         {
  4008.                             NSW_Prisoner = CreateEntityByName("weapon_scout");
  4009.                             NSW_Guard = CreateEntityByName("weapon_scout");
  4010.                         }
  4011.                         else if (g_Game == Game_CSGO)
  4012.                         {
  4013.                             NSW_Prisoner = CreateEntityByName("weapon_ssg08");
  4014.                             NSW_Guard = CreateEntityByName("weapon_ssg08");
  4015.                         }
  4016.                     }
  4017.                     case NSW_SG550:
  4018.                     {
  4019.                         if (g_Game == Game_CSS)
  4020.                         {
  4021.                             NSW_Prisoner = CreateEntityByName("weapon_sg550");
  4022.                             NSW_Guard = CreateEntityByName("weapon_sg550");
  4023.                         }
  4024.                         else if (g_Game == Game_CSGO)
  4025.                         {
  4026.                             NSW_Prisoner = CreateEntityByName("weapon_scar20");
  4027.                             NSW_Guard = CreateEntityByName("weapon_scar20");
  4028.                         }
  4029.                     }
  4030.                     case NSW_G3SG1:
  4031.                     {
  4032.                         NSW_Prisoner = CreateEntityByName("weapon_g3sg1");
  4033.                         NSW_Guard = CreateEntityByName("weapon_g3sg1");
  4034.                     }
  4035.                     default:
  4036.                     {
  4037.                         LogError("hit default NS");
  4038.                         NSW_Prisoner = CreateEntityByName("weapon_awp");
  4039.                         NSW_Guard = CreateEntityByName("weapon_awp");
  4040.                     }
  4041.                 }
  4042.                
  4043.                 DispatchSpawn(NSW_Prisoner);
  4044.                 DispatchSpawn(NSW_Guard);
  4045.                 EquipPlayerWeapon(LR_Player_Prisoner, NSW_Prisoner);
  4046.                 EquipPlayerWeapon(LR_Player_Guard, NSW_Guard);
  4047.                 SetEntData(NSW_Prisoner, g_Offset_Clip1, 99);
  4048.                 SetEntData(NSW_Guard, g_Offset_Clip1, 99);     
  4049.                
  4050.                 if ((strlen(gShadow_LR_NoScope_Sound) > 0) && !StrEqual(gShadow_LR_NoScope_Sound, "-1"))
  4051.                 {
  4052.                     EmitSoundToAll(gShadow_LR_NoScope_Sound);
  4053.                 }              
  4054.             }
  4055.         }
  4056.         case LR_RockPaperScissors:
  4057.         {
  4058.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, -1, _:Block_Global1);
  4059.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, -1, _:Block_Global2);
  4060.             new Handle:rpsmenu1 = CreateMenu(RPSmenuHandler);
  4061.             SetMenuTitle(rpsmenu1, "%T", "Rock Paper Scissors", LR_Player_Prisoner);
  4062.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, rpsmenu1, _:Block_PrisonerData);
  4063.  
  4064.             decl String:r1[32], String:p1[64], String:s1[64];
  4065.             Format(r1, sizeof(r1), "%T", "Rock", LR_Player_Prisoner);
  4066.             Format(p1, sizeof(p1), "%T", "Paper", LR_Player_Prisoner);
  4067.             Format(s1, sizeof(s1), "%T", "Scissors", LR_Player_Prisoner);
  4068.             AddMenuItem(rpsmenu1, "0", r1);
  4069.             AddMenuItem(rpsmenu1, "1", p1);
  4070.             AddMenuItem(rpsmenu1, "2", s1);
  4071.  
  4072.             SetMenuExitButton(rpsmenu1, true);
  4073.             DisplayMenu(rpsmenu1, LR_Player_Prisoner, 15);
  4074.  
  4075.             new Handle:rpsmenu2 = CreateMenu(RPSmenuHandler);
  4076.             SetMenuTitle(rpsmenu2, "%T", "Rock Paper Scissors", LR_Player_Guard);
  4077.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, rpsmenu2, _:Block_GuardData);
  4078.  
  4079.             decl String:r2[32], String:p2[64], String:s2[64];
  4080.             Format(r2, sizeof(r2), "%T", "Rock", LR_Player_Guard);
  4081.             Format(p2, sizeof(p2), "%T", "Paper", LR_Player_Guard);
  4082.             Format(s2, sizeof(s2), "%T", "Scissors", LR_Player_Guard);
  4083.             AddMenuItem(rpsmenu2, "0", r2);
  4084.             AddMenuItem(rpsmenu2, "1", p2);
  4085.             AddMenuItem(rpsmenu2, "2", s2);
  4086.  
  4087.             SetMenuExitButton(rpsmenu2, true);
  4088.             DisplayMenu(rpsmenu2, LR_Player_Guard, 15);
  4089.  
  4090.             // announce LR
  4091.             PrintToChatAll(CHAT_BANNER, "LR RPS Start", LR_Player_Prisoner, LR_Player_Guard);
  4092.         }
  4093.         case LR_Rebel:
  4094.         {
  4095.             // strip weapons from T rebelling
  4096.             StripAllWeapons(LR_Player_Prisoner);
  4097.  
  4098.             // give knife, deagle, and m249
  4099.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  4100.             new RebelDeagle = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  4101.             GivePlayerItem(LR_Player_Prisoner, "weapon_m249");
  4102.  
  4103.             // set primary and secondary ammo
  4104.             SetEntData(RebelDeagle, g_Offset_Clip1, 7);
  4105.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo+(1*4), 42);
  4106.  
  4107.             // find number of alive CTs
  4108.             new numCTsAlive = 0;
  4109.             for(new i = 1; i <= MaxClients; i++)
  4110.             {
  4111.                 if (IsClientInGame(i) && IsPlayerAlive(i))
  4112.                 {
  4113.                     if (GetClientTeam(i) == CS_TEAM_CT)
  4114.                     {
  4115.                         numCTsAlive++;
  4116.                     }
  4117.                 }
  4118.             }
  4119.            
  4120.             // set HP
  4121.             SetEntData(LR_Player_Prisoner, g_Offset_Health, numCTsAlive*100+25);
  4122.            
  4123.             // announce LR
  4124.             PrintToChatAll(CHAT_BANNER, "LR Has Chosen to Rebel!", LR_Player_Prisoner);
  4125.         }
  4126.         case LR_Mag4Mag:
  4127.         {
  4128.             StripAllWeapons(LR_Player_Prisoner);
  4129.             StripAllWeapons(LR_Player_Guard);
  4130.            
  4131.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_Global2); // M4MroundsFired
  4132.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_Global3); // M4Mammo
  4133.            
  4134.             // give knives and deagles
  4135.             GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  4136.             GivePlayerItem(LR_Player_Guard, "weapon_knife");
  4137.             // grab weapon choice
  4138.             new PistolChoice;
  4139.             ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  4140.             PistolChoice = ReadPackCell(gH_BuildLR[LR_Player_Prisoner]);
  4141.    
  4142.             new Pistol_Prisoner, Pistol_Guard;
  4143.             switch (PistolChoice)
  4144.             {
  4145.                 case Pistol_Deagle:
  4146.                 {
  4147.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  4148.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  4149.                 }
  4150.                 case Pistol_P228:
  4151.                 {
  4152.                     if (g_Game == Game_CSS)
  4153.                     {
  4154.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_p228");
  4155.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_p228");
  4156.                     }
  4157.                     else if (g_Game == Game_CSGO)
  4158.                     {
  4159.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_p250");
  4160.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_p250");
  4161.                     }
  4162.                 }
  4163.                 case Pistol_Glock:
  4164.                 {
  4165.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_glock");
  4166.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_glock");
  4167.                 }
  4168.                 case Pistol_FiveSeven:
  4169.                 {
  4170.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_fiveseven");
  4171.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_fiveseven");
  4172.                 }
  4173.                 case Pistol_Dualies:
  4174.                 {
  4175.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_elite");
  4176.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_elite");
  4177.                 }
  4178.                 case Pistol_USP:
  4179.                 {
  4180.                     if (g_Game == Game_CSS)
  4181.                     {
  4182.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_usp");
  4183.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_usp");
  4184.                     }
  4185.                     else if (g_Game == Game_CSGO)
  4186.                     {
  4187.                         Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_hkp2000");
  4188.                         Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_hkp2000");
  4189.                     }
  4190.                 }
  4191.                 case Pistol_Tec9:
  4192.                 {
  4193.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_tec9");
  4194.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_tec9");
  4195.                 }
  4196.                 default:
  4197.                 {
  4198.                     LogError("hit default S4S");
  4199.                     Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  4200.                     Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  4201.                 }
  4202.             }
  4203.  
  4204.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_Prisoner, _:Block_PrisonerData);
  4205.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_Guard, _:Block_GuardData);
  4206.            
  4207.             PrintToChatAll(CHAT_BANNER, "LR Mag4Mag Start", LR_Player_Prisoner, LR_Player_Guard);
  4208.            
  4209.             SetEntDataFloat(Pistol_Prisoner, g_Offset_SecAttack, 5000.0);
  4210.             SetEntDataFloat(Pistol_Guard, g_Offset_SecAttack, 5000.0);
  4211.            
  4212.             new m4mPlayerFirst = GetRandomInt(0, 1);
  4213.             if (m4mPlayerFirst == 0)
  4214.             {
  4215.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, 0);
  4216.                 SetEntData(Pistol_Guard, g_Offset_Clip1, gShadow_LR_M4M_MagCapacity);
  4217.                 if (gShadow_SendGlobalMsgs)
  4218.                 {
  4219.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4220.                 }
  4221.                 else
  4222.                 {
  4223.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4224.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4225.                 }
  4226.                 SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, LR_Player_Guard, _:Block_Global1); // S4Slastshot
  4227.             }
  4228.             else
  4229.             {
  4230.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, gShadow_LR_M4M_MagCapacity);
  4231.                 SetEntData(Pistol_Guard, g_Offset_Clip1, 0);           
  4232.                 if (gShadow_SendGlobalMsgs)
  4233.                 {
  4234.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  4235.                 }
  4236.                 else
  4237.                 {
  4238.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  4239.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  4240.                 }
  4241.                 SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, LR_Player_Prisoner, _:Block_Global1);
  4242.             }
  4243.        
  4244.             // set HP
  4245.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  4246.             SetEntData(LR_Player_Guard, g_Offset_Health, 100);
  4247.  
  4248.             new iAmmoType = GetEntProp(Pistol_Prisoner, Prop_Send, "m_iPrimaryAmmoType");
  4249.             SetEntData(LR_Player_Guard, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  4250.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  4251.         }
  4252.         case LR_Race:
  4253.         {
  4254.             StripAllWeapons(LR_Player_Prisoner);
  4255.             StripAllWeapons(LR_Player_Guard);
  4256.            
  4257.             if (!gShadow_NoBlock)
  4258.             {
  4259.                 UnblockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  4260.                 UnblockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  4261.             }
  4262.            
  4263.             SetEntityMoveType(LR_Player_Prisoner, MOVETYPE_NONE);
  4264.             SetEntityMoveType(LR_Player_Guard, MOVETYPE_NONE);
  4265.            
  4266.             //  teleport both players to the start of the race
  4267.             decl Float:f_StartLocation[3], Float:f_EndLocation[3];
  4268.             ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  4269.             f_StartLocation[0] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4270.             f_StartLocation[1] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4271.             f_StartLocation[2] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4272.             f_EndLocation[0] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4273.             f_EndLocation[1] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4274.             f_EndLocation[2] = ReadPackFloat(gH_BuildLR[LR_Player_Prisoner]);
  4275.             new Handle:ThisDataPack = CreateDataPack();
  4276.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, ThisDataPack, 9);
  4277.             WritePackFloat(ThisDataPack, f_EndLocation[0]);
  4278.             WritePackFloat(ThisDataPack, f_EndLocation[1]);
  4279.             WritePackFloat(ThisDataPack, f_EndLocation[2]);
  4280.            
  4281.             TeleportEntity(LR_Player_Prisoner, f_StartLocation, NULL_VECTOR, NULL_VECTOR);
  4282.             TeleportEntity(LR_Player_Guard, f_StartLocation, NULL_VECTOR, NULL_VECTOR);
  4283.            
  4284.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 3, _:Block_Global1);
  4285.             // fire timer for race begin countdown
  4286.             if (g_CountdownTimer == INVALID_HANDLE)
  4287.             {
  4288.                 g_CountdownTimer = CreateTimer(1.0, Timer_Countdown, iPartnersIndex, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  4289.             }
  4290.         }
  4291.         case LR_RussianRoulette:
  4292.         {
  4293.             StripAllWeapons(LR_Player_Prisoner);
  4294.             StripAllWeapons(LR_Player_Guard);
  4295.            
  4296.             decl Float:p1pos[3], Float:p2pos[3];
  4297.             GetClientAbsOrigin(LR_Player_Prisoner, p1pos);
  4298.            
  4299.             decl Float:f_PrisonerAngles[3], Float:f_SubtractFromPrisoner[3];
  4300.             GetClientEyeAngles(LR_Player_Prisoner, f_PrisonerAngles);
  4301.             // zero out pitch/yaw
  4302.             f_PrisonerAngles[0] = 0.0;         
  4303.             GetAngleVectors(f_PrisonerAngles, f_SubtractFromPrisoner, NULL_VECTOR, NULL_VECTOR);
  4304.             decl Float:f_GuardDirection[3];
  4305.             f_GuardDirection = f_SubtractFromPrisoner;
  4306.             ScaleVector(f_SubtractFromPrisoner, -70.0);        
  4307.             MakeVectorFromPoints(f_SubtractFromPrisoner, p1pos, p2pos);
  4308.  
  4309.             SetEntityMoveType(LR_Player_Prisoner, MOVETYPE_NONE);
  4310.             SetEntityMoveType(LR_Player_Guard, MOVETYPE_NONE);         
  4311.             ScaleVector(f_GuardDirection, -1.0);           
  4312.             TeleportEntity(LR_Player_Guard, p2pos, f_GuardDirection, NULL_VECTOR);
  4313.  
  4314.             new Pistol_Prisoner = GivePlayerItem(LR_Player_Prisoner, "weapon_deagle");
  4315.             new Pistol_Guard = GivePlayerItem(LR_Player_Guard, "weapon_deagle");
  4316.             new Pistol_PrisonerEntRef = EntIndexToEntRef(Pistol_Prisoner);
  4317.             new Pistol_GuardEntRef = EntIndexToEntRef(Pistol_Guard);
  4318.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_PrisonerEntRef, _:Block_PrisonerData);
  4319.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Pistol_GuardEntRef, _:Block_GuardData);    
  4320.                
  4321.             PrintToChatAll(CHAT_BANNER, "LR RR Start", LR_Player_Prisoner, LR_Player_Guard);
  4322.            
  4323.             // randomize who starts first
  4324.             if (GetRandomInt(0, 1) == 0)
  4325.             {
  4326.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, 0);
  4327.                 SetEntData(Pistol_Guard, g_Offset_Clip1, 1);
  4328.                 if (gShadow_SendGlobalMsgs)
  4329.                 {
  4330.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4331.                 }
  4332.                 else
  4333.                 {
  4334.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4335.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Guard);
  4336.                 }
  4337.             }
  4338.             else
  4339.             {
  4340.                 SetEntData(Pistol_Prisoner, g_Offset_Clip1, 1);
  4341.                 SetEntData(Pistol_Guard, g_Offset_Clip1, 0);
  4342.                 if (gShadow_SendGlobalMsgs)
  4343.                 {
  4344.                     PrintToChatAll(CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  4345.                 }
  4346.                 else
  4347.                 {
  4348.                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);
  4349.                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "Randomly Chose First Player", LR_Player_Prisoner);              
  4350.                 }
  4351.             }
  4352.  
  4353.             // set secondary ammo to 0
  4354.             new iAmmoType = GetEntProp(Pistol_Prisoner, Prop_Send, "m_iPrimaryAmmoType");
  4355.             SetEntData(LR_Player_Guard, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  4356.             SetEntData(LR_Player_Prisoner, g_Offset_Ammo+(iAmmoType*4), 0, _, true);
  4357.  
  4358.             // set HP
  4359.             SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  4360.             SetEntData(LR_Player_Guard, g_Offset_Health, 100);         
  4361.         }
  4362.         case LR_JumpContest:
  4363.         {      
  4364.             new JumpChoice;
  4365.             ResetPack(gH_BuildLR[LR_Player_Prisoner]);
  4366.             JumpChoice = ReadPackCell(gH_BuildLR[LR_Player_Prisoner]);
  4367.             SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, JumpChoice, _:Block_Global2);
  4368.            
  4369.             switch (JumpChoice)
  4370.             {
  4371.                 case Jump_TheMost:
  4372.                 {
  4373.                     // reset jump counts
  4374.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_PrisonerData);
  4375.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_GuardData);
  4376.                     // set countdown timer
  4377.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 3, _:Block_Global1);
  4378.                    
  4379.                     if (g_CountdownTimer == INVALID_HANDLE)
  4380.                     {
  4381.                         g_CountdownTimer = CreateTimer(1.0, Timer_Countdown, iPartnersIndex, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  4382.                     }
  4383.                    
  4384.                     PrintToChatAll(CHAT_BANNER, "Start Jump Contest", LR_Player_Prisoner, LR_Player_Guard);
  4385.                    
  4386.                     if (!gShadow_NoBlock)
  4387.                     {
  4388.                         UnblockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  4389.                         UnblockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  4390.                     }
  4391.                     decl Float:Prisoner_Position[3];
  4392.                     GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  4393.                     TeleportEntity(LR_Player_Guard, Prisoner_Position, NULL_VECTOR, NULL_VECTOR);
  4394.                 }
  4395.                 case Jump_Farthest:
  4396.                 {
  4397.                     // record current starting position for "ground" level comparison
  4398.                     decl Float:Prisoner_Position[3];
  4399.                     GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  4400.  
  4401.                     // we only need the Z-axis
  4402.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, Prisoner_Position[2], _:Block_Global3);                
  4403.  
  4404.                     // set jumped bools to false                   
  4405.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_PrisonerData);
  4406.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, 0, _:Block_GuardData);                 
  4407.                    
  4408.                     PrintToChatAll(CHAT_BANNER, "Start Farthest Jump", LR_Player_Prisoner, LR_Player_Guard);
  4409.                    
  4410.                     // start detection timer
  4411.                     if (g_FarthestJumpTimer == INVALID_HANDLE)
  4412.                     {
  4413.                         g_FarthestJumpTimer = CreateTimer(0.1, Timer_FarthestJumpDetector, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  4414.                     }
  4415.                    
  4416.                     new Handle:JumpPackPosition = CreateDataPack();
  4417.                     SetArrayCell(gH_DArray_LR_Partners, iPartnersIndex, JumpPackPosition, _:Block_DataPackHandle); // position handle
  4418.                     WritePackFloat(JumpPackPosition, Float:0.0);
  4419.                     WritePackFloat(JumpPackPosition, Float:0.0);
  4420.                     WritePackFloat(JumpPackPosition, Float:0.0); // Prisoner Jump Position
  4421.                     WritePackFloat(JumpPackPosition, Float:0.0);
  4422.                     WritePackFloat(JumpPackPosition, Float:0.0);
  4423.                     WritePackFloat(JumpPackPosition, Float:0.0); // Guard Jump Position                
  4424.                 }
  4425.                 case Jump_BrinkOfDeath:
  4426.                 {
  4427.                     StripAllWeapons(LR_Player_Prisoner);
  4428.                     StripAllWeapons(LR_Player_Guard);
  4429.  
  4430.                     SetEntData(LR_Player_Prisoner, g_Offset_Health, 100);
  4431.                     SetEntData(LR_Player_Guard, g_Offset_Health, 100);
  4432.                    
  4433.                     if (!gShadow_NoBlock)
  4434.                     {
  4435.                         UnblockEntity(LR_Player_Prisoner, g_Offset_CollisionGroup);
  4436.                         UnblockEntity(LR_Player_Guard, g_Offset_CollisionGroup);
  4437.                     }
  4438.                    
  4439.                     decl Float:Prisoner_Position[3];
  4440.                     GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  4441.                     TeleportEntity(LR_Player_Guard, Prisoner_Position, NULL_VECTOR, NULL_VECTOR);
  4442.                    
  4443.                     PrintToChatAll(CHAT_BANNER, "Start Brink of Death", LR_Player_Prisoner, LR_Player_Guard);
  4444.                    
  4445.                     // timer to quit the LR
  4446.                     CreateTimer(22.0, Timer_JumpContestOver, _, TIMER_FLAG_NO_MAPCHANGE);
  4447.                 }
  4448.             }
  4449.         }
  4450.         default:
  4451.         {
  4452.             Call_StartForward(gH_Frwd_LR_Start);
  4453.             Call_PushCell(gH_DArray_LR_Partners);
  4454.             Call_PushCell(iPartnersIndex);
  4455.             new ignore;
  4456.             Call_Finish(_:ignore);
  4457.            
  4458.             if(!IsLastRequestAutoStart(selection))
  4459.             {
  4460.                 g_LR_Player_Guard[LR_Player_Prisoner] = LR_Player_Guard;
  4461.                 g_selection[LR_Player_Prisoner] = selection;
  4462.                
  4463.                 RemoveFromArray(gH_DArray_LR_Partners, iPartnersIndex);
  4464.             }
  4465.         }
  4466.     }
  4467.    
  4468.     if(IsLastRequestAutoStart(selection))
  4469.     {
  4470.         // Fire global
  4471.         Call_StartForward(gH_Frwd_LR_StartGlobal);
  4472.         Call_PushCell(LR_Player_Prisoner);
  4473.         Call_PushCell(LR_Player_Guard);
  4474.         // LR type
  4475.         Call_PushCell(selection);
  4476.         new ignore;
  4477.         Call_Finish(_:ignore);
  4478.        
  4479.         // Close datapack
  4480.         if (gH_BuildLR[LR_Player_Prisoner] != INVALID_HANDLE)
  4481.         {
  4482.             CloseHandle(gH_BuildLR[LR_Player_Prisoner]);       
  4483.         }
  4484.         gH_BuildLR[LR_Player_Prisoner] = INVALID_HANDLE;
  4485.  
  4486.         // Beacon players
  4487.         if (gShadow_LR_Beacons && selection != LR_Rebel && selection != LR_RussianRoulette)
  4488.         {
  4489.             AddBeacon(LR_Player_Prisoner);
  4490.             AddBeacon(LR_Player_Guard);
  4491.         }
  4492.     }
  4493. }
  4494.  
  4495. public Action:Timer_FarthestJumpDetector(Handle:timer)
  4496. {
  4497.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  4498.     if (iArraySize > 0)
  4499.     {
  4500.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  4501.         {
  4502.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  4503.             if (type == LR_JumpContest)
  4504.             {
  4505.                 new JumpContest:subType = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  4506.                 if (subType == Jump_Farthest)
  4507.                 {                              
  4508.                     new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  4509.                     new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);                 
  4510.                     new Float:f_HeightOfGroundLevel = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);
  4511.                     new bool:Prisoner_Jumped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  4512.                     new bool:Guard_Jumped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  4513.                     new bool:Prisoner_Landed = false;
  4514.                     new bool:Guard_Landed = false;
  4515.  
  4516.                     decl Float:Prisoner_Position[3];
  4517.                     GetClientAbsOrigin(LR_Player_Prisoner, Prisoner_Position);
  4518.                    
  4519.                     new Prisoner_Flags = GetEntityFlags(LR_Player_Prisoner);
  4520.                     new Guard_Flags = GetEntityFlags(LR_Player_Guard);
  4521.                    
  4522.                     if (!Prisoner_Jumped && !(Prisoner_Flags & FL_ONGROUND))
  4523.                     {  
  4524.                         if ((Prisoner_Flags & FL_DUCKING))
  4525.                         {
  4526.                             if (Prisoner_Position[2] < (f_HeightOfGroundLevel - 60.0))
  4527.                             {
  4528.                                 SetArrayCell(gH_DArray_LR_Partners, idx, 1, _:Block_PrisonerData);
  4529.                             }
  4530.                         }
  4531.                         else
  4532.                         {
  4533.                             if (Prisoner_Position[2] < f_HeightOfGroundLevel)
  4534.                             {
  4535.                                 SetArrayCell(gH_DArray_LR_Partners, idx, 1, _:Block_PrisonerData);
  4536.                             }
  4537.                         }
  4538.                     }
  4539.                    
  4540.                     decl Float:Guard_Position[3];
  4541.                     GetClientAbsOrigin(LR_Player_Guard, Guard_Position);                       
  4542.                    
  4543.                     if (!Guard_Jumped && !(Guard_Flags & FL_ONGROUND))
  4544.                     {
  4545.                         if ((Guard_Flags & FL_DUCKING))
  4546.                         {
  4547.                             if (Guard_Position[2] < (f_HeightOfGroundLevel - 60.0))
  4548.                             {
  4549.                                 SetArrayCell(gH_DArray_LR_Partners, idx, 1, _:Block_GuardData);
  4550.                             }
  4551.                         }
  4552.                         else
  4553.                         {
  4554.                             if (Guard_Position[2] < f_HeightOfGroundLevel)
  4555.                             {
  4556.                                 SetArrayCell(gH_DArray_LR_Partners, idx, 1, _:Block_GuardData);
  4557.                             }
  4558.                         }
  4559.                     }
  4560.                    
  4561.                     // check if they're back on the ground yet and freeze them
  4562.                     if (Prisoner_Jumped && (GetEntityFlags(LR_Player_Prisoner) & FL_ONGROUND))
  4563.                     {
  4564.                         SetEntityMoveType(LR_Player_Prisoner, MOVETYPE_NONE);
  4565.                         Prisoner_Landed = true;
  4566.                     }
  4567.                    
  4568.                     if (Guard_Jumped && (GetEntityFlags(LR_Player_Guard) & FL_ONGROUND))
  4569.                     {
  4570.                         SetEntityMoveType(LR_Player_Guard, MOVETYPE_NONE);
  4571.                         Guard_Landed = true;
  4572.                     }
  4573.                    
  4574.                     if (Prisoner_Landed && Guard_Landed)
  4575.                     {
  4576.                         new Handle:JumpPackPosition = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);
  4577.                         decl Float:Prisoner_JumpPosition[3], Float:Guard_JumpPosition[3];
  4578.                         ResetPack(JumpPackPosition);
  4579.                         Prisoner_JumpPosition[0] = ReadPackFloat(JumpPackPosition);
  4580.                         Prisoner_JumpPosition[1] = ReadPackFloat(JumpPackPosition);
  4581.                         Prisoner_JumpPosition[2] = ReadPackFloat(JumpPackPosition);
  4582.                         Guard_JumpPosition[0] = ReadPackFloat(JumpPackPosition);
  4583.                         Guard_JumpPosition[1] = ReadPackFloat(JumpPackPosition);
  4584.                         Guard_JumpPosition[2] = ReadPackFloat(JumpPackPosition);                       
  4585.  
  4586.                         // determine who is farthest from their start position
  4587.                         new Float:Prisoner_Distance = GetVectorDistance(Prisoner_Position, Prisoner_JumpPosition);
  4588.                         new Float:Guard_Distance = GetVectorDistance(Guard_Position, Guard_JumpPosition);
  4589.                  
  4590.                         if (Prisoner_Distance > Guard_Distance)
  4591.                         {
  4592.                             PrintToChatAll(CHAT_BANNER, "Farthest Jump Won", LR_Player_Prisoner, LR_Player_Guard, Prisoner_Distance, Guard_Distance);
  4593.                             KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  4594.                         }
  4595.                         // award ties to the guard
  4596.                         else if (Guard_Distance >= Prisoner_Distance)
  4597.                         {
  4598.                             PrintToChatAll(CHAT_BANNER, "Farthest Jump Won", LR_Player_Guard, LR_Player_Prisoner, Guard_Distance, Prisoner_Distance);
  4599.                             KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  4600.                         }                      
  4601.                     }
  4602.                 }
  4603.             }
  4604.         }
  4605.     }
  4606.     else
  4607.     {
  4608.         g_FarthestJumpTimer = INVALID_HANDLE;
  4609.         return Plugin_Stop;
  4610.     }
  4611.     return Plugin_Continue;
  4612. }
  4613.  
  4614. public Action:Timer_JumpContestOver(Handle:timer)
  4615. {
  4616.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  4617.     if (iArraySize > 0)
  4618.     {
  4619.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  4620.         {  
  4621.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  4622.             if (type == LR_JumpContest)
  4623.             {
  4624.                 new jumptype = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  4625.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  4626.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);             
  4627.                 switch (jumptype)
  4628.                 {
  4629.                     case Jump_TheMost:
  4630.                     {                      
  4631.                         new Guard_JumpCount = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData);
  4632.                         new Prisoner_JumpCount = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData);
  4633.                        
  4634.                         if (Prisoner_JumpCount > Guard_JumpCount)
  4635.                         {
  4636.                             PrintToChatAll(CHAT_BANNER, "Won Jump Contest", LR_Player_Prisoner);
  4637.                             KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  4638.                         }
  4639.                         else
  4640.                         {
  4641.                             PrintToChatAll(CHAT_BANNER, "Won Jump Contest", LR_Player_Guard);
  4642.                             KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  4643.                         }
  4644.                     }
  4645.                     case Jump_BrinkOfDeath:
  4646.                     {
  4647.                         new Prisoner_Health = GetClientHealth(LR_Player_Prisoner);
  4648.                         new Guard_Health = GetClientHealth(LR_Player_Guard);
  4649.                        
  4650.                         new loser = (Prisoner_Health > Guard_Health) ? LR_Player_Prisoner : LR_Player_Guard;
  4651.                         new winner = (Prisoner_Health > Guard_Health) ? LR_Player_Guard : LR_Player_Prisoner;
  4652.                        
  4653.                         // TODO *** consider adding this as an option (random or abort)
  4654.                         if (Prisoner_Health == Guard_Health)
  4655.                         {
  4656.                             new random = GetRandomInt(0,1);
  4657.                             winner = (random) ? LR_Player_Prisoner : LR_Player_Guard;
  4658.                             loser = (random) ? LR_Player_Guard : LR_Player_Prisoner;
  4659.                         }
  4660.                        
  4661.                         KillAndReward(loser, winner);
  4662.                        
  4663.                         if (IsPlayerAlive(winner))
  4664.                         {
  4665.                             SetEntityHealth(winner, 100);
  4666.                             if (!gShadow_NoBlock)
  4667.                             {
  4668.                                 BlockEntity(winner, g_Offset_CollisionGroup);
  4669.                             }
  4670.                         }                      
  4671.                        
  4672.                         PrintToChatAll(CHAT_BANNER, "Won Jump Contest", winner);
  4673.                     }
  4674.                 }
  4675.             }
  4676.         }
  4677.     }  
  4678. }
  4679.  
  4680. public Action:Timer_Beacon(Handle:timer)
  4681. {
  4682.     new iNumOfBeacons = GetArraySize(gH_DArray_Beacons);
  4683.     if (iNumOfBeacons <= 0)
  4684.     {
  4685.         g_BeaconTimer = INVALID_HANDLE; // TODO: Remove this because it doesn't make sense?
  4686.         return Plugin_Stop;
  4687.     }
  4688.     static iTimerCount = 1;
  4689.     if (iTimerCount > 99999)
  4690.     {
  4691.         iTimerCount = 1;
  4692.     }
  4693.     iTimerCount++;
  4694.    
  4695.     if (gShadow_LR_HelpBeams)
  4696.     {
  4697.         for (new LRindex = 0; LRindex < GetArraySize(gH_DArray_LR_Partners); LRindex++)
  4698.         {
  4699.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, LRindex, _:Block_LRType);
  4700.            
  4701.             if (type != LR_Rebel)
  4702.             {
  4703.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, LRindex, _:Block_Prisoner);
  4704.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, LRindex, _:Block_Guard);
  4705.                
  4706.                 new clients[2];
  4707.                 clients[0] = LR_Player_Prisoner;
  4708.                 clients[1] = LR_Player_Guard;
  4709.                
  4710.                 // setup beam
  4711.                 decl Float:Prisoner_Pos[3], Float:Guard_Pos[3], Float:distance;
  4712.                 GetClientEyePosition(LR_Player_Prisoner, Prisoner_Pos);
  4713.                 Prisoner_Pos[2] -= 40.0;
  4714.                 GetClientEyePosition(LR_Player_Guard, Guard_Pos);
  4715.                 Guard_Pos[2] -= 40.0;
  4716.                 distance = GetVectorDistance(Prisoner_Pos, Guard_Pos);
  4717.                
  4718.                 if (distance > gShadow_LR_HelpBeams_Distance)
  4719.                 {
  4720.                     TE_SetupBeamPoints(Prisoner_Pos, Guard_Pos, LaserSprite, LaserHalo, 1, 1, 0.1, 5.0, 5.0, 0, 10.0, greyColor, 255);         
  4721.                     TE_Send(clients, 2);
  4722.                     TE_SetupBeamPoints(Guard_Pos, Prisoner_Pos, LaserSprite, LaserHalo, 1, 1, 0.1, 5.0, 5.0, 0, 10.0, greyColor, 255);         
  4723.                     TE_Send(clients, 2);
  4724.                 }
  4725.             }
  4726.         }
  4727.     }
  4728.     new modTime = RoundToCeil(10.0 * gShadow_LR_Beacon_Interval);
  4729.     if ((iTimerCount % modTime) == 0)
  4730.     {
  4731.         new iEntityIndex;
  4732.         for (new idx = 0; idx < iNumOfBeacons; idx++)
  4733.         {
  4734.             iEntityIndex = GetArrayCell(gH_DArray_Beacons, idx);
  4735.             if (IsValidEntity(iEntityIndex))
  4736.             {
  4737.                 decl Float:f_Origin[3];
  4738.                 GetEntPropVector(iEntityIndex, Prop_Data, "m_vecOrigin", f_Origin);
  4739.                 f_Origin[2] += 10.0;
  4740.                 TE_SetupBeamRingPoint(f_Origin, 10.0, 375.0, BeamSprite, HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  4741.                 TE_SendToAll();
  4742.                 // check if it's a weapon or player
  4743.                 if (iEntityIndex < MaxClients+1)
  4744.                 {
  4745.                     new team = GetClientTeam(iEntityIndex);
  4746.                     if (team == CS_TEAM_T)
  4747.                     {
  4748.                         TE_SetupBeamRingPoint(f_Origin, 10.0, 375.0, BeamSprite, HaloSprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0);
  4749.                         TE_SendToAll();
  4750.                     }
  4751.                     else if (team == CS_TEAM_CT)
  4752.                     {
  4753.                         TE_SetupBeamRingPoint(f_Origin, 10.0, 375.0, BeamSprite, HaloSprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0);
  4754.                         TE_SendToAll();
  4755.                     }
  4756.                 }
  4757.                 else
  4758.                 {
  4759.                     TE_SetupBeamRingPoint(f_Origin, 10.0, 375.0, BeamSprite, HaloSprite, 0, 10, 0.6, 10.0, 0.5, yellowColor, 10, 0);
  4760.                     TE_SendToAll();
  4761.                 }
  4762.                 EmitAmbientSound(gShadow_LR_Beacon_Sound, f_Origin, iEntityIndex, SNDLEVEL_RAIDSIREN)
  4763.             }
  4764.             else
  4765.             {
  4766.                 RemoveFromArray(gH_DArray_Beacons, idx);
  4767.             }
  4768.         }
  4769.     }
  4770.    
  4771.     return Plugin_Continue;
  4772. }
  4773.  
  4774. void:AddBeacon(entityIndex)
  4775. {
  4776.     if (IsValidEntity(entityIndex))
  4777.     {
  4778.         PushArrayCell(gH_DArray_Beacons, entityIndex);
  4779.     }
  4780.     if (g_BeaconTimer == INVALID_HANDLE)
  4781.     {
  4782.         g_BeaconTimer = CreateTimer(0.1, Timer_Beacon, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  4783.     }
  4784. }
  4785.  
  4786. void:RemoveBeacon(entityIndex)
  4787. {
  4788.     new iBeaconIndex = FindValueInArray(gH_DArray_Beacons, entityIndex);
  4789.     if (iBeaconIndex != -1)
  4790.     {
  4791.         RemoveFromArray(gH_DArray_Beacons, iBeaconIndex);
  4792.     }
  4793. }
  4794.  
  4795. stock Trail_Attach(client, LRIndex)
  4796. {  
  4797.     decl String:sTempName[64];
  4798.     Format(sTempName, sizeof(sTempName), "PlayerTrail_%d", GetClientUserId(client));
  4799.     DispatchKeyValue(client, "targetname", sTempName);
  4800.    
  4801.     new entIndex = CreateEntityByName("env_spritetrail");
  4802.     if (entIndex > 0 && IsValidEntity(entIndex))
  4803.     {      
  4804.         DispatchKeyValue(entIndex, "parentname", sTempName);
  4805.         DispatchKeyValue(entIndex, "spritename", "materials/sprites/orangelight1.vmt");
  4806.         SetEntPropFloat(entIndex, Prop_Send, "m_flTextureRes", 0.05);
  4807.        
  4808.         DispatchKeyValue(entIndex, "renderamt", "255");
  4809.         DispatchKeyValue(entIndex, "rendercolor", "255 128 0");
  4810.        
  4811.         DispatchKeyValueFloat(entIndex, "lifetime", 15.0);
  4812.         DispatchKeyValueFloat(entIndex, "startwidth", 10.0);
  4813.         DispatchKeyValueFloat(entIndex, "endwidth", 10.0);
  4814.         DispatchKeyValue(entIndex, "rendermode", "5");
  4815.        
  4816.         DispatchSpawn(entIndex);
  4817.         new Float:f_origin[3];
  4818.         GetClientAbsOrigin(client, f_origin);
  4819.         f_origin[2] += 34.0;
  4820.         TeleportEntity(entIndex, f_origin, NULL_VECTOR, NULL_VECTOR);
  4821.         SetVariantString(sTempName);
  4822.         AcceptEntityInput(entIndex, "SetParent", entIndex, entIndex);
  4823.        
  4824.         return entIndex;
  4825.     }
  4826.     return 0;
  4827. }
  4828.  
  4829. stock void:Trail_Remove(client, LRIndex)
  4830. {
  4831.     new ent = g_iClientSpriteEntIndex[client];
  4832.     if (ent != 0)
  4833.     {
  4834.         if (IsValidEntity(ent))
  4835.         {
  4836.             SDKUnhook(ent, SDKHook_SetTransmit, Hook_SetTransmit);
  4837.             AcceptEntityInput(ent, "Kill");
  4838.         }
  4839.         g_iClientSpriteEntIndex[client] = 0;
  4840.     }
  4841. }
  4842.  
  4843. public OnEntityCreated(entity, const String:classname[])
  4844. {
  4845.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  4846.     new bool:bIsDodgeball = false;
  4847.     if (iArraySize > 0)
  4848.     {
  4849.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  4850.         {
  4851.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  4852.             if (type == LR_Dodgeball)
  4853.             {
  4854.                 bIsDodgeball = true;
  4855.             }
  4856.         }
  4857.     }
  4858.     if (bIsDodgeball && StrEqual(classname, "flashbang_projectile"))
  4859.     {
  4860.         SDKHook(entity, SDKHook_Spawn, OnEntitySpawned);
  4861.     }
  4862. }
  4863.  
  4864. public OnEntitySpawned(entity)
  4865. {
  4866.     new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
  4867.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  4868.     if (iArraySize > 0)
  4869.     {
  4870.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  4871.         {
  4872.             new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  4873.             new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  4874.            
  4875.             if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  4876.             {
  4877.                 CreateTimer(0.0, Timer_RemoveThinkTick, entity, TIMER_FLAG_NO_MAPCHANGE);
  4878.             }
  4879.         }
  4880.     }
  4881. }
  4882.  
  4883. public Action:Timer_RemoveThinkTick(Handle:timer, any:entity)
  4884. {
  4885.     SetEntProp(entity, Prop_Data, "m_nNextThinkTick", -1);
  4886.     CreateTimer(gShadow_LR_Dodgeball_SpawnTime, Timer_RemoveFlashbang, entity, TIMER_FLAG_NO_MAPCHANGE);
  4887. }
  4888.  
  4889. public Action:Timer_RemoveFlashbang(Handle:timer, any:entity)
  4890. {
  4891.     if (IsValidEntity(entity))
  4892.     {
  4893.         new client = GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity");
  4894.         AcceptEntityInput(entity, "Kill");
  4895.        
  4896.         if ((client != -1) && IsClientInGame(client) && IsPlayerAlive(client) && Local_IsClientInLR(client))
  4897.         {
  4898.             new flash = CreateEntityByName("weapon_flashbang");
  4899.             DispatchSpawn(flash);
  4900.             EquipPlayerWeapon(client, flash);      
  4901.         }
  4902.     }
  4903. }
  4904.  
  4905. public Action:Timer_Countdown(Handle:timer)
  4906. {
  4907.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  4908.     if (iArraySize == 0)
  4909.     {
  4910.         g_CountdownTimer = INVALID_HANDLE; // TODO: Remove this because it doesn't make sense?
  4911.         return Plugin_Stop;
  4912.     }
  4913.    
  4914.     new bool:bCountdownUsed = false;
  4915.    
  4916.     for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  4917.     {
  4918.         new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  4919.        
  4920.         if (type != LR_Race && type != LR_NoScope && type != LR_JumpContest)
  4921.         {
  4922.             continue;
  4923.         }
  4924.        
  4925.         new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  4926.         new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  4927.         new countdown = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  4928.         if (countdown > 0)
  4929.         {
  4930.             bCountdownUsed = true;
  4931.             PrintCenterText(LR_Player_Prisoner, "LR begins in %i...", countdown);
  4932.             PrintCenterText(LR_Player_Guard, "LR begins in %i...", countdown);
  4933.             SetArrayCell(gH_DArray_LR_Partners, idx, --countdown, _:Block_Global1);
  4934.            
  4935.             // set up laser beams for race points
  4936.             if (type == LR_Race && gShadow_LR_Race_NotifyCTs)
  4937.             {
  4938.                 decl Float:LR_Prisoner_Position[3], Float:f_EndLocation[3];
  4939.                 new Handle:PositionPack = GetArrayCell(gH_DArray_LR_Partners, idx, 9);
  4940.                 ResetPack(PositionPack);
  4941.                 f_EndLocation[0] = ReadPackFloat(PositionPack);
  4942.                 f_EndLocation[1] = ReadPackFloat(PositionPack);
  4943.                 f_EndLocation[2] = ReadPackFloat(PositionPack);
  4944.                 GetClientAbsOrigin(LR_Player_Prisoner, LR_Prisoner_Position);
  4945.                
  4946.                 new clients[2];
  4947.                 clients[0] = LR_Player_Prisoner;
  4948.                 clients[1] = LR_Player_Guard;
  4949.                
  4950.                 TE_SetupBeamPoints(f_EndLocation, LR_Prisoner_Position, LaserSprite, LaserHalo, 1, 1, 1.1, 5.0, 5.0, 0, 10.0, redColor, 200);          
  4951.                 TE_Send(clients, 2);
  4952.                 TE_SetupBeamPoints(LR_Prisoner_Position, f_EndLocation, LaserSprite, LaserHalo, 1, 1, 1.1, 5.0, 5.0, 0, 10.0, redColor, 200);          
  4953.                 TE_Send(clients, 2);
  4954.             }
  4955.         }
  4956.         else if (countdown == 0)
  4957.         {
  4958.             bCountdownUsed = true;
  4959.             SetArrayCell(gH_DArray_LR_Partners, idx, --countdown, _:Block_Global1);
  4960.             switch (type)
  4961.             {
  4962.                 case LR_Race:
  4963.                 {
  4964.                     SetEntityMoveType(LR_Player_Prisoner, MOVETYPE_WALK);
  4965.                     SetEntityMoveType(LR_Player_Guard, MOVETYPE_WALK);
  4966.                    
  4967.                     // make timer to check the race winner
  4968.                     if (g_RaceTimer == INVALID_HANDLE)
  4969.                     {
  4970.                         g_RaceTimer = CreateTimer(0.1, Timer_Race, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
  4971.                     }          
  4972.                 }
  4973.                 case LR_NoScope:
  4974.                 {
  4975.                     // grab weapon choice
  4976.                     new NoScopeWeapon:NS_Selection;
  4977.                     NS_Selection = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);                  
  4978.                     new NSW_Prisoner, NSW_Guard;
  4979.                     switch (NS_Selection)
  4980.                     {
  4981.                         case NSW_AWP:
  4982.                         {
  4983.                             NSW_Prisoner = CreateEntityByName("weapon_awp");
  4984.                             NSW_Guard = CreateEntityByName("weapon_awp");
  4985.                         }
  4986.                         case NSW_Scout:
  4987.                         {
  4988.                             if(g_Game == Game_CSS)
  4989.                             {
  4990.                                 NSW_Prisoner = CreateEntityByName("weapon_scout");
  4991.                                 NSW_Guard = CreateEntityByName("weapon_scout");
  4992.                             }
  4993.                             else if(g_Game == Game_CSGO)
  4994.                             {
  4995.                                 NSW_Prisoner = CreateEntityByName("weapon_ssg08");
  4996.                                 NSW_Guard = CreateEntityByName("weapon_ssg08");
  4997.                             }
  4998.                         }
  4999.                         case NSW_SG550:
  5000.                         {
  5001.                             if(g_Game == Game_CSS)
  5002.                             {
  5003.                                 NSW_Prisoner = CreateEntityByName("weapon_sg550");
  5004.                                 NSW_Guard = CreateEntityByName("weapon_sg550");
  5005.                             }
  5006.                             else if(g_Game == Game_CSGO)
  5007.                             {
  5008.                                 NSW_Prisoner = CreateEntityByName("weapon_scar20");
  5009.                                 NSW_Guard = CreateEntityByName("weapon_scar20");
  5010.                             }
  5011.                         }
  5012.                         case NSW_G3SG1:
  5013.                         {
  5014.                             NSW_Prisoner = CreateEntityByName("weapon_g3sg1");
  5015.                             NSW_Guard = CreateEntityByName("weapon_g3sg1");
  5016.                         }
  5017.                         default:
  5018.                         {
  5019.                             LogError("hit default NS");
  5020.                             NSW_Prisoner = CreateEntityByName("weapon_awp");
  5021.                             NSW_Guard = CreateEntityByName("weapon_awp");
  5022.                         }
  5023.                     }
  5024.                    
  5025.                     DispatchSpawn(NSW_Prisoner);
  5026.                     DispatchSpawn(NSW_Guard);
  5027.                     EquipPlayerWeapon(LR_Player_Prisoner, NSW_Prisoner);
  5028.                     EquipPlayerWeapon(LR_Player_Guard, NSW_Guard);
  5029.                     SetEntData(NSW_Prisoner, g_Offset_Clip1, 99);
  5030.                     SetEntData(NSW_Guard, g_Offset_Clip1, 99);     
  5031.                    
  5032.                     if ((strlen(gShadow_LR_NoScope_Sound) > 0) && !StrEqual(gShadow_LR_NoScope_Sound, "-1"))
  5033.                     {
  5034.                         EmitSoundToAll(gShadow_LR_NoScope_Sound);
  5035.                     }
  5036.                 }
  5037.                 case LR_JumpContest:
  5038.                 {
  5039.                     CreateTimer(13.0, Timer_JumpContestOver, _, TIMER_FLAG_NO_MAPCHANGE);          
  5040.                 }
  5041.             }
  5042.         }
  5043.     }
  5044.     if (bCountdownUsed == false)
  5045.     {
  5046.         g_CountdownTimer = INVALID_HANDLE;
  5047.         return Plugin_Stop;
  5048.     }
  5049.  
  5050.     return Plugin_Continue;
  5051. }
  5052.  
  5053. public Action:Timer_Race(Handle:timer)
  5054. {
  5055.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5056.     new bool:bIsRace = false;
  5057.     if (iArraySize > 0)
  5058.     {
  5059.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5060.         {  
  5061.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5062.             if (type == LR_Race)
  5063.             {
  5064.                 bIsRace = true;
  5065.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5066.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5067.                
  5068.                 decl Float:LR_Prisoner_Position[3], Float:LR_Guard_Position[3], Float:f_EndLocation[3];
  5069.                 new Handle:PositionPack = GetArrayCell(gH_DArray_LR_Partners, idx, 9);
  5070.                 ResetPack(PositionPack);
  5071.                 f_EndLocation[0] = ReadPackFloat(PositionPack);
  5072.                 f_EndLocation[1] = ReadPackFloat(PositionPack);
  5073.                 f_EndLocation[2] = ReadPackFloat(PositionPack);
  5074.                 GetClientAbsOrigin(LR_Player_Prisoner, LR_Prisoner_Position);
  5075.                 GetClientAbsOrigin(LR_Player_Guard, LR_Guard_Position);
  5076.                 // check how close they are to the end point
  5077.                 decl Float:f_PrisonerDistance, Float:f_GuardDistance;
  5078.                 f_PrisonerDistance = GetVectorDistance(LR_Prisoner_Position, f_EndLocation, false);
  5079.                 f_GuardDistance = GetVectorDistance(LR_Guard_Position, f_EndLocation, false);
  5080.                
  5081.                 if (f_PrisonerDistance < Float:75.0 || f_GuardDistance < Float:75.0)
  5082.                 {
  5083.                     if (f_PrisonerDistance < f_GuardDistance)
  5084.                     {
  5085.                         KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  5086.                         PrintToChatAll(CHAT_BANNER, "Race Won", LR_Player_Prisoner);
  5087.                     }
  5088.                     else
  5089.                     {
  5090.                         KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  5091.                         PrintToChatAll(CHAT_BANNER, "Race Won", LR_Player_Guard);
  5092.                     }
  5093.                 }
  5094.                
  5095.                 // update end location beam
  5096.                 TE_SetupBeamRingPoint(f_EndLocation, 100.0, 110.0, BeamSprite, HaloSprite, 0, 15, 0.2, 7.0, 1.0, greenColor, 1, 0);
  5097.                 TE_SendToAll();                
  5098.             }
  5099.         }
  5100.     }
  5101.     if (!bIsRace)
  5102.     {
  5103.         g_RaceTimer = INVALID_HANDLE;
  5104.         return Plugin_Stop;
  5105.     }
  5106.  
  5107.     return Plugin_Continue;
  5108. }
  5109.  
  5110. public RPSmenuHandler(Handle:menu, MenuAction:action, client, param2)
  5111. {
  5112.     if (action == MenuAction_Select)
  5113.     {
  5114.         // find out which LR this is for
  5115.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5116.         {
  5117.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5118.             if (type == LR_RockPaperScissors)
  5119.             {
  5120.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5121.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard)
  5122.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  5123.                 {
  5124.                     new RPS_Prisoner_Choice = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  5125.                     new RPS_Guard_Choice = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  5126.                    
  5127.                     if (client == LR_Player_Prisoner)
  5128.                     {
  5129.                         RPS_Prisoner_Choice = param2;
  5130.                         SetArrayCell(gH_DArray_LR_Partners, idx, RPS_Prisoner_Choice, 5);
  5131.                     }
  5132.                     else if (client == LR_Player_Guard)
  5133.                     {
  5134.                         RPS_Guard_Choice = param2;
  5135.                         SetArrayCell(gH_DArray_LR_Partners, idx, RPS_Guard_Choice, _:Block_Global2);
  5136.                     }
  5137.                    
  5138.                     if ((RPS_Guard_Choice != -1) && (RPS_Prisoner_Choice != -1))
  5139.                     {
  5140.                         // decide who wins -- rock 0 paper 1 scissors 2
  5141.                         decl String:RPSr[64], String:RPSp[64], String:RPSs[64], String:RPSc1[64], String:RPSc2[64];
  5142.                         Format(RPSr, sizeof(RPSr), "%T", "Rock", LR_Player_Prisoner);
  5143.                         Format(RPSp, sizeof(RPSp), "%T", "Paper", LR_Player_Prisoner);
  5144.                         Format(RPSs, sizeof(RPSs), "%T", "Scissors", LR_Player_Prisoner);
  5145.        
  5146.                         switch (RPS_Prisoner_Choice)
  5147.                         {
  5148.                             case 0:
  5149.                             {
  5150.                                 strcopy(RPSc1, sizeof(RPSc1), RPSr);
  5151.                             }
  5152.                             case 1:
  5153.                             {
  5154.                                 strcopy(RPSc1, sizeof(RPSc1), RPSp);
  5155.                             }
  5156.                             case 2:
  5157.                             {
  5158.                                 strcopy(RPSc1, sizeof(RPSc1), RPSs);
  5159.                             }
  5160.                         }
  5161.                         switch (RPS_Guard_Choice)
  5162.                         {
  5163.                             case 0:
  5164.                             {
  5165.                                 strcopy(RPSc2, sizeof(RPSc2), RPSr);
  5166.                             }
  5167.                             case 1:
  5168.                             {
  5169.                                 strcopy(RPSc2, sizeof(RPSc2), RPSp);
  5170.                             }
  5171.                             case 2:
  5172.                             {
  5173.                                 strcopy(RPSc2, sizeof(RPSc2), RPSs);
  5174.                             }
  5175.                         }
  5176.        
  5177.                         if (RPS_Prisoner_Choice == RPS_Guard_Choice) // tie
  5178.                         {
  5179.                             if (client == LR_Player_Prisoner)
  5180.                             {
  5181.                                 if (gShadow_SendGlobalMsgs)
  5182.                                 {
  5183.                                     PrintToChatAll(CHAT_BANNER, "LR RPS Tie", LR_Player_Prisoner, RPSc2, LR_Player_Guard, RPSc1);
  5184.                                 }
  5185.                                 else
  5186.                                 {
  5187.                                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "LR RPS Tie", LR_Player_Prisoner, RPSc2, LR_Player_Guard, RPSc1);
  5188.                                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "LR RPS Tie", LR_Player_Prisoner, RPSc2, LR_Player_Guard, RPSc1);
  5189.                                 }
  5190.                             }
  5191.                             else
  5192.                             {
  5193.                                 if (gShadow_SendGlobalMsgs)
  5194.                                 {
  5195.                                     PrintToChatAll(CHAT_BANNER, "LR RPS Tie", LR_Player_Guard, RPSc1, LR_Player_Prisoner, RPSc2);
  5196.                                 }
  5197.                                 else
  5198.                                 {
  5199.                                     PrintToChat(LR_Player_Guard, CHAT_BANNER, "LR RPS Tie", LR_Player_Guard, RPSc1, LR_Player_Prisoner, RPSc2);
  5200.                                     PrintToChat(LR_Player_Prisoner, CHAT_BANNER, "LR RPS Tie", LR_Player_Guard, RPSc1, LR_Player_Prisoner, RPSc2);
  5201.                                 }
  5202.                             }
  5203.                            
  5204.                             // redo menu
  5205.                             SetArrayCell(gH_DArray_LR_Partners, idx, -1, _:Block_Global1);
  5206.                             SetArrayCell(gH_DArray_LR_Partners, idx, -1, _:Block_Global2);
  5207.                             new Handle:rpsmenu1 = CreateMenu(RPSmenuHandler);
  5208.                             SetMenuTitle(rpsmenu1, "%T", "Rock Paper Scissors", LR_Player_Prisoner);
  5209.                             SetArrayCell(gH_DArray_LR_Partners, idx, rpsmenu1, _:Block_PrisonerData);
  5210.                
  5211.                             decl String:r1[32], String:p1[64], String:s1[64];
  5212.                             Format(r1, sizeof(r1), "%T", "Rock", LR_Player_Prisoner);
  5213.                             Format(p1, sizeof(p1), "%T", "Paper", LR_Player_Prisoner);
  5214.                             Format(s1, sizeof(s1), "%T", "Scissors", LR_Player_Prisoner);
  5215.                             AddMenuItem(rpsmenu1, "0", r1);
  5216.                             AddMenuItem(rpsmenu1, "1", p1);
  5217.                             AddMenuItem(rpsmenu1, "2", s1);
  5218.                
  5219.                             SetMenuExitButton(rpsmenu1, true);
  5220.                             DisplayMenu(rpsmenu1, LR_Player_Prisoner, 15);
  5221.                
  5222.                             new Handle:rpsmenu2 = CreateMenu(RPSmenuHandler);
  5223.                             SetMenuTitle(rpsmenu2, "%T", "Rock Paper Scissors", LR_Player_Guard);
  5224.                             SetArrayCell(gH_DArray_LR_Partners, idx, rpsmenu2, _:Block_GuardData);
  5225.                
  5226.                             decl String:r2[32], String:p2[64], String:s2[64];
  5227.                             Format(r2, sizeof(r2), "%T", "Rock", LR_Player_Guard);
  5228.                             Format(p2, sizeof(p2), "%T", "Paper", LR_Player_Guard);
  5229.                             Format(s2, sizeof(s2), "%T", "Scissors", LR_Player_Guard);
  5230.                             AddMenuItem(rpsmenu2, "0", r2);
  5231.                             AddMenuItem(rpsmenu2, "1", p2);
  5232.                             AddMenuItem(rpsmenu2, "2", s2);
  5233.                
  5234.                             SetMenuExitButton(rpsmenu2, true);
  5235.                             DisplayMenu(rpsmenu2, LR_Player_Guard, 15);
  5236.                         }
  5237.                         // if THIS player has won
  5238.                         else if ( (RPS_Guard_Choice == 0 && RPS_Prisoner_Choice == 2) || (RPS_Guard_Choice == 1 && RPS_Prisoner_Choice == 0) || (RPS_Guard_Choice == 2 && RPS_Prisoner_Choice == 1) )
  5239.                         {
  5240.                             if (client == LR_Player_Prisoner)
  5241.                             {
  5242.                                 KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  5243.                                 PrintToChatAll(CHAT_BANNER, "LR RPS Done", LR_Player_Prisoner, RPSc1, LR_Player_Guard, RPSc2, LR_Player_Prisoner);
  5244.                             }
  5245.                             else
  5246.                             {
  5247.                                 KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  5248.                                 PrintToChatAll(CHAT_BANNER, "LR RPS Done", LR_Player_Prisoner, RPSc1, LR_Player_Guard, RPSc2, LR_Player_Guard);
  5249.                             }
  5250.                         }
  5251.                         // otherwise THIS player has lost
  5252.                         else
  5253.                         {
  5254.                             if (client == LR_Player_Guard)
  5255.                             {
  5256.                                 KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  5257.                                 PrintToChatAll(CHAT_BANNER, "LR RPS Done", LR_Player_Prisoner, RPSc1, LR_Player_Guard, RPSc2, LR_Player_Prisoner);
  5258.                             }
  5259.                             else
  5260.                             {
  5261.                                 KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  5262.                                 PrintToChatAll(CHAT_BANNER, "LR RPS Done", LR_Player_Prisoner, RPSc1, LR_Player_Guard, RPSc2, LR_Player_Guard);
  5263.                             }
  5264.                         }              
  5265.                     }              
  5266.                 }      
  5267.             }          
  5268.         }
  5269.  
  5270.     }
  5271.     else if (action == MenuAction_Cancel)
  5272.     {
  5273.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5274.         {
  5275.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5276.             if (type == LR_RockPaperScissors)
  5277.             {
  5278.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5279.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard)
  5280.                 if (client == LR_Player_Prisoner || client == LR_Player_Guard)
  5281.                 {
  5282.                     if (IsClientInGame(client) && IsPlayerAlive(client))
  5283.                     {
  5284.                         ForcePlayerSuicide(client);
  5285.                         PrintToChatAll(CHAT_BANNER, "LR RPS No Answer", client);
  5286.                     }
  5287.                 }  
  5288.             }
  5289.         }
  5290.     }
  5291.     else if (action == MenuAction_End)
  5292.     {
  5293.         CloseHandle(menu);
  5294.     }
  5295. }
  5296.  
  5297. public Action:Timer_DodgeballCheckCheaters(Handle:timer)
  5298. {
  5299.     // is there still a gun toss LR going on?
  5300.     new bool:bDodgeball = false;
  5301.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5302.     if (iArraySize > 0)
  5303.     {
  5304.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5305.         {  
  5306.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5307.             if (type == LR_Dodgeball)
  5308.             {
  5309.                 bDodgeball = true;
  5310.                
  5311.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5312.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5313.                
  5314.                 if (IsValidEntity(LR_Player_Prisoner) && (GetClientHealth(LR_Player_Prisoner) > 1))
  5315.                 {
  5316.                     SetEntityHealth(LR_Player_Prisoner, 1);
  5317.                 }
  5318.                 if (IsValidEntity(LR_Player_Guard) && (GetClientHealth(LR_Player_Guard) > 1))
  5319.                 {
  5320.                     SetEntityHealth(LR_Player_Guard, 1);
  5321.                 }
  5322.             }
  5323.         }
  5324.     }
  5325.    
  5326.     if (!bDodgeball)
  5327.     {
  5328.         g_DodgeballTimer = INVALID_HANDLE;
  5329.         return Plugin_Stop;
  5330.     }
  5331.  
  5332.     return Plugin_Continue;
  5333. }
  5334.  
  5335. public Action:Timer_HotPotatoDone(Handle:timer, any:HotPotato_ID)
  5336. {
  5337.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5338.     if (iArraySize > 0)
  5339.     {
  5340.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5341.         {  
  5342.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5343.             new thisHotPotato_ID = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);          
  5344.             if ((type == LR_HotPotato) && (HotPotato_ID == thisHotPotato_ID))
  5345.             {
  5346.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5347.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5348.                
  5349.                 new HPloser = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  5350.                 new HPwinner = ((HPloser == LR_Player_Prisoner) ? LR_Player_Guard : LR_Player_Prisoner);
  5351.                
  5352.                 KillAndReward(HPloser, HPwinner);
  5353.                 PrintToChatAll(CHAT_BANNER, "HP Win", HPwinner, HPloser);
  5354.                
  5355.                 if (gShadow_LR_HotPotato_Mode != 2)
  5356.                 {
  5357.                     SetEntPropFloat(HPwinner, Prop_Data, "m_flLaggedMovementValue", 1.0);
  5358.                 }
  5359.             }
  5360.         }
  5361.     }
  5362.     return Plugin_Stop;
  5363. }
  5364.  
  5365. public Action:Timer_ChickenFight(Handle:timer)
  5366. {
  5367.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5368.     new bool:bIsChickenFight = false;
  5369.     if (iArraySize > 0)
  5370.     {
  5371.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5372.         {  
  5373.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5374.             if (type == LR_ChickenFight)
  5375.             {
  5376.                 bIsChickenFight = true;
  5377.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5378.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5379.                 new p1EntityBelow = GetEntDataEnt2(LR_Player_Prisoner, g_Offset_GroundEnt);
  5380.                 new p2EntityBelow = GetEntDataEnt2(LR_Player_Guard, g_Offset_GroundEnt);
  5381.                
  5382.                 if (p1EntityBelow == LR_Player_Guard)
  5383.                 {
  5384.                     if (gShadow_LR_ChickenFight_Slay)
  5385.                     {
  5386.                         PrintToChatAll(CHAT_BANNER, "Chicken Fight Win And Slay", LR_Player_Prisoner, LR_Player_Guard);
  5387.                         KillAndReward(LR_Player_Guard, LR_Player_Prisoner);
  5388.                     }
  5389.                     else
  5390.                     {
  5391.                         PrintToChatAll(CHAT_BANNER, "Chicken Fight Win", LR_Player_Prisoner);
  5392.                         PrintToChat(LR_Player_Prisoner, "Chicken Fight Kill Loser", LR_Player_Guard);
  5393.                        
  5394.                         GivePlayerItem(LR_Player_Prisoner, "weapon_knife");
  5395.                        
  5396.                         SetEntityRenderColor(LR_Player_Guard, gShadow_LR_ChickenFight_C_Red, gShadow_LR_ChickenFight_C_Green,
  5397.                             gShadow_LR_ChickenFight_C_Blue, 255);
  5398.                            
  5399.                         bIsChickenFight = false;
  5400.                     }
  5401.                 }
  5402.                 else if (p2EntityBelow == LR_Player_Prisoner)
  5403.                 {
  5404.                     if (gShadow_LR_ChickenFight_Slay)
  5405.                     {
  5406.                         PrintToChatAll(CHAT_BANNER, "Chicken Fight Win And Slay", LR_Player_Guard, LR_Player_Prisoner);
  5407.                         KillAndReward(LR_Player_Prisoner, LR_Player_Guard);
  5408.                     }
  5409.                     else
  5410.                     {
  5411.                         PrintToChatAll(CHAT_BANNER, "Chicken Fight Win", LR_Player_Guard);
  5412.                         PrintToChat(LR_Player_Guard, "Chicken Fight Kill Loser", LR_Player_Prisoner);
  5413.                        
  5414.                         GivePlayerItem(LR_Player_Guard, "weapon_knife");
  5415.                        
  5416.                         SetEntityRenderColor(LR_Player_Prisoner, gShadow_LR_ChickenFight_C_Red, gShadow_LR_ChickenFight_C_Green,
  5417.                             gShadow_LR_ChickenFight_C_Blue, 255);
  5418.                            
  5419.                         bIsChickenFight = false;
  5420.                     }
  5421.                 }
  5422.             }
  5423.         }
  5424.     }
  5425.     if (!bIsChickenFight)
  5426.     {
  5427.         g_ChickenFightTimer = INVALID_HANDLE;
  5428.         return Plugin_Stop;
  5429.     }
  5430.    
  5431.     return Plugin_Continue;
  5432. }
  5433.  
  5434. // Gun Toss distance meter and BeamSprite application
  5435. public Action:Timer_GunToss(Handle:timer)
  5436. {
  5437.     // is there still a gun toss LR going on?
  5438.     new iNumGunTosses = 0;
  5439.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5440.    
  5441.     new String:sHintTextGlobal[200];
  5442.    
  5443.     if (iArraySize > 0)
  5444.     {
  5445.         for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5446.         {  
  5447.             new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5448.             if (type == LR_GunToss)
  5449.             {
  5450.                 iNumGunTosses++;
  5451.                
  5452.                 new GTp1done, GTp2done, GTp1dropped, GTp2dropped, GTdeagle1, GTdeagle2;
  5453.                 GTp1done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global3);
  5454.                 GTp2done = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global4);
  5455.                 GTp1dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  5456.                 GTp2dropped = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global2);
  5457.                 GTdeagle1 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_PrisonerData));
  5458.                 GTdeagle2 = EntRefToEntIndex(GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_GuardData));
  5459.                 decl Float:GTdeagle1pos[3], Float:GTdeagle2pos[3];
  5460.                 decl Float:GTdeagle1lastpos[3], Float:GTdeagle2lastpos[3];
  5461.                 new Handle:PositionDataPack = Handle:GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_DataPackHandle);
  5462.                 ResetPack(PositionDataPack);
  5463.                 GTdeagle1lastpos[0] = ReadPackFloat(PositionDataPack);
  5464.                 GTdeagle1lastpos[1] = ReadPackFloat(PositionDataPack);
  5465.                 GTdeagle1lastpos[2] = ReadPackFloat(PositionDataPack);
  5466.                 GTdeagle2lastpos[0] = ReadPackFloat(PositionDataPack);
  5467.                 GTdeagle2lastpos[1] = ReadPackFloat(PositionDataPack);
  5468.                 GTdeagle2lastpos[2] = ReadPackFloat(PositionDataPack);
  5469.                 decl Float:GTp1droppos[3], Float:GTp2droppos[3];
  5470.                 GTp1droppos[0] = ReadPackFloat(PositionDataPack);
  5471.                 GTp1droppos[1] = ReadPackFloat(PositionDataPack);
  5472.                 GTp1droppos[2] = ReadPackFloat(PositionDataPack);
  5473.                 GTp2droppos[0] = ReadPackFloat(PositionDataPack);
  5474.                 GTp2droppos[1] = ReadPackFloat(PositionDataPack);
  5475.                 GTp2droppos[2] = ReadPackFloat(PositionDataPack);
  5476.                 decl Float:GTp1jumppos[3], Float:GTp2jumppos[3];
  5477.                 GTp1jumppos[0] = ReadPackFloat(PositionDataPack);
  5478.                 GTp1jumppos[1] = ReadPackFloat(PositionDataPack);
  5479.                 GTp1jumppos[2] = ReadPackFloat(PositionDataPack);
  5480.                 GTp2jumppos[0] = ReadPackFloat(PositionDataPack);
  5481.                 GTp2jumppos[1] = ReadPackFloat(PositionDataPack);
  5482.                 GTp2jumppos[2] = ReadPackFloat(PositionDataPack);
  5483.            
  5484.                 GetEntPropVector(GTdeagle1, Prop_Data, "m_vecOrigin", GTdeagle1pos);
  5485.                 if (GTp1dropped && !GTp1done)
  5486.                 {
  5487.                     if (GetVectorDistance(GTdeagle1lastpos, GTdeagle1pos) < 3.00)
  5488.                     {
  5489.                         GTp1done = true;
  5490.                         SetArrayCell(gH_DArray_LR_Partners, idx, GTp1done, _:Block_Global3);
  5491.                     }
  5492.                     else
  5493.                     {
  5494.                         GTdeagle1lastpos[0] = GTdeagle1pos[0];
  5495.                         GTdeagle1lastpos[1] = GTdeagle1pos[1];
  5496.                         GTdeagle1lastpos[2] = GTdeagle1pos[2];
  5497.                         SetPackPosition(PositionDataPack, 0);
  5498.                         WritePackFloat(PositionDataPack, GTdeagle1lastpos[0]);
  5499.                         WritePackFloat(PositionDataPack, GTdeagle1lastpos[1]);
  5500.                         WritePackFloat(PositionDataPack, GTdeagle1lastpos[2]);
  5501.                     }
  5502.                 }
  5503.                 else if (GTp1dropped && GTp1done)
  5504.                 {
  5505.                     new Float:fBeamWidth = (g_Game == Game_CSS ? 10.0 : 2.0);
  5506.                     new Float:fRefreshRate = (g_Game == Game_CSS ? 0.1 : 1.0);
  5507.                     switch (gShadow_LR_GunToss_MarkerMode)
  5508.                     {
  5509.                         case 0:
  5510.                         {
  5511.                             decl Float:beamStartP1[3];     
  5512.                             new Float:f_SubtractVec[3] = {0.0, 0.0, -30.0};
  5513.                             MakeVectorFromPoints(f_SubtractVec, GTdeagle1lastpos, beamStartP1);
  5514.                             TE_SetupBeamPoints(beamStartP1, GTdeagle1lastpos, BeamSprite, 0, 0, 0, fRefreshRate, fBeamWidth, fBeamWidth, 7, 0.0, redColor, 0);
  5515.                         }
  5516.                         case 1:
  5517.                         {
  5518.                             TE_SetupBeamPoints(GTp1droppos, GTdeagle1lastpos, BeamSprite, 0, 0, 0, fRefreshRate, fBeamWidth, fBeamWidth, 7, 0.0, redColor, 0);
  5519.                         }
  5520.                     }
  5521.  
  5522.                     TE_SendToAll();            
  5523.                 }
  5524.                
  5525.                 GetEntPropVector(GTdeagle2, Prop_Data, "m_vecOrigin", GTdeagle2pos);
  5526.                 if (GTp2dropped && !GTp2done)
  5527.                 {                  
  5528.                     if (GetVectorDistance(GTdeagle2lastpos, GTdeagle2pos) < 3.00)
  5529.                     {
  5530.                         GTp2done = true;
  5531.                         SetArrayCell(gH_DArray_LR_Partners, idx, GTp2done, _:Block_Global4);                       
  5532.                     }
  5533.                     else
  5534.                     {
  5535.                         GTdeagle2lastpos[0] = GTdeagle2pos[0];
  5536.                         GTdeagle2lastpos[1] = GTdeagle2pos[1];
  5537.                         GTdeagle2lastpos[2] = GTdeagle2pos[2];
  5538.  
  5539.                         SetPackPosition(PositionDataPack, 24);
  5540.                         WritePackFloat(PositionDataPack, GTdeagle2lastpos[0]);
  5541.                         WritePackFloat(PositionDataPack, GTdeagle2lastpos[1]);
  5542.                         WritePackFloat(PositionDataPack, GTdeagle2lastpos[2]);
  5543.                     }
  5544.                 }
  5545.                 else if (GTp2dropped && GTp2done)
  5546.                 {
  5547.                     new Float:fBeamWidth = (g_Game == Game_CSS ? 10.0 : 2.0);
  5548.                     new Float:fRefreshRate = (g_Game == Game_CSS ? 0.1 : 1.0);
  5549.                     switch (gShadow_LR_GunToss_MarkerMode)
  5550.                     {
  5551.                         case 0:
  5552.                         {
  5553.                             decl Float:beamStartP2[3];
  5554.                             new Float:f_SubtractVec[3] = {0.0, 0.0, -30.0};
  5555.                             MakeVectorFromPoints(f_SubtractVec, GTdeagle2lastpos, beamStartP2);
  5556.                             TE_SetupBeamPoints(beamStartP2, GTdeagle2lastpos, BeamSprite, 0, 0, 0, fRefreshRate, fBeamWidth, fBeamWidth, 7, 0.0, blueColor, 0);
  5557.                         }
  5558.                         case 1:
  5559.                         {
  5560.                             TE_SetupBeamPoints(GTp2droppos, GTdeagle2lastpos, BeamSprite, 0, 0, 0, fRefreshRate, fBeamWidth, fBeamWidth, 7, 0.0, blueColor, 0);
  5561.                         }
  5562.                     }
  5563.                    
  5564.                     TE_SendToAll();            
  5565.                 }
  5566.                
  5567.                 // broadcast distance
  5568.                 if (gShadow_LR_GunToss_ShowMeter)
  5569.                 {
  5570.                     new Float:f_GuardDistance;
  5571.                     if (GTp2dropped)
  5572.                     {
  5573.                         f_GuardDistance = GetVectorDistance(GTp2jumppos, GTdeagle2lastpos);
  5574.                     }
  5575.                     else
  5576.                     {
  5577.                         f_GuardDistance = 0.0;
  5578.                     }
  5579.                    
  5580.                     new Float:f_PrisonerDistance;
  5581.                     if (GTp1dropped)
  5582.                     {
  5583.                         f_PrisonerDistance = GetVectorDistance(GTp1jumppos, GTdeagle1lastpos);
  5584.                     }
  5585.                     else
  5586.                     {
  5587.                         f_PrisonerDistance = 0.0;
  5588.                     }
  5589.  
  5590.                     new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5591.                     new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5592.                     if (!gShadow_SendGlobalMsgs)
  5593.                     {
  5594.                         if (g_Game == Game_CSS)
  5595.                         {
  5596.                             PrintHintText(LR_Player_Prisoner, "%t\n \n%N: %3.1f \n%N: %3.1f", "Distance Meter", LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5597.                             PrintHintText(LR_Player_Guard, "%t\n \n%N: %3.1f \n%N: %3.1f", "Distance Meter", LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5598.                         }
  5599.                         else if (g_Game == Game_CSGO)
  5600.                         {
  5601.                             PrintHintText(LR_Player_Prisoner, "%t\n%N: %3.1f \n%N: %3.1f", "Distance Meter", LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5602.                             PrintHintText(LR_Player_Guard, "%t\n%N: %3.1f \n%N: %3.1f", "Distance Meter", LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5603.                         }
  5604.                     }
  5605.                     else
  5606.                     {
  5607.                         if (g_Game == Game_CSS)
  5608.                         {
  5609.                             Format(sHintTextGlobal, sizeof(sHintTextGlobal), "%s \n \n %N: %3.1f \n %N: %3.1f", sHintTextGlobal, LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5610.                         }
  5611.                         else if (g_Game == Game_CSGO)
  5612.                         {
  5613.                             Format(sHintTextGlobal, sizeof(sHintTextGlobal), "%s \n %N: %3.1f \n %N: %3.1f", sHintTextGlobal, LR_Player_Prisoner, f_PrisonerDistance, LR_Player_Guard, f_GuardDistance);
  5614.                         }
  5615.                     }
  5616.                 }
  5617.             }
  5618.         }
  5619.     }
  5620.    
  5621.     if (gShadow_LR_GunToss_ShowMeter && gShadow_SendGlobalMsgs && (iNumGunTosses > 0))
  5622.     {
  5623.         PrintHintTextToAll("%t %s", "Distance Meter", sHintTextGlobal);
  5624.     }
  5625.    
  5626.     if (iNumGunTosses <= 0)
  5627.     {
  5628.         g_GunTossTimer = INVALID_HANDLE;
  5629.         return Plugin_Stop;
  5630.     }
  5631.    
  5632.     return Plugin_Continue;
  5633. }
  5634.  
  5635. DecideRebelsFate(rebeller, LRIndex, victim=0)
  5636. {
  5637.     new iClientWeapon = GetEntDataEnt2(rebeller, g_Offset_ActiveWeapon);
  5638.     decl String:sWeaponName[32];
  5639.     if (IsValidEntity(iClientWeapon))
  5640.     {
  5641.         GetEdictClassname(iClientWeapon, sWeaponName, sizeof(sWeaponName));
  5642.         ReplaceString(sWeaponName, sizeof(sWeaponName), "weapon_", "");
  5643.     }
  5644.     else
  5645.     {
  5646.         Format(sWeaponName, sizeof(sWeaponName), "unknown");
  5647.     }
  5648.    
  5649.     // grab the current LR and override default rebel action if requested (backward compatibility)
  5650.     new rebelAction;   
  5651.     new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, LRIndex, _:Block_LRType);
  5652.     switch (type)
  5653.     {
  5654.         case LR_KnifeFight:
  5655.         {
  5656.             rebelAction = gShadow_LR_KnifeFight_Rebel+1;
  5657.         }
  5658.         case LR_ChickenFight:
  5659.         {
  5660.             rebelAction = gShadow_LR_ChickenFight_Rebel+1;
  5661.         }
  5662.         case LR_HotPotato:
  5663.         {
  5664.             rebelAction = gShadow_LR_HotPotato_Rebel+1;
  5665.         }      
  5666.         default:
  5667.         {
  5668.             rebelAction = gShadow_RebelAction;
  5669.         }
  5670.     }
  5671.    
  5672.     switch (rebelAction)
  5673.     {
  5674.         case 0:
  5675.         {
  5676.             // take no action here (for now)
  5677.         }
  5678.         case 1:
  5679.         {
  5680.             if (IsPlayerAlive(rebeller))
  5681.             {
  5682.                 StripAllWeapons(rebeller);
  5683.             }
  5684.             CleanupLastRequest(rebeller, LRIndex);
  5685.             RemoveFromArray(gH_DArray_LR_Partners, LRIndex);
  5686.             if (victim == 0)
  5687.             {
  5688.                 PrintToChatAll(CHAT_BANNER, "LR Interference Abort - No Victim", rebeller, sWeaponName);
  5689.             }
  5690.             else if (victim == -1)
  5691.             {
  5692.                 PrintToChatAll(CHAT_BANNER, "LR Cheating Abort", rebeller);
  5693.             }
  5694.             else
  5695.             {
  5696.                 PrintToChatAll(CHAT_BANNER, "LR Interference Abort", rebeller, victim, sWeaponName);   
  5697.             }  
  5698.         }
  5699.         case 2:
  5700.         {
  5701.             if (IsPlayerAlive(rebeller))
  5702.             {
  5703.                 ForcePlayerSuicide(rebeller);
  5704.             }
  5705.             if (victim == 0)
  5706.             {
  5707.                 PrintToChatAll(CHAT_BANNER, "LR Interference Slay - No Victim", rebeller, sWeaponName);
  5708.             }
  5709.             else if (victim == -1)
  5710.             {
  5711.                 PrintToChatAll(CHAT_BANNER, "LR Cheating Slay", rebeller);
  5712.             }
  5713.             else
  5714.             {
  5715.                 PrintToChatAll(CHAT_BANNER, "LR Interference Slay", rebeller, victim, sWeaponName);
  5716.             }      
  5717.         }
  5718.     }
  5719. }
  5720.  
  5721. public Action:Timer_BeerGoggles(Handle:timer)
  5722. {
  5723.     static timerCount = 1;
  5724.     timerCount++;
  5725.     if (timerCount > 160)
  5726.     {
  5727.         timerCount = 1;
  5728.     }
  5729.    
  5730.     decl Float:vecPunch[3];
  5731.     new Float:drunkMultiplier = float(gShadow_LR_KnifeFight_Drunk);
  5732.    
  5733.     new iArraySize = GetArraySize(gH_DArray_LR_Partners);
  5734.     if (iArraySize == 0)
  5735.     {
  5736.         g_BeerGogglesTimer = INVALID_HANDLE;
  5737.         return Plugin_Stop;
  5738.     }
  5739.     for (new idx = 0; idx < GetArraySize(gH_DArray_LR_Partners); idx++)
  5740.     {
  5741.         new LastRequest:type = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_LRType);
  5742.         if (type == LR_KnifeFight)
  5743.         {
  5744.             new KnifeType:KnifeChoice = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Global1);
  5745.             if (KnifeChoice == Knife_Drunk)
  5746.             {
  5747.                 new LR_Player_Prisoner = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Prisoner);
  5748.                 new LR_Player_Guard = GetArrayCell(gH_DArray_LR_Partners, idx, _:Block_Guard);
  5749.                
  5750.                 switch (timerCount % 4)
  5751.                 {
  5752.                     case 0:
  5753.                     {
  5754.                         vecPunch[0] = drunkMultiplier*5.0;
  5755.                         vecPunch[1] = drunkMultiplier*5.0;
  5756.                         vecPunch[2] = drunkMultiplier*-5.0;
  5757.                     }
  5758.                     case 1:
  5759.                     {
  5760.                         vecPunch[0] = drunkMultiplier*-5.0;
  5761.                         vecPunch[1] = drunkMultiplier*-5.0;
  5762.                         vecPunch[2] = drunkMultiplier*5.0;
  5763.                     }
  5764.                     case 2:
  5765.                     {
  5766.                         vecPunch[0] = drunkMultiplier*5.0;
  5767.                         vecPunch[1] = drunkMultiplier*-5.0;
  5768.                         vecPunch[2] = drunkMultiplier*5.0;
  5769.                     }
  5770.                     case 3:
  5771.                     {
  5772.                         vecPunch[0] = drunkMultiplier*-5.0;
  5773.                         vecPunch[1] = drunkMultiplier*5.0;
  5774.                         vecPunch[2] = drunkMultiplier*-5.0;
  5775.                     }                  
  5776.                 }
  5777.                 SetEntDataVector(LR_Player_Prisoner, g_Offset_PunchAngle, vecPunch, true)
  5778.                 SetEntDataVector(LR_Player_Guard, g_Offset_PunchAngle, vecPunch, true);
  5779.             }
  5780.         }
  5781.     }
  5782.     return Plugin_Continue;
  5783. }
  5784.  
  5785. KillAndReward(loser, victor)
  5786. {
  5787.     ForcePlayerSuicide(loser);
  5788.     if (IsClientInGame(victor))
  5789.     {
  5790.         if(g_Game == Game_CSS)
  5791.         {
  5792.             new iFrags = GetEntProp(victor, Prop_Data, "m_iFrags");
  5793.             iFrags += gShadow_LR_VictorPoints;
  5794.             SetEntProp(victor, Prop_Data, "m_iFrags", iFrags);
  5795.         }
  5796.     }
  5797. }
  5798.  
  5799. UpdatePlayerCounts(&Prisoners, &Guards, &iNumGuardsAvailable)
  5800. {
  5801.     for(new i = 1; i <= MaxClients; i++)
  5802.     {
  5803.         if (IsClientInGame(i) && IsPlayerAlive(i))
  5804.         {
  5805.             if (GetClientTeam(i) == CS_TEAM_T)
  5806.             {
  5807.                 Prisoners++;
  5808.             }
  5809.             else if (GetClientTeam(i) == CS_TEAM_CT)
  5810.             {
  5811.                 Guards++;
  5812.                 if (!g_bInLastRequest[i])
  5813.                 {
  5814.                     iNumGuardsAvailable++;
  5815.                 }
  5816.             }
  5817.         }
  5818.     }
  5819. }
Add Comment
Please, Sign In to add comment