Guest User

Untitled

a guest
Jun 11th, 2018
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. --[[
  2. © 2015 CloudSixteen.com do not share, re-distribute or modify
  3. without permission of its author (kurozael@gmail.com).
  4.  
  5. Clockwork was created by Conna Wiles (also known as kurozael.)
  6. http://cloudsixteen.com/license/clockwork.html
  7.  
  8. Atomic was developed by NightAngel, if you have any questions or
  9. wish to give any feedback whatsoever, please send a message to
  10. http://steamcommunity.com/id/NA1455.
  11. --]]
  12.  
  13. local ITEM = Clockwork.item:New("clothes_base", true);
  14.  
  15. ITEM.name = "base_apparel";
  16. ITEM.uniqueID = "base_apparel";
  17. ITEM.useSound = "atomic/placeholder.mp3";
  18.  
  19. -- Called when a player changes clothes.
  20. function ITEM:OnChangeClothes(player, bIsWearing)
  21. if (bIsWearing) then
  22. local replacement = nil;
  23.  
  24. if (self.GetReplacement) then
  25. replacement = self:GetReplacement(player);
  26. end;
  27.  
  28. if (type(replacement) == "string") then
  29. player:SetModel(replacement);
  30. elseif (self("replacement")) then
  31. player:SetModel(self("replacement"));
  32. elseif (self("group")) then
  33. player:SetModel("models/humans/"..self("group").."/"..self:GetModelName(player));
  34. end;
  35.  
  36. if (self.specialBoost) then
  37. for k, v in pairs(self.specialBoost) do
  38. player:AddBoost(k, v, true);
  39. end;
  40. end;
  41.  
  42. local armor = self:GetData("Armor");
  43.  
  44. if (armor) then
  45. player:SetArmor(math.Clamp(armor, 0, player:GetMaxArmor()));
  46. end;
  47.  
  48. player:EmitSound("atomic/items/clothing/clothing_equip_0"..math.random(1, 3)..".mp3");
  49. else
  50. if (self.specialBoost) then
  51. for k, v in pairs(self.specialBoost) do
  52. player:AddBoost(k, 0, true);
  53. end;
  54. end;
  55.  
  56. Clockwork.player:SetDefaultModel(player);
  57. Clockwork.player:SetDefaultSkin(player);
  58.  
  59. local armor = self:GetData("Armor");
  60.  
  61. if (armor) then
  62. player:SetArmor(math.Clamp(player:Armor() - armor, 0, player:GetMaxArmor()));
  63. end;
  64.  
  65. player:EmitSound("atomic/items/clothing/clothing_remove_0"..math.random(1, 3)..".mp3");
  66. end;
  67.  
  68. if (self.overlay) then
  69. Atomic.overlay:SetEnabled(self.overlay, bIsWearing, player);
  70. end;
  71.  
  72. if (self.OnChangedClothes) then
  73. self:OnChangedClothes(player, bIsWearing);
  74. end;
  75.  
  76. Clockwork.plugin:Call("OnChangedClothes", player, self, bIsWearing);
  77. end;
  78.  
  79. ITEM:Register();
Add Comment
Please, Sign In to add comment