Advertisement
Guest User

Untitled

a guest
Aug 1st, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. // Global variables
  2. new bool:projectiletype[2048];
  3. // Will hold the custom weapon's model path passed from the weapon's configuration file.
  4. new String:projectilename[2048][250];
  5.  
  6.  
  7.  
  8. public Action:CustomWeaponsTF_OnAddAttribute(iWeapon, iClient, const String:attrib[], const String:plugin[], const String:value[])
  9. {
  10. if(!StrEqual(plugin, "bill")) return Plugin_Continue;
  11.  
  12. new Action:action;
  13.  
  14. ... // Other attributes
  15. ... // Other attributes
  16. else if(StrEqual(attrib, "projectile test"))
  17. {
  18.  
  19. projectiletype[iClient] = true;
  20.  
  21. Format(projectilename[iClient], 250, value);
  22.  
  23.  
  24. action = Plugin_Handled;
  25. }
  26. ... // Other attributes
  27. ... // Other attributes
  28.  
  29. if(!HasAttribute[iWeapon]) HasAttribute[iWeapon] = bool:action;
  30.  
  31. return action;
  32. }
  33.  
  34.  
  35. public OnEntityCreated(iEntity, const String:strClassname[])
  36. {
  37. if (!IsValidEntity(iEntity)) return;
  38. if(IsValidEntity(iEntity) && StrEqual(strClassname, "tf_projectile_pipe"))
  39. {
  40. SDKHook(iEntity, SDKHook_SpawnPost, TF_PROJECTILE_PIPE);
  41. }
  42. }
  43.  
  44.  
  45. public TF_PROJECTILE_PIPE(entity)
  46. {
  47. // Checks if the player has the attribute
  48. if(projectiletype[GetOwnerPipe(entity)])
  49. {
  50. // "here" is just for debug
  51. PrintToChatAll("here");
  52. SetEntityModel(entity,projectilename[GetOwnerPipe(entity)]);
  53. }
  54. }
  55.  
  56. // Retrieves the owner of the projectile
  57. stock GetOwnerPipe(iEntity){
  58. if(projectiletype[GetEntPropEnt(iEntity, Prop_Data, "m_hOwnerEntity")]){
  59. return GetEntPropEnt(iEntity, Prop_Data, "m_hOwnerEntity");
  60. }
  61. return false;
  62. }
  63.  
  64. public OnEntityDestroyed(Ent)
  65. {
  66. if(Ent <= 0 || Ent > 2048) return;
  67. projectiletype[Ent] = false;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement