Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.33 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #include "lr.sp"
  5.  
  6. #define VERSION "3.2"
  7.  
  8.  
  9. public Plugin:myinfo = {
  10. name = "Last Request",
  11. author = "BlackOps",
  12. description = "Last Request!",
  13. version = VERSION,
  14. url = ""
  15. };
  16.  
  17. new bool:isFighting=false;
  18. new LRMode=0;
  19. new String:LRModeString[64];
  20. new String:LRModeWeap[64];
  21. new Requestor,Requested;
  22. new fov_offset;
  23. new zoom_offset;
  24. new g_beamsprite, g_halosprite;
  25. new S4Stimes=0;
  26. new A4Atimes=0;
  27.  
  28. new Handle:hGameConf
  29. new Handle:hRemoveItems
  30.  
  31. new bool:g_LR[MAXPLAYERS+1] ;
  32. new Float:g_LastTick, Float:g_LastFrame, bool:g_LastTickOdd ;
  33.  
  34. public OnPluginStart()
  35. {
  36. CreateConVar("sm_lastrequest_version", VERSION, "Current version of this plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT);
  37.  
  38. RegConsoleCmd("say", Command_Say);
  39. RegConsoleCmd("say_team", Command_Say);
  40.  
  41. hGameConf = LoadGameConfigFile("lastrequest.gamedata")
  42.  
  43. StartPrepSDKCall(SDKCall_Player)
  44. PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "RemoveAllItems")
  45. PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain)
  46. hRemoveItems = EndPrepSDKCall()
  47.  
  48. HookEvent("round_start", RoundStart) ;
  49. HookEvent("player_death", DeathEvent)
  50. HookEvent("round_end", RoundEnd);
  51. LoadSoundsMat()
  52. LR_PluginInit() ;
  53. }
  54.  
  55. public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
  56. {
  57. S4Stimes=0;
  58. A4Atimes=0;
  59. isFighting = false;
  60. Requestor=0;
  61. Requested=0;
  62. LRMode=0;
  63. LR_Deactivate() ;
  64. }
  65.  
  66. public RoundStart(Handle:event, const String:name[], bool:doNotBroadcast) {
  67. for ( new i = 1 ; i <= MaxClients ; i ++ ) {
  68. g_LR[i] = false ;
  69. }
  70. LR_Deactivate() ;
  71. }
  72.  
  73. public OnGameFrame() {
  74. if ( g_LastTick + 0.5 < GetEngineTime() ) {
  75. g_LastTick = GetEngineTime() ;
  76. g_LastTickOdd = !g_LastTickOdd ;
  77. LR_Tick(g_LastTickOdd) ;
  78. }
  79. if ( g_LastFrame + 0.05 < GetEngineTime() ) {
  80. g_LastFrame = GetEngineTime() ;
  81. LR_Frame() ;
  82. }
  83. }
  84.  
  85. public OnMapStart()
  86. {
  87. LoadSoundsMat()
  88. LR_Init() ;
  89. }
  90.  
  91. public LoadSoundsMat()
  92. {
  93. PrecacheSound("buttons/blip1.wav", true);
  94. g_beamsprite = PrecacheModel("materials/sprites/laser.vmt");
  95. g_halosprite = PrecacheModel("materials/sprites/halo01.vmt");
  96. }
  97.  
  98. public DeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
  99. {
  100. new client = GetClientOfUserId(GetEventInt(event, "userid"))
  101. decl String:RequestorName[64];
  102. decl String:RequestedName[64];
  103.  
  104. if(Requestor && IsClientConnected(Requestor) && IsClientInGame(Requestor))
  105. GetClientName(Requestor, RequestorName, sizeof(RequestorName));
  106.  
  107. if(Requested && IsClientConnected(Requested) && IsClientInGame(Requested))
  108. GetClientName(Requested, RequestedName, sizeof(RequestedName));
  109.  
  110. decl String:weaponName[100];
  111. GetEventString(event,"weapon",weaponName,100);
  112.  
  113. new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
  114.  
  115. if(LRMode==1)
  116. {
  117. LRModeString="Knife Fight";
  118. LRModeWeap="knife";
  119. }
  120. if(LRMode==2)
  121. {
  122. LRModeString="Shot for Shot";
  123. LRModeWeap="deagle";
  124. }
  125. if(LRMode==3)
  126. {
  127. LRModeString="Deagle Toss";
  128. }
  129. if(LRMode==4)
  130. {
  131. LRModeString="Clip for Clip";
  132. LRModeWeap="deagle";
  133. }
  134. if(LRMode==5)
  135. {
  136. LRModeString="Rebellion";
  137. }
  138. if(LRMode==6)
  139. {
  140. LRModeString="Rebellion Knife Fight";
  141. }
  142. if(LRMode==7)
  143. {
  144. LRModeString="Awp for Awp";
  145. LRModeWeap="awp";
  146. }
  147.  
  148. if(client==Requestor)
  149. {
  150. if(killer==Requested)
  151. {
  152. if(LRMode==3)
  153. {
  154. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has won the %s!",RequestedName,LRModeString);
  155. }
  156. else
  157. {
  158. if(StrEqual(weaponName,LRModeWeap))
  159. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has won the %s!",RequestedName,LRModeString);
  160. else
  161. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03is rebelling!",RequestedName);
  162. }
  163. }
  164. else
  165. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has died! Last request over.",RequestorName);
  166.  
  167. isFighting = false;
  168. Requestor=0;
  169. Requested=0;
  170. LRMode=0;
  171. }
  172. if(client==Requested)
  173. {
  174. if(killer==Requestor)
  175. {
  176. if(LRMode==3)
  177. {
  178. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has won the %s!",RequestorName,LRModeString);
  179. }
  180. else
  181. {
  182. if(StrEqual(weaponName,LRModeWeap))
  183. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has won the %s!",RequestorName,LRModeString);
  184. else
  185. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03is rebelling!",RequestorName);
  186. }
  187. }
  188. else
  189. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has died! Last request over.",RequestedName);
  190.  
  191. isFighting = false;
  192. Requestor=0;
  193. Requested=0;
  194. LRMode=0;
  195. }
  196. }
  197.  
  198. public Action:Command_Say(client, args)
  199. {
  200. if (client <= 0 || !IsClientInGame(client))
  201. {
  202. return Plugin_Continue;
  203. }
  204. decl String:text[192];
  205. if (!GetCmdArgString(text, sizeof(text)))
  206. {
  207. return Plugin_Continue;
  208. }
  209.  
  210. new startidx = 0;
  211. if(text[strlen(text)-1] == '"')
  212. {
  213. text[strlen(text)-1] = '\0';
  214. startidx = 1;
  215. }
  216.  
  217. if (strcmp(text[startidx], "!lr", false) == 0)
  218. {
  219. new Ts = CountTs() ;
  220. if (GetClientTeam(client) != 2)
  221. {
  222. PrintToChat(client,"\x04[Freedom Jailbreak] \x03You must be a terrorist to use Last Request!");
  223. return Plugin_Continue;
  224. }
  225. if(IsPlayerAlive(client))
  226. {
  227. if ( Ts == 1 ) {
  228. if(CanLR(client))
  229. {
  230. if(isFighting==true)
  231. {
  232. PrintToChat(client,"\x04[Freedom Jailbreak] \x03Last Request already in progress!");
  233. return Plugin_Handled
  234. }
  235. else
  236. {
  237. Menu_LastReq(client);
  238. }
  239. }
  240. } else if ( Ts >= 2 && Ts <= 5 ) {
  241. if ( lr_Active ) {
  242. PrintToChat(client, "\x04[Freedom Jailbreak] \x03Last Request is already active.") ;
  243. } else {
  244. PrintToChat(client, "\x04[Freedom Jailbreak] \x03You have stated that you wish to play Last Request. All other alive Terrorists must also wish this.") ;
  245. g_LR[client] = true ;
  246. }
  247.  
  248. if ( !lr_Active && Ts <= CountLRs() ) {
  249. LR_DefaultActivate(LR_TYPE_RANDOM) ;
  250. }
  251. } else if ( Ts == 0 ) {
  252. PrintToChat(client, "\x04[Freedom Jailbreak] \x03There must be at least 1 Terrorist and 1 Counter-Terrorist!") ;
  253. }
  254. }
  255. else
  256. PrintToChat(client,"\x04[Freedom Jailbreak] \x03Umm.. You're dead retard!");
  257. }
  258.  
  259. return Plugin_Continue;
  260.  
  261. }
  262.  
  263. public Action:Menu_LastReq(client)
  264. {
  265. new Handle:menu = CreateMenu(MenuHandlerLastReq)
  266. SetMenuTitle(menu, "Last Request")
  267. AddMenuItem(menu, "knife", "Knife Fight")
  268. AddMenuItem(menu, "s4s", "Shot 4 Shot")
  269. AddMenuItem(menu, "a4a", "Awp 4 Awp")
  270. AddMenuItem(menu, "c4c", "Clip 4 Clip")
  271. AddMenuItem(menu, "rbl", "Rebel")
  272. AddMenuItem(menu, "deagle", "Deagle Toss")
  273. AddMenuItem(menu, "krbl", "Knife Rebel")
  274. AddMenuItem(menu, "a4a", "Awp 4 Awp")
  275. SetMenuExitButton(menu, true)
  276. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  277.  
  278. return Plugin_Handled
  279. }
  280.  
  281. public MenuHandlerLastReq(Handle:menu, MenuAction:action, param1, param2)
  282. {
  283. if (action == MenuAction_Select)
  284. {
  285. new String:info[64];
  286. GetMenuItem(menu, param2, info, sizeof(info));
  287.  
  288. decl String:name[64];
  289. GetClientName(param1, name, sizeof(name));
  290.  
  291. if (StrEqual(info,"knife"))
  292. {
  293. Menu_Knife(param1);
  294. }
  295. if (StrEqual(info,"s4s"))
  296. {
  297. if(S4Stimes<3)
  298. Menu_S4S(param1);
  299. else
  300. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03People are waiting you fag!");
  301. }
  302. if (StrEqual(info,"c4c"))
  303. {
  304. Menu_C4C(param1);
  305. }
  306. if (StrEqual(info,"rbl"))
  307. {
  308. if(!CanLR(param1))
  309. {
  310. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!");
  311. }
  312. else
  313. {
  314. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen to rebel!",name);
  315. LRMode=5;
  316. SetEntityHealth(param1,RebelHP())
  317. isFighting = true;
  318. Requestor=param1;
  319. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  320. SDKCall(hRemoveItems, Requestor,false);
  321. GivePlayerItem(Requestor,"weapon_knife");
  322. GivePlayerItem(Requestor,"weapon_m249");
  323. }
  324. }
  325. if (StrEqual(info, "A4A"))
  326. {
  327. if(A4Atimes<3)
  328. Menu_A4A(param1);
  329. else
  330. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03People are waiting you fag!");
  331. }
  332. if (StrEqual(info,"deagle"))
  333. {
  334. Menu_Deagle(param1);
  335. }
  336. if (StrEqual(info,"krbl"))
  337. {
  338. if(!CanLR(param1))
  339. {
  340. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!");
  341. }
  342. else
  343. {
  344. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen to knife rebel!",name);
  345. LRMode=6;
  346. SetEntityHealth(param1,RebelHP())
  347. isFighting = true;
  348. Requestor=param1;
  349. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  350. new maxplayers = GetMaxClients()
  351. for (new i=1; i<=maxplayers; i++)
  352. {
  353. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  354. {
  355. SDKCall(hRemoveItems, i,false);
  356. GivePlayerItem(i,"weapon_knife");
  357. }
  358. }
  359. SDKCall(hRemoveItems, Requestor,false);
  360. GivePlayerItem(Requestor,"weapon_knife");
  361. }
  362. }
  363. }
  364. if (action == MenuAction_End)
  365. CloseHandle(menu);
  366. }
  367.  
  368. public Action:Menu_Deagle(client)
  369. {
  370. new Handle:menu = CreateMenu(MenuHandlerDeagle)
  371. SetMenuTitle(menu, "Deagle Toss")
  372. new maxClients = GetMaxClients();
  373. for (new i=1; i<=maxClients; i++)
  374. {
  375. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  376. {
  377. decl String:name[65];
  378. GetClientName(i, name, sizeof(name));
  379. AddMenuItem(menu, name, name)
  380. }
  381. }
  382. SetMenuExitButton(menu, true)
  383. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  384.  
  385. return Plugin_Handled
  386. }
  387.  
  388. public MenuHandlerDeagle(Handle:menu, MenuAction:action, param1, param2)
  389. {
  390. if (action == MenuAction_Select)
  391. {
  392. new String:info[64];
  393. GetMenuItem(menu, param2, info, sizeof(info));
  394. new maxplayers;
  395. maxplayers = GetMaxClients();
  396. for (new i=1; i<=maxplayers; i++)
  397. {
  398. if (IsClientConnected(i) && IsClientInGame(i))
  399. {
  400. decl String:other[64];
  401. GetClientName(i, other, sizeof(other));
  402. decl String:player[64];
  403. GetClientName(param1, player, sizeof(player));
  404.  
  405. if (StrEqual(info, other))
  406. {
  407. if (!IsClientConnected(i) && !IsClientInGame(i) || !IsPlayerAlive(i))
  408. {
  409. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Player \x01%s \x03is either dead or no longer connected!",other);
  410. continue
  411. }
  412. if(!CanLR(param1))
  413. {
  414. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!",other);
  415. continue
  416. }
  417. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen deagle toss with \x01%s!",player,other);
  418. LRMode=3;
  419. SetEntityHealth(param1,100)
  420. SetEntityHealth(i,100)
  421. isFighting = true;
  422. Requestor=param1;
  423. Requested=i;
  424. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  425. CreateTimer(1.0, StartBeacon, Requested, TIMER_REPEAT);
  426. SDKCall(hRemoveItems, Requestor,false);
  427. SDKCall(hRemoveItems, Requested,false);
  428. GivePlayerItem(Requestor,"weapon_knife");
  429. GivePlayerItem(Requested,"weapon_knife");
  430. GivePlayerItem(Requestor,"weapon_deagle");
  431. GivePlayerItem(Requested,"weapon_deagle");
  432.  
  433. S4Stimes=S4Stimes+1;
  434. }
  435. }
  436. }
  437. }
  438. if (action == MenuAction_End)
  439. CloseHandle(menu)
  440. }
  441.  
  442. public Action:Menu_S4S(client)
  443. {
  444. new Handle:menu = CreateMenu(MenuHandlerS4S)
  445. SetMenuTitle(menu, "Shot 4 Shot")
  446. new maxClients = GetMaxClients();
  447. for (new i=1; i<=maxClients; i++)
  448. {
  449. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  450. {
  451. decl String:name[65];
  452. GetClientName(i, name, sizeof(name));
  453. AddMenuItem(menu, name, name)
  454. }
  455. }
  456. SetMenuExitButton(menu, true)
  457. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  458.  
  459. return Plugin_Handled
  460. }
  461.  
  462. public MenuHandlerS4S(Handle:menu, MenuAction:action, param1, param2)
  463. {
  464. if (action == MenuAction_Select)
  465. {
  466. new String:info[64];
  467. GetMenuItem(menu, param2, info, sizeof(info));
  468. new maxplayers;
  469. maxplayers = GetMaxClients();
  470. for (new i=1; i<=maxplayers; i++)
  471. {
  472. if (IsClientConnected(i) && IsClientInGame(i))
  473. {
  474. decl String:other[64];
  475. GetClientName(i, other, sizeof(other));
  476. decl String:player[64];
  477. GetClientName(param1, player, sizeof(player));
  478.  
  479. if (StrEqual(info, other))
  480. {
  481. if (!IsClientConnected(i) && !IsClientInGame(i) || !IsPlayerAlive(i))
  482. {
  483. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Player \x01%s \x03is either dead or no longer connected!",other);
  484. continue
  485. }
  486. if(!CanLR(param1))
  487. {
  488. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!",other);
  489. continue
  490. }
  491. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen Shot for Shot with \x01%s!",player,other);
  492. LRMode=2;
  493. SetEntityHealth(param1,100)
  494. SetEntityHealth(i,100)
  495. isFighting = true;
  496. Requestor=param1;
  497. Requested=i;
  498. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  499. CreateTimer(1.0, StartBeacon, Requested, TIMER_REPEAT);
  500. SDKCall(hRemoveItems, Requestor,false);
  501. SDKCall(hRemoveItems, Requested,false);
  502. GivePlayerItem(Requestor,"weapon_knife");
  503. GivePlayerItem(Requested,"weapon_knife");
  504. GivePlayerItem(Requestor,"weapon_deagle");
  505. GivePlayerItem(Requested,"weapon_deagle");
  506. S4Stimes=S4Stimes+1;
  507. }
  508. }
  509. }
  510. }
  511. if (action == MenuAction_End)
  512. CloseHandle(menu)
  513. }
  514.  
  515. public Action:Menu_A4A(client)
  516. {
  517. new Handle:menu = CreateMenu(MenuHandlerA4A)
  518. SetMenuTitle(menu, "Awp Shot For Awp Shot")
  519. new maxClients = GetMaxClients();
  520. for (new i=1; i<=maxClients; i++)
  521. {
  522. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  523. {
  524. decl String:name[65];
  525. GetClientName(i, name, sizeof(name));
  526. AddMenuItem(menu, name, name)
  527. }
  528. }
  529. SetMenuExitButton(menu, true)
  530. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  531.  
  532. return Plugin_Handled
  533. }
  534. public MenuHandlerA4A(Handle:menu, MenuAction:action, param1, param2)
  535. {
  536. if (action == MenuAction_Select)
  537. {
  538. new String:info[64];
  539. GetMenuItem(menu, param2, info, sizeof(info));
  540. new maxplayers;
  541. maxplayers = GetMaxClients();
  542. for (new i=1; i<=maxplayers; i++)
  543. {
  544. if (IsClientConnected(i) && IsClientInGame(i))
  545. {
  546. decl String:other[64];
  547. GetClientName(i, other, sizeof(other));
  548. decl String:player[64];
  549. GetClientName(param1, player, sizeof(player));
  550.  
  551. if (StrEqual(info, other))
  552. {
  553. if (!IsClientConnected(i) && !IsClientInGame(i) || !IsPlayerAlive(i))
  554. {
  555. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Player \x01%s \x03is either dead or no longer connected!",other);
  556. continue
  557. }
  558. if(!CanLR(param1))
  559. {
  560. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!",other);
  561. continue
  562. }
  563. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen Awp for Awp with \x01%s!",player,other);
  564. LRMode=7;
  565. SetEntityHealth(param1,100)
  566. SetEntityHealth(i,100)
  567. isFighting = true;
  568. Requestor=param1;
  569. Requested=i;
  570. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  571. CreateTimer(1.0, StartBeacon, Requested, TIMER_REPEAT);
  572. SDKCall(hRemoveItems, Requestor,false);
  573. SDKCall(hRemoveItems, Requested,false);
  574. GivePlayerItem(Requestor,"weapon_knife");
  575. GivePlayerItem(Requested,"weapon_knife");
  576. GivePlayerItem(Requestor,"weapon_awp");
  577. GivePlayerItem(Requested,"weapon_awp");
  578. A4Atimes=A4Atimes+1;
  579. }
  580. }
  581. }
  582. }
  583. if (action == MenuAction_End)
  584. CloseHandle(menu)
  585. }
  586.  
  587. public Action:Menu_C4C(client)
  588. {
  589. new Handle:menu = CreateMenu(MenuHandlerC4C)
  590. SetMenuTitle(menu, "Clip 4 Clip")
  591. new maxClients = GetMaxClients();
  592. for (new i=1; i<=maxClients; i++)
  593. {
  594. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  595. {
  596. decl String:name[65];
  597. GetClientName(i, name, sizeof(name));
  598. AddMenuItem(menu, name, name)
  599. }
  600. }
  601. SetMenuExitButton(menu, true)
  602. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  603.  
  604. return Plugin_Handled
  605. }
  606.  
  607. public MenuHandlerC4C(Handle:menu, MenuAction:action, param1, param2)
  608. {
  609. if (action == MenuAction_Select)
  610. {
  611. new String:info[64];
  612. GetMenuItem(menu, param2, info, sizeof(info));
  613. new maxplayers;
  614. maxplayers = GetMaxClients();
  615. for (new i=1; i<=maxplayers; i++)
  616. {
  617. if (IsClientConnected(i) && IsClientInGame(i))
  618. {
  619. decl String:other[64];
  620. GetClientName(i, other, sizeof(other));
  621. decl String:player[64];
  622. GetClientName(param1, player, sizeof(player));
  623.  
  624. if (StrEqual(info, other))
  625. {
  626. if (!IsClientConnected(i) && !IsClientInGame(i) || !IsPlayerAlive(i))
  627. {
  628. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Player \x01%s \x03is either dead or no longer connected!",other);
  629. continue
  630. }
  631. if(!CanLR(param1))
  632. {
  633. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!",other);
  634. continue
  635. }
  636. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen Clip for Clip with \x01%s!",player,other);
  637. LRMode=4;
  638. SetEntityHealth(param1,100)
  639. SetEntityHealth(i,100)
  640. isFighting = true;
  641. Requestor=param1;
  642. Requested=i;
  643. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  644. CreateTimer(1.0, StartBeacon, Requested, TIMER_REPEAT);
  645. SDKCall(hRemoveItems, Requestor,false);
  646. SDKCall(hRemoveItems, Requested,false);
  647. GivePlayerItem(Requestor,"weapon_knife");
  648. GivePlayerItem(Requested,"weapon_knife");
  649. GivePlayerItem(Requestor,"weapon_deagle");
  650. GivePlayerItem(Requested,"weapon_deagle");
  651. }
  652. }
  653. }
  654. }
  655. if (action == MenuAction_End)
  656. CloseHandle(menu)
  657. }
  658.  
  659. public Action:Menu_Knife(client)
  660. {
  661. new Handle:menu = CreateMenu(MenuHandlerKnife)
  662. SetMenuTitle(menu, "Knife Fight")
  663. new maxClients = GetMaxClients();
  664. for (new i=1; i<=maxClients; i++)
  665. {
  666. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  667. {
  668. decl String:name[65];
  669. GetClientName(i, name, sizeof(name));
  670. AddMenuItem(menu, name, name)
  671. }
  672. }
  673. SetMenuExitButton(menu, true)
  674. DisplayMenu(menu, client, MENU_TIME_FOREVER)
  675.  
  676. return Plugin_Handled
  677. }
  678.  
  679. public MenuHandlerKnife(Handle:menu, MenuAction:action, param1, param2)
  680. {
  681. if (action == MenuAction_Select)
  682. {
  683. new String:info[64];
  684. GetMenuItem(menu, param2, info, sizeof(info));
  685. new maxplayers;
  686. maxplayers = GetMaxClients();
  687. for (new i=1; i<=maxplayers; i++)
  688. {
  689. if (IsClientConnected(i) && IsClientInGame(i))
  690. {
  691. decl String:other[64];
  692. GetClientName(i, other, sizeof(other));
  693. decl String:player[64];
  694. GetClientName(param1, player, sizeof(player));
  695.  
  696. if (StrEqual(info, other))
  697. {
  698. if (!IsClientConnected(i) && !IsClientInGame(i) || !IsPlayerAlive(i))
  699. {
  700. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Player \x01%s \x03is either dead or no longer connected!",other);
  701. continue
  702. }
  703. if(!CanLR(param1))
  704. {
  705. PrintToChat(param1,"\x04[Freedom Jailbreak] \x03Can't LR, round is over!",other);
  706. continue
  707. }
  708. PrintToChatAll("\x04[Freedom Jailbreak] \x03Player \x01%s \x03has chosen \x01%s \x03for a knife fight!",player,other);
  709. LRMode=1;
  710. SetEntityHealth(param1,100)
  711. SetEntityHealth(i,100)
  712. isFighting = true;
  713. Requestor=param1;
  714. Requested=i;
  715. CreateTimer(1.0, StartBeacon, Requestor, TIMER_REPEAT);
  716. CreateTimer(1.0, StartBeacon, Requested, TIMER_REPEAT);
  717. SDKCall(hRemoveItems, Requestor,false);
  718. SDKCall(hRemoveItems, Requested,false);
  719. GivePlayerItem(Requestor,"weapon_knife");
  720. GivePlayerItem(Requested,"weapon_knife");
  721. }
  722. }
  723. }
  724. }
  725. if (action == MenuAction_End)
  726. CloseHandle(menu)
  727. }
  728.  
  729. public CanLR(client)
  730. {
  731. new maxplayers = GetMaxClients(), Tcounter=0, CTcounter=0;
  732. for (new i=1; i<=maxplayers; i++)
  733. {
  734. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
  735. Tcounter++;
  736. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  737. CTcounter++;
  738. }
  739. if(Tcounter==1 && CTcounter > 0)
  740. return true;
  741. else
  742. return false;
  743. }
  744.  
  745. public CountTs() {
  746. new Ts = 0, CTs = 0 ;
  747. new team ;
  748.  
  749. for ( new i = 1 ; i <= MaxClients ; i ++ ) {
  750. if ( IsClientInGame(i) ) {
  751. if ( IsPlayerAlive(i) ) {
  752. team = GetClientTeam(i) ;
  753. if ( team == 2 ) {
  754. Ts ++ ;
  755. } else if ( team == 3 ) {
  756. CTs ++ ;
  757. }
  758. }
  759. }
  760. }
  761.  
  762. if ( CTs == 0 ) {
  763. return 0 ;
  764. } else {
  765. return Ts ;
  766. }
  767. }
  768.  
  769. public CountLRs() {
  770. new team, LRs = 0 ;
  771.  
  772. for ( new i = 1 ; i <= MaxClients ; i ++ ) {
  773. if ( IsClientInGame(i) ) {
  774. if ( IsPlayerAlive(i) ) {
  775. team = GetClientTeam(i) ;
  776. if ( team == 2 ) {
  777. if ( g_LR[i] ) {
  778. LRs ++ ;
  779. }
  780. }
  781. }
  782. }
  783. }
  784. return LRs ;
  785. }
  786.  
  787. public RebelHP()
  788. {
  789. new maxplayers = GetMaxClients(), CTcounter=0;
  790. for (new i=1; i<=maxplayers; i++)
  791. {
  792. if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
  793. {
  794. CTcounter++;
  795. CreateTimer(1.0, StartBeacon, i, TIMER_REPEAT);
  796. }
  797. }
  798.  
  799. return CTcounter*100;
  800. }
  801. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
  802. {
  803. if (IsClientInGame(client) && IsPlayerAlive(client) && LRMode==7)
  804. {
  805. if (buttons & IN_ATTACK2)
  806. {
  807. SetEntData(client, fov_offset, 90, 4, true);
  808. SetEntData(client, zoom_offset, 90, 4, true);
  809. return Plugin_Changed;
  810. }
  811. }
  812. return Plugin_Continue;
  813. }
  814. public Action:StartBeacon(Handle:timer, any:client)
  815. {
  816. if (isFighting == true && IsClientInGame(client) && IsClientInGame(client) && IsPlayerAlive(client))
  817. {
  818. new redColor[4] = {255, 75, 75, 255};
  819. new blueColor[4] = {75, 75, 255, 255};
  820. new greyColor[4] = {128, 128, 128, 255};
  821. new team = GetClientTeam(client);
  822. new Float:vec[3];
  823. GetClientAbsOrigin(client, vec);
  824. vec[2] += 10;
  825.  
  826. TE_SetupBeamRingPoint(vec, 10.0, 375.0, g_beamsprite, g_halosprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  827. TE_SendToAll();
  828.  
  829. if (team == 2)
  830. {
  831. TE_SetupBeamRingPoint(vec, 10.0, 375.0, g_beamsprite, g_halosprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0);
  832. }
  833. else if (team == 3)
  834. {
  835. TE_SetupBeamRingPoint(vec, 10.0, 375.0, g_beamsprite, g_halosprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0);
  836. }
  837. TE_SendToAll();
  838.  
  839. GetClientEyePosition(client, vec);
  840. EmitAmbientSound("buttons/blip1.wav", vec, client, SNDLEVEL_RAIDSIREN);
  841. return Plugin_Continue;
  842. }
  843. return Plugin_Stop;
  844. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement