Advertisement
Hairyfermentednipple

Untitled

Jul 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. local PLUGIN = PLUGIN;
  2.  
  3. local ITEM = Clockwork.item:New(nil, true);
  4. ITEM.name = "Card Base";
  5. ITEM.uniqueID = "card_base";
  6. ITEM.model = "models/dorado/tarjeta2.mdl";
  7. ITEM.weight = 0.05;
  8. ITEM.description = "A small, metallic card with a magnetic strip used for identification purposes.";
  9.  
  10. ITEM:AddData("Key", 0, true);
  11. ITEM:AddData("CombineID", "123456", true);
  12. ITEM:AddData("CardNumber", "123:4567:89-02", true);
  13. ITEM:AddData("Owner", "John Doe", true);
  14.  
  15. function ITEM:OnDrop(player, position) end;
  16.  
  17. if (CLIENT) then
  18. function ITEM:OnHUDPaintTargetID(ent, x, y, alpha)
  19. return Clockwork.kernel:DrawInfo("["..self:GetData("Owner")..": #"..self:GetData("CombineID").."]", x, y, Color(255, 255, 255), alpha);
  20. end;
  21. else
  22. function ITEM:MakeOwner(player)
  23. self:SetData("Key", player:GetCharacterKey());
  24. self:SetData("CardNumber", PLUGIN:GetDigits(self("itemID")));
  25. self:SetData("CombineID", player:GetCharacterData("citizenid"));
  26. self:SetData("Owner", player:Name());
  27. player:SetCharacterData("CIDCard", self("itemID"));
  28. end;
  29.  
  30. -- Called when an item is given to a player.
  31. function ITEM:OnGiveToPlayer(player)
  32. if (self:GetData("Key") == 0 and (!self.CanMakeOwner or self:CanMakeOwner(player))) then
  33. self:MakeOwner(player);
  34. end;
  35. end;
  36.  
  37. -- Called when the player's gear is restored.
  38. function ITEM:OnRestorePlayerGear(player)
  39. if (self:GetData("Key") == 0 and (!self.CanMakeOwner or self:CanMakeOwner(player))) then
  40. self:MakeOwner(player);
  41. elseif (self:GetData("Key") == player:GetCharacterKey()) then
  42. self:SetData("Owner", player:Name());
  43. end;
  44. end;
  45. end;
  46.  
  47. ITEM:Register();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement