DeathChaos25

[L4D2]

Aug 19th, 2015
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. public Action:REPLACEMEDKITS(Handle:Timer)
  2. {
  3. new EntityCount = GetEntityCount();
  4. for (new entity = 0; entity < EntityCount; entity++)
  5. {
  6. if (!IsValidEdict(entity))
  7. {
  8. continue;
  9. }
  10. new String:classname[128], String:model[128];
  11. GetEdictClassname(entity, classname, sizeof(classname));
  12. GetEntPropString(entity, Prop_Data, "m_ModelName", model, sizeof(model));
  13. if (StrContains(classname, "weapon_first_aid_kit", false) != -1 || StrEqual(model, MODEL_KIT))
  14. {
  15. new pills = CreateEntityByName("weapon_pain_pills_spawn");
  16. new Float:Origin[3];
  17. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", Origin);
  18. TeleportEntity(pills, Origin, NULL_VECTOR, NULL_VECTOR);
  19. DispatchSpawn(pills);
  20. //SetEntityModel(pills, "models/w_models/weapons/w_eq_painpills.mdl");
  21. AcceptEntityInput(entity, "kill");
  22. }
  23. }
  24. }
  25.  
  26. public Action:GiveItems(Handle:Timer)
  27. {
  28. for (new i = 1; i <= MaxClients; i++)
  29. {
  30. if (IsSurvivor(i))
  31. {
  32. new item = GetPlayerWeaponSlot(i, 3);
  33. new defib;
  34. if (!IsValidEdict(item))
  35. {
  36. new rng = GetRandomInt(1, 2);
  37. switch (rng)
  38. {
  39. case 1:defib = CreateEntityByName("weapon_defibrillator");
  40. case 2:defib = CreateEntityByName("weapon_first_aid_kit");
  41. }
  42. DispatchSpawn(defib);
  43. EquipPlayerWeapon(i, defib);
  44. }
  45. item = GetPlayerWeaponSlot(i, 4);
  46. if (!IsValidEdict(item))
  47. {
  48. new rng = GetRandomInt(1, 2);
  49. switch (rng)
  50. {
  51. case 1:defib = CreateEntityByName("weapon_pain_pills");
  52. case 2:defib = CreateEntityByName("weapon_adrenaline");
  53. }
  54. DispatchSpawn(defib);
  55. EquipPlayerWeapon(i, defib);
  56. }
  57. }
  58. }
  59. }
  60.  
  61. public Action:CheckMaxPlayers(Handle:Timer)
  62. {
  63. new Survivors = 0;
  64. new LastBot = 0;
  65.  
  66. for (new i = 1; i <= MaxClients; i++)
  67. {
  68. if (IsSurvivor(i))
  69. {
  70. Survivors++;
  71. }
  72. if (IsSurvivor(i) && IsFakeClient(i))
  73. {
  74. LastBot = i;
  75. }
  76. }
  77. if (Survivors < 8)
  78. {
  79. CreateBot();
  80. }
  81. else if (Survivors > 8 && IsSurvivor(LastBot) && IsFakeClient(LastBot))
  82. {
  83. KickClient(LastBot);
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment