Advertisement
Guest User

Untitled

a guest
Feb 5th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.33 KB | None | 0 0
  1. /*
  2. * MyJailbreak - Free For All Event Day Plugin.
  3. * by: shanapu
  4. * https://github.com/shanapu/MyJailbreak/
  5. *
  6. * This file is part of the MyJailbreak SourceMod Plugin.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it under
  9. * the terms of the GNU General Public License, version 3.0, as published by the
  10. * Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. * details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21.  
  22. /******************************************************************************
  23. STARTUP
  24. ******************************************************************************/
  25.  
  26.  
  27. //Includes
  28. #include <sourcemod>
  29. #include <sdktools>
  30. #include <sdkhooks>
  31. #include <cstrike>
  32. #include <emitsoundany>
  33. #include <colors>
  34. #include <autoexecconfig>
  35. #include <hosties>
  36. #include <lastrequest>
  37. #include <warden>
  38. #include <smartjaildoors>
  39. #include <mystocks>
  40. #include <myjailbreak>
  41. #include <store>
  42.  
  43.  
  44. //Compiler Options
  45. #pragma semicolon 1
  46. #pragma newdecls required
  47.  
  48.  
  49. //Booleans
  50. bool IsFFA = false;
  51. bool StartFFA = false;
  52.  
  53.  
  54. //Console Variables
  55. ConVar gc_bPlugin;
  56. ConVar gc_bSetW;
  57. ConVar gc_bSetA;
  58. ConVar gc_bSetABypassCooldown;
  59. ConVar gc_bVote;
  60. ConVar gc_iCooldownStart;
  61. ConVar gc_bSpawnCell;
  62. ConVar gc_iRoundTime;
  63. ConVar gc_bOverlays;
  64. ConVar gc_fBeaconTime;
  65. ConVar gc_sOverlayStartPath;
  66. ConVar gc_bSounds;
  67. ConVar gc_sSoundStartPath;
  68. ConVar gc_iCooldownDay;
  69. ConVar gc_iTruceTime;
  70. ConVar gc_iRounds;
  71. ConVar g_iMPRoundTime;
  72. ConVar gc_sCustomCommandVote;
  73. ConVar gc_sCustomCommandSet;
  74. ConVar gc_sAdminFlag;
  75. ConVar gc_bAllowLR;
  76. ConVar g_iTerrorForLR;
  77.  
  78.  
  79. //Integers
  80. int g_iOldRoundTime;
  81. int g_iCoolDown;
  82. int g_iTruceTime;
  83. int g_iVoteCount;
  84. int g_iRound;
  85. int g_iMaxRound;
  86. int g_iTsLR;
  87.  
  88.  
  89. //Floats
  90. float g_fPos[3];
  91.  
  92.  
  93. //Handles
  94. Handle TruceTimer;
  95. Handle FFAMenu;
  96. Handle BeaconTimer;
  97.  
  98.  
  99. //Strings
  100. char g_sHasVoted[1500];
  101. char g_sSoundStartPath[256];
  102. char g_sEventsLogFile[PLATFORM_MAX_PATH];
  103. char g_sAdminFlag[32];
  104. char g_sOverlayStartPath[256];
  105.  
  106.  
  107. //Info
  108. public Plugin myinfo =
  109. {
  110. name = "MyJailbreak - War FFA",
  111. author = "shanapu",
  112. description = "Event Day for Jailbreak Server",
  113. version = MYJB_VERSION,
  114. url = MYJB_URL_LINK
  115. };
  116.  
  117.  
  118. //Start
  119. public void OnPluginStart()
  120. {
  121. // Translation
  122. LoadTranslations("MyJailbreak.Warden.phrases");
  123. LoadTranslations("MyJailbreak.Ffa.phrases");
  124.  
  125.  
  126. //Client Commands
  127. RegConsoleCmd("sm_setffa", Command_Setffa, "Allows the Admin or Warden to set FFA");
  128. RegConsoleCmd("sm_ffa", Command_VoteFFA, "Allows players to vote for a FFA");
  129.  
  130.  
  131. //AutoExecConfig
  132. AutoExecConfig_SetFile("FreeForAll", "MyJailbreak/EventDays");
  133. AutoExecConfig_SetCreateFile(true);
  134.  
  135. AutoExecConfig_CreateConVar("sm_ffa_version", MYJB_VERSION, "The version of this MyJailbreak SourceMod plugin", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
  136. gc_bPlugin = AutoExecConfig_CreateConVar("sm_ffa_enable", "1", "0 - disabled, 1 - enable this MyJailbreak SourceMod plugin", _, true, 0.0, true, 1.0);
  137. gc_sCustomCommandVote = AutoExecConfig_CreateConVar("sm_ffa_cmds_vote", "freeforall, dm, deathmatch", "Set your custom chat command for Event voting(!ffa (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  138. gc_sCustomCommandSet = AutoExecConfig_CreateConVar("sm_ffa_cmds_set", "sffa, sfreeforall, sdm", "Set your custom chat command for set Event(!ffa (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");
  139. gc_bSetW = AutoExecConfig_CreateConVar("sm_ffa_warden", "1", "0 - disabled, 1 - allow warden to set ffa round", _, true, 0.0, true, 1.0);
  140. gc_bSetA = AutoExecConfig_CreateConVar("sm_ffa_admin", "1", "0 - disabled, 1 - allow admin/vip to set ffa round", _, true, 0.0, true, 1.0);
  141. gc_sAdminFlag = AutoExecConfig_CreateConVar("sm_ffa_flag", "g", "Set flag for admin/vip to set this Event Day.");
  142. gc_bVote = AutoExecConfig_CreateConVar("sm_ffa_vote", "1", "0 - disabled, 1 - allow player to vote for ffa", _, true, 0.0, true, 1.0);
  143. gc_bSpawnCell = AutoExecConfig_CreateConVar("sm_ffa_spawn", "0", "0 - T teleport to CT spawn, 1 - cell doors auto open", _, true, 0.0, true, 1.0);
  144. gc_iRounds = AutoExecConfig_CreateConVar("sm_ffa_rounds", "1", "Rounds to play in a row", _, true, 1.0);
  145. gc_iRoundTime = AutoExecConfig_CreateConVar("sm_ffa_roundtime", "5", "Round time in minutes for a single ffa round", _, true, 1.0);
  146. gc_fBeaconTime = AutoExecConfig_CreateConVar("sm_ffa_beacon_time", "240", "Time in seconds until the beacon turned on (set to 0 to disable)", _, true, 0.0);
  147. gc_iTruceTime = AutoExecConfig_CreateConVar("sm_ffa_trucetime", "30", "Time in seconds players can't deal damage", _, true, 0.0);
  148. gc_iCooldownDay = AutoExecConfig_CreateConVar("sm_ffa_cooldown_day", "3", "Rounds cooldown after a event until event can be start again", _, true, 0.0);
  149. gc_iCooldownStart = AutoExecConfig_CreateConVar("sm_ffa_cooldown_start", "3", "Rounds until event can be start after mapchange.", _, true, 0.0);
  150. gc_bSetABypassCooldown = AutoExecConfig_CreateConVar("sm_ffa_cooldown_admin", "1", "0 - disabled, 1 - ignore the cooldown when admin/vip set ffa round", _, true, 0.0, true, 1.0);
  151. gc_bSounds = AutoExecConfig_CreateConVar("sm_ffa_sounds_enable", "1", "0 - disabled, 1 - enable sounds", _, true, 0.0, true, 1.0);
  152. gc_sSoundStartPath = AutoExecConfig_CreateConVar("sm_ffa_sounds_start", "music/MyJailbreak/start.mp3", "Path to the soundfile which should be played for a start.");
  153. gc_bOverlays = AutoExecConfig_CreateConVar("sm_ffa_overlays_enable", "1", "0 - disabled, 1 - enable overlays", _, true, 0.0, true, 1.0);
  154. gc_sOverlayStartPath = AutoExecConfig_CreateConVar("sm_ffa_overlays_start", "overlays/MyJailbreak/start" , "Path to the start Overlay DONT TYPE .vmt or .vft");
  155. gc_bAllowLR = AutoExecConfig_CreateConVar("sm_ffa_allow_lr", "0" , "0 - disabled, 1 - enable LR for last round and end eventday", _, true, 0.0, true, 1.0);
  156.  
  157. AutoExecConfig_ExecuteFile();
  158. AutoExecConfig_CleanFile();
  159.  
  160.  
  161. //Hooks
  162. HookEvent("round_start", Event_RoundStart);
  163. HookEvent("round_end", Event_RoundEnd);
  164. HookConVarChange(gc_sOverlayStartPath, OnSettingChanged);
  165. HookConVarChange(gc_sSoundStartPath, OnSettingChanged);
  166. HookConVarChange(gc_sAdminFlag, OnSettingChanged);
  167.  
  168.  
  169. //FindConVar
  170. g_iMPRoundTime = FindConVar("mp_roundtime");
  171. gc_sSoundStartPath.GetString(g_sSoundStartPath, sizeof(g_sSoundStartPath));
  172. gc_sOverlayStartPath.GetString(g_sOverlayStartPath , sizeof(g_sOverlayStartPath));
  173. gc_sAdminFlag.GetString(g_sAdminFlag , sizeof(g_sAdminFlag));
  174.  
  175. SetLogFile(g_sEventsLogFile, "Events", "MyJailbreak");
  176. }
  177.  
  178.  
  179. //ConVarChange for Strings
  180. public int OnSettingChanged(Handle convar, const char[] oldValue, const char[] newValue)
  181. {
  182. if (convar == gc_sOverlayStartPath)
  183. {
  184. strcopy(g_sOverlayStartPath, sizeof(g_sOverlayStartPath), newValue);
  185. if (gc_bOverlays.BoolValue) PrecacheDecalAnyDownload(g_sOverlayStartPath);
  186. }
  187. else if (convar == gc_sAdminFlag)
  188. {
  189. strcopy(g_sAdminFlag, sizeof(g_sAdminFlag), newValue);
  190. }
  191. else if (convar == gc_sSoundStartPath)
  192. {
  193. strcopy(g_sSoundStartPath, sizeof(g_sSoundStartPath), newValue);
  194. if (gc_bSounds.BoolValue) PrecacheSoundAnyDownload(g_sSoundStartPath);
  195. }
  196. }
  197.  
  198.  
  199. //Initialize Plugin
  200. public void OnConfigsExecuted()
  201. {
  202. g_iTruceTime = gc_iTruceTime.IntValue;
  203. g_iCoolDown = gc_iCooldownStart.IntValue + 1;
  204. g_iMaxRound = gc_iRounds.IntValue;
  205.  
  206.  
  207. //FindConVar
  208. g_iTerrorForLR = FindConVar("sm_hosties_lr_ts_max");
  209.  
  210.  
  211. //Set custom Commands
  212. int iCount = 0;
  213. char sCommands[128], sCommandsL[12][32], sCommand[32];
  214.  
  215. //Vote
  216. gc_sCustomCommandVote.GetString(sCommands, sizeof(sCommands));
  217. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  218. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  219.  
  220. for (int i = 0; i < iCount; i++)
  221. {
  222. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  223. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  224. RegConsoleCmd(sCommand, Command_VoteFFA, "Allows players to vote for a FFA");
  225. }
  226.  
  227. //Set
  228. gc_sCustomCommandSet.GetString(sCommands, sizeof(sCommands));
  229. ReplaceString(sCommands, sizeof(sCommands), " ", "");
  230. iCount = ExplodeString(sCommands, ",", sCommandsL, sizeof(sCommandsL), sizeof(sCommandsL[]));
  231.  
  232. for (int i = 0; i < iCount; i++)
  233. {
  234. Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]);
  235. if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist
  236. RegConsoleCmd(sCommand, Command_Setffa, "Allows the Admin or Warden to set a ffa");
  237. }
  238. }
  239.  
  240.  
  241. /******************************************************************************
  242. COMMANDS
  243. ******************************************************************************/
  244.  
  245.  
  246. //Admin & Warden set Event
  247. public Action Command_Setffa(int client, int args)
  248. {
  249. if (gc_bPlugin.BoolValue)
  250. {
  251. if (client == 0)
  252. {
  253. StartNextRound();
  254. if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event FFA was started by groupvoting");
  255. }
  256. else if (warden_iswarden(client))
  257. {
  258. if (gc_bSetW.BoolValue)
  259. {
  260. if ((GetTeamClientCount(CS_TEAM_CT) > 0) && (GetTeamClientCount(CS_TEAM_T) > 0 ))
  261. {
  262. char EventDay[64];
  263. MyJailbreak_GetEventDayName(EventDay);
  264.  
  265. if (StrEqual(EventDay, "none", false))
  266. {
  267. if (g_iCoolDown == 0)
  268. {
  269. StartNextRound();
  270. if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event FFA was started by warden %L", client);
  271. }
  272. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_wait", g_iCoolDown);
  273. }
  274. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_progress" , EventDay);
  275. }
  276. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_minplayer");
  277. }
  278. else CReplyToCommand(client, "%t %t", "warden_tag" , "war_setbywarden");
  279. }
  280. else if (CheckVipFlag(client, g_sAdminFlag))
  281. {
  282. if (gc_bSetA.BoolValue)
  283. {
  284. if ((GetTeamClientCount(CS_TEAM_CT) > 0) && (GetTeamClientCount(CS_TEAM_T) > 0 ))
  285. {
  286. char EventDay[64];
  287. MyJailbreak_GetEventDayName(EventDay);
  288.  
  289. if (StrEqual(EventDay, "none", false))
  290. {
  291. if ((g_iCoolDown == 0) || gc_bSetABypassCooldown.BoolValue)
  292. {
  293. StartNextRound();
  294. if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event FFA was started by admin %L", client);
  295. }
  296. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_wait", g_iCoolDown);
  297. }
  298. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_progress" , EventDay);
  299. }
  300. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_minplayer");
  301. }
  302. else CReplyToCommand(client, "%t %t", "ffa_tag" , "war_setbyadmin");
  303. }
  304. else CReplyToCommand(client, "%t %t", "warden_tag" , "warden_notwarden");
  305. }
  306. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_disabled");
  307. return Plugin_Handled;
  308. }
  309.  
  310.  
  311. //Voting for Event
  312. public Action Command_VoteFFA(int client, int args)
  313. {
  314. char steamid[64];
  315. GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
  316.  
  317. if (gc_bPlugin.BoolValue)
  318. {
  319. if (gc_bVote.BoolValue)
  320. {
  321. if ((GetTeamClientCount(CS_TEAM_CT) > 0) && (GetTeamClientCount(CS_TEAM_T) > 0 ))
  322. {
  323. char EventDay[64];
  324. MyJailbreak_GetEventDayName(EventDay);
  325.  
  326. if (StrEqual(EventDay, "none", false))
  327. {
  328. if (g_iCoolDown == 0)
  329. {
  330. if (StrContains(g_sHasVoted, steamid, true) == -1)
  331. {
  332. int playercount = (GetClientCount(true) / 2);
  333. g_iVoteCount++;
  334. int Missing = playercount - g_iVoteCount + 1;
  335. Format(g_sHasVoted, sizeof(g_sHasVoted), "%s, %s", g_sHasVoted, steamid);
  336.  
  337. if (g_iVoteCount > playercount)
  338. {
  339. StartNextRound();
  340. if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event FFA was started by voting");
  341. }
  342. else CPrintToChatAll("%t %t", "ffa_tag" , "ffa_need", Missing, client);
  343. }
  344. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_voted");
  345. }
  346. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_wait", g_iCoolDown);
  347. }
  348. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_progress" , EventDay);
  349. }
  350. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_minplayer");
  351. }
  352. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_voting");
  353. }
  354. else CReplyToCommand(client, "%t %t", "ffa_tag" , "ffa_disabled");
  355. return Plugin_Handled;
  356. }
  357.  
  358.  
  359. /******************************************************************************
  360. EVENTS
  361. ******************************************************************************/
  362.  
  363.  
  364. //Round start
  365. public void Event_RoundStart(Event event, char[] name, bool dontBroadcast)
  366. {
  367. if (StartFFA || IsFFA)
  368. {
  369. SetCvar("sm_hosties_lr", 0);
  370. SetCvar("sm_warden_enable", 0);
  371. SetCvar("sm_weapons_t", 1);
  372. SetCvar("sm_weapons_ct", 1);
  373. SetCvar("mp_teammates_are_enemies", 1);
  374. SetCvar("mp_friendlyfire", 1);
  375. SetCvar("sm_menu_enable", 0);
  376. MyJailbreak_SetEventDayPlanned(false);
  377. MyJailbreak_SetEventDayRunning(true);
  378. MyJailbreak_FogOn();
  379. g_iRound++;
  380. IsFFA = true;
  381. StartFFA = false;
  382. SJD_OpenDoors();
  383.  
  384. if (gc_fBeaconTime.FloatValue > 0.0) BeaconTimer = CreateTimer(gc_fBeaconTime.FloatValue, Timer_BeaconOn, TIMER_FLAG_NO_MAPCHANGE);
  385.  
  386. int RandomCT = 0;
  387.  
  388. LoopClients(client)
  389. {
  390. if (GetClientTeam(client) == CS_TEAM_CT)
  391. {
  392. RandomCT = client;
  393. break;
  394. }
  395. }
  396. if (RandomCT)
  397. {
  398. GetClientAbsOrigin(RandomCT, g_fPos);
  399.  
  400. g_fPos[2] = g_fPos[2] + 5;
  401.  
  402. if (g_iRound > 0)
  403. {
  404. LoopClients(client)
  405. {
  406. if (!gc_bSpawnCell.BoolValue || (gc_bSpawnCell.BoolValue && (SJD_IsCurrentMapConfigured() != true))) //spawn Terrors to CT Spawn
  407. {
  408. if (IsClientInGame(client))
  409. {
  410. TeleportEntity(client, g_fPos, NULL_VECTOR, NULL_VECTOR);
  411. }
  412. }
  413. }
  414.  
  415. //enable lr on last round
  416. g_iTsLR = GetAliveTeamCount(CS_TEAM_T);
  417.  
  418. if (gc_bAllowLR.BoolValue)
  419. {
  420. if ((g_iRound == g_iMaxRound) && (g_iTsLR > g_iTerrorForLR.IntValue))
  421. {
  422. SetCvar("sm_hosties_lr", 1);
  423. }
  424. }
  425.  
  426. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_rounds", g_iRound, g_iMaxRound);
  427. }
  428. LoopClients(client)
  429. {
  430. CreateInfoPanel(client);
  431. SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 2, 4, true);
  432. SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
  433. }
  434. TruceTimer = CreateTimer(1.0, Timer_StartEvent, _, TIMER_REPEAT);
  435. }
  436. }
  437. else
  438. {
  439. char EventDay[64];
  440. MyJailbreak_GetEventDayName(EventDay);
  441.  
  442. if (!StrEqual(EventDay, "none", false))
  443. {
  444. g_iCoolDown = gc_iCooldownDay.IntValue + 1;
  445. }
  446. else if (g_iCoolDown > 0) g_iCoolDown--;
  447. }
  448. }
  449.  
  450.  
  451. //Round End
  452. public void Event_RoundEnd(Event event, char[] name, bool dontBroadcast)
  453. {
  454. int winner = event.GetInt("winner");
  455.  
  456.  
  457. if (IsFFA)
  458. {
  459. LoopValidClients(client, false, true) SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 0, 4, true);
  460. delete TruceTimer;
  461. delete BeaconTimer;
  462. if (winner == 2)
  463. {
  464. int client;
  465.  
  466. PrintCenterTextAll("%t", "ffa_twin_nc");
  467. if (GetClientTeam(client) == CS_TEAM_T)
  468. {
  469. Store_SetClientCredits(client, Store_GetClientCredits(client) + 200);
  470. }
  471. }
  472.  
  473. if (winner == 3) PrintCenterTextAll("%t", "ffa_ctwin_nc");
  474. if (g_iRound == g_iMaxRound)
  475. {
  476. IsFFA = false;
  477. g_iRound = 0;
  478. Format(g_sHasVoted, sizeof(g_sHasVoted), "");
  479. SetCvar("sm_hosties_lr", 1);
  480. SetCvar("sm_warden_enable", 1);
  481. SetCvar("sm_weapons_t", 0);
  482. SetCvar("sm_weapons_ct", 1);
  483. SetCvar("mp_teammates_are_enemies", 0);
  484. SetCvar("mp_friendlyfire", 0);
  485. SetCvar("sm_menu_enable", 1);
  486. g_iMPRoundTime.IntValue = g_iOldRoundTime;
  487. MyJailbreak_SetEventDayName("none");
  488. MyJailbreak_SetEventDayRunning(false);
  489. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_end");
  490. }
  491. }
  492. if (StartFFA)
  493. {
  494. LoopClients(i) CreateInfoPanel(i);
  495.  
  496. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_next");
  497. PrintCenterTextAll("%t", "ffa_next_nc");
  498. }
  499. }
  500.  
  501.  
  502. /******************************************************************************
  503. FORWARDS LISTEN
  504. ******************************************************************************/
  505.  
  506.  
  507. //Initialize Event
  508. public void OnMapStart()
  509. {
  510. g_iVoteCount = 0;
  511. g_iRound = 0;
  512. IsFFA = false;
  513. StartFFA = false;
  514.  
  515. g_iCoolDown = gc_iCooldownStart.IntValue + 1;
  516. g_iTruceTime = gc_iTruceTime.IntValue;
  517.  
  518. if (gc_bOverlays.BoolValue) PrecacheDecalAnyDownload(g_sOverlayStartPath);
  519. if (gc_bSounds.BoolValue) PrecacheSoundAnyDownload(g_sSoundStartPath);
  520.  
  521. }
  522.  
  523.  
  524. //Map End
  525. public void OnMapEnd()
  526. {
  527. IsFFA = false;
  528. StartFFA = false;
  529. delete TruceTimer;
  530. g_iVoteCount = 0;
  531. g_iRound = 0;
  532. g_sHasVoted[0] = '\0';
  533. }
  534.  
  535.  
  536. //Listen for Last Lequest
  537. public int OnAvailableLR(int Announced)
  538. {
  539. if (IsFFA && gc_bAllowLR.BoolValue && (g_iTsLR > g_iTerrorForLR.IntValue))
  540. {
  541. LoopValidClients(client, false, true)
  542. {
  543. SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 0, 4, true);
  544.  
  545. StripAllPlayerWeapons(client);
  546. if (GetClientTeam(client) == CS_TEAM_CT)
  547. {
  548. FakeClientCommand(client, "sm_weapons");
  549. }
  550. GivePlayerItem(client, "weapon_knife");
  551. }
  552.  
  553. delete BeaconTimer;
  554. delete TruceTimer;
  555.  
  556. if (g_iRound == g_iMaxRound)
  557. {
  558. IsFFA = false;
  559. g_iRound = 0;
  560. Format(g_sHasVoted, sizeof(g_sHasVoted), "");
  561. SetCvar("sm_hosties_lr", 1);
  562. SetCvar("sm_warden_enable", 1);
  563. SetCvar("sm_weapons_t", 0);
  564. SetCvar("sm_weapons_ct", 1);
  565. SetCvar("mp_teammates_are_enemies", 0);
  566. SetCvar("mp_friendlyfire", 0);
  567. SetCvar("sm_menu_enable", 1);
  568. g_iMPRoundTime.IntValue = g_iOldRoundTime;
  569. MyJailbreak_SetEventDayName("none");
  570. MyJailbreak_SetEventDayRunning(false);
  571. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_end");
  572. }
  573. }
  574. }
  575.  
  576.  
  577. /******************************************************************************
  578. FUNCTIONS
  579. ******************************************************************************/
  580.  
  581.  
  582. //Prepare Event for next round
  583. void StartNextRound()
  584. {
  585. StartFFA = true;
  586. g_iCoolDown = gc_iCooldownDay.IntValue + 1;
  587. g_iVoteCount = 0;
  588.  
  589. char buffer[32];
  590. Format(buffer, sizeof(buffer), "%T", "ffa_name", LANG_SERVER);
  591. MyJailbreak_SetEventDayName(buffer);
  592. MyJailbreak_SetEventDayPlanned(true);
  593.  
  594. g_iOldRoundTime = g_iMPRoundTime.IntValue; //save original round time
  595. g_iMPRoundTime.IntValue = gc_iRoundTime.IntValue;//set event round time
  596.  
  597. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_next");
  598. PrintCenterTextAll("%t", "ffa_next_nc");
  599. }
  600.  
  601.  
  602. /******************************************************************************
  603. MENUS
  604. ******************************************************************************/
  605.  
  606.  
  607. stock void CreateInfoPanel(int client)
  608. {
  609. //Create info Panel
  610. char info[255];
  611.  
  612. FFAMenu = CreatePanel();
  613. Format(info, sizeof(info), "%T", "ffa_info_title", client);
  614. SetPanelTitle(FFAMenu, info);
  615. DrawPanelText(FFAMenu, " ");
  616. Format(info, sizeof(info), "%T", "ffa_info_line1", client);
  617. DrawPanelText(FFAMenu, info);
  618. DrawPanelText(FFAMenu, "-----------------------------------");
  619. Format(info, sizeof(info), "%T", "ffa_info_line2", client);
  620. DrawPanelText(FFAMenu, info);
  621. Format(info, sizeof(info), "%T", "ffa_info_line3", client);
  622. DrawPanelText(FFAMenu, info);
  623. Format(info, sizeof(info), "%T", "ffa_info_line4", client);
  624. DrawPanelText(FFAMenu, info);
  625. Format(info, sizeof(info), "%T", "ffa_info_line5", client);
  626. DrawPanelText(FFAMenu, info);
  627. Format(info, sizeof(info), "%T", "ffa_info_line6", client);
  628. DrawPanelText(FFAMenu, info);
  629. Format(info, sizeof(info), "%T", "ffa_info_line7", client);
  630. DrawPanelText(FFAMenu, info);
  631. DrawPanelText(FFAMenu, "-----------------------------------");
  632. Format(info, sizeof(info), "%T", "warden_close", client);
  633. DrawPanelItem(FFAMenu, info);
  634. SendPanelToClient(FFAMenu, client, Handler_NullCancel, 20);
  635. }
  636.  
  637.  
  638. /******************************************************************************
  639. TIMER
  640. ******************************************************************************/
  641.  
  642.  
  643. //Start Timer
  644. public Action Timer_StartEvent(Handle timer)
  645. {
  646. if (g_iTruceTime > 1)
  647. {
  648. g_iTruceTime--;
  649.  
  650. PrintCenterTextAll("%t", "ffa_damage_nc", g_iTruceTime);
  651.  
  652. return Plugin_Continue;
  653. }
  654.  
  655. g_iTruceTime = gc_iTruceTime.IntValue;
  656.  
  657. for (int client=1; client <= MaxClients; client++)
  658. {
  659. if (IsClientInGame(client) && IsPlayerAlive(client))
  660. {
  661. SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);
  662. if (gc_bOverlays.BoolValue) ShowOverlay(client, g_sOverlayStartPath, 2.0);
  663. if (gc_bSounds.BoolValue)
  664. {
  665. EmitSoundToAllAny(g_sSoundStartPath);
  666. }
  667.  
  668. PrintCenterText(client, "%t", "ffa_start_nc");
  669. }
  670. }
  671. CPrintToChatAll("%t %t", "ffa_tag" , "ffa_start");
  672. TruceTimer = null;
  673. MyJailbreak_FogOff();
  674.  
  675. return Plugin_Stop;
  676. }
  677.  
  678.  
  679. //Beacon Timer
  680. public Action Timer_BeaconOn(Handle timer)
  681. {
  682. LoopValidClients(i, true, false) MyJailbreak_BeaconOn(i, 2.0);
  683. BeaconTimer = null;
  684. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement