Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. static bool:BotsCanUseT1Wep=false;
  5. static bool:BotsCanUseT2Wep=false;
  6.  
  7. public OnPluginStart()
  8. {
  9. HookEvent("round_end", eEnd);
  10. CreateTimer(1.0,TimerUpdate, _, TIMER_REPEAT);
  11. }
  12.  
  13. public Action:eEnd(Handle:event, const String:name[], bool:dontBroadcast)
  14. {
  15. BotsCanUseT1Wep=false;
  16. BotsCanUseT2Wep=false;
  17. }
  18.  
  19. public Action:TimerUpdate(Handle:timer)
  20. {
  21. for (new i=1; i<=MaxClients; i++)
  22. {
  23. if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
  24. {
  25. new wIndex = GetPlayerWeaponSlot(i, 0);
  26.  
  27. if(wIndex == -1) return Plugin_Continue;
  28.  
  29. new String:classname[128];
  30. GetEdictClassname(wIndex, classname, sizeof(classname));
  31. if (StrEqual(classname, "weapon_pumpshotgun")
  32. || StrEqual(classname, "weapon_shotgun_chrome")
  33. || StrEqual(classname, "weapon_smg")
  34. || StrEqual(classname, "weapon_smg_silenced")
  35. || StrEqual(classname, "weapon_smg_mp5"))
  36. {
  37. BotsCanUseT1Wep=true;
  38. //BotsCanUseT2Wep=true;
  39. }
  40. }
  41. }
  42.  
  43. return Plugin_Continue;
  44. }
  45.  
  46. public Action:L4D2_OnFindScavengeItem(client, &item)
  47. {
  48.  
  49. if (BotsCanUseT1Wep==false && IsT1Weapon(item))
  50. {
  51. return Plugin_Handled;
  52. }
  53.  
  54. else if (BotsCanUseT2Wep==false && IsT2Weapon(item))
  55. {
  56. return Plugin_Handled;
  57. }
  58.  
  59. return Plugin_Continue;
  60. }
  61.  
  62. stock bool:IsSMG(entity)
  63. {
  64. if (entity > 0 || entity < 2048)
  65. {
  66. new String:classname[256];
  67. new String:modelname[256];
  68. if (IsValidEntity(entity))
  69. {
  70. GetEntityClassname(entity, classname, 128);
  71. GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
  72. if (StrEqual(classname, "weapon_smg")
  73. || StrEqual(classname, "weapon_smg_spawn")
  74. || StrEqual(classname, "weapon_smg_silenced")
  75. || StrEqual(classname, "weapon_smg_silenced_spawn")
  76. || StrEqual(classname, "weapon_smg_mp5")
  77. || StrEqual(classname, "weapon_smg_mp5_spawn")
  78. || StrEqual(modelname, "models/w_models/weapons/w_smg_mp5.mdl")
  79. || StrEqual(modelname, "models/w_models/weapons/w_smg_uzi.mdl")
  80. || StrEqual(modelname, "models/w_models/weapons/w_smg_a.mdl"))
  81. {
  82. return true;
  83. }
  84. }
  85. }
  86. return false;
  87. }
  88.  
  89. stock bool:IsT1Shotgun(entity)
  90. {
  91. if (entity > 0 || entity < 2048)
  92. {
  93. new String:classname[256];
  94. new String:modelname[256];
  95. if (IsValidEntity(entity))
  96. {
  97. GetEntityClassname(entity, classname, 128);
  98. GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
  99. if (StrEqual(classname, "weapon_pumpshotgun")
  100. || StrEqual(classname, "weapon_pumpshotgun_spawn")
  101. || StrEqual(classname, "weapon_shotgun_chrome")
  102. || StrEqual(classname, "weapon_shotgun_chrome_spawn")
  103. || StrEqual(modelname, "models/w_models/weapons/w_shotgun.mdl")
  104. || StrEqual(modelname, "models/w_models/weapons/w_pumpshotgun_a.mdl"))
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112.  
  113. stock bool:IsT2Shotgun(entity)
  114. {
  115. if (entity > 0 || entity < 2048)
  116. {
  117. new String:classname[256];
  118. new String:modelname[256];
  119. if (IsValidEntity(entity))
  120. {
  121. GetEntityClassname(entity, classname, 128);
  122. GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
  123. if (StrEqual(classname, "weapon_autoshotgun")
  124. || StrEqual(classname, "weapon_autoshotgun_spawn")
  125. || StrEqual(classname, "weapon_shotgun_spas")
  126. || StrEqual(classname, "weapon_shotgun_spas_spawn")
  127. || StrEqual(modelname, "models/w_models/weapons/w_autoshot_m4super.mdl")
  128. || StrEqual(modelname, "models/w_models/weapons/w_shotgun_spas.mdl"))
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136.  
  137. stock bool:IsAssaultRifle(entity)
  138. {
  139. if (entity > 0 || entity < 2048)
  140. {
  141. new String:classname[256];
  142. new String:modelname[256];
  143. if (IsValidEntity(entity))
  144. {
  145. GetEntityClassname(entity, classname, 128);
  146. GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
  147. if (StrEqual(classname, "weapon_rifle")
  148. || StrEqual(classname, "weapon_rifle_spawn")
  149. || StrEqual(classname, "weapon_rifle_desert")
  150. || StrEqual(classname, "weapon_rifle_desert_spawn")
  151. || StrEqual(classname, "weapon_rifle_ak47")
  152. || StrEqual(classname, "weapon_rifle_ak47_spawn")
  153. || StrEqual(classname, "weapon_rifle_sg552")
  154. || StrEqual(classname, "weapon_rifle_sg552_spawn")
  155. || StrEqual(modelname, "models/w_models/weapons/w_rifle_m16a2.mdl")
  156. || StrEqual(modelname, "models/w_models/weapons/w_desert_rifle.mdl")
  157. || StrEqual(modelname, "models/w_models/weapons/w_rifle_ak47.mdl")
  158. || StrEqual(modelname, "models/w_models/weapons/w_rifle_sg552.mdl"))
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. return false;
  165. }
  166.  
  167. stock bool:IsSniper(entity)
  168. {
  169. if (entity > 0 || entity < 2048)
  170. {
  171. new String:classname[256];
  172. new String:modelname[256];
  173. if (IsValidEntity(entity))
  174. {
  175. GetEntityClassname(entity, classname, 128);
  176. GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
  177. if (StrEqual(classname, "weapon_hunting_rifle")
  178. || StrEqual(classname, "weapon_hunting_rifle_spawn")
  179. || StrEqual(classname, "weapon_sniper_military")
  180. || StrEqual(classname, "weapon_sniper_military_spawn")
  181. || StrEqual(classname, "weapon_sniper_awp")
  182. || StrEqual(classname, "weapon_sniper_awp_spawn")
  183. || StrEqual(classname, "weapon_sniper_scout")
  184. || StrEqual(classname, "weapon_sniper_scout_spawn")
  185. || StrEqual(modelname, "models/w_models/weapons/w_sniper_mini14.mdl")
  186. || StrEqual(modelname, "models/w_models/weapons/w_sniper_military.mdl")
  187. || StrEqual(modelname, "models/w_models/weapons/w_sniper_awp.mdl")
  188. || StrEqual(modelname, "models/w_models/weapons/w_sniper_scout.mdl"))
  189. {
  190. return true;
  191. }
  192. }
  193. }
  194. return false;
  195. }
  196.  
  197. stock bool:IsT1Weapon(Primary)
  198. {
  199. if (IsValidEdict(Primary) || IsValidEntity(Primary))
  200. {
  201. if (IsT1Shotgun(Primary) || IsSMG(Primary))
  202. {
  203. return true;
  204. }
  205. }
  206. return false;
  207. }
  208.  
  209. stock bool:IsT2Weapon(Primary)
  210. {
  211. if (IsValidEdict(Primary) || IsValidEntity(Primary))
  212. {
  213. if (IsT2Shotgun(Primary) || IsAssaultRifle(Primary) || IsSniper(Primary))
  214. {
  215. return true;
  216. }
  217. }
  218. return false;
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement