Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. --[[
  2. © CloudSixteen.com do not share, re-distribute or modify
  3. without permission of its author (kurozael@gmail.com).
  4. --]]
  5.  
  6. local ITEM = Clockwork.item:New();
  7.  
  8. ITEM.name = "Standard Ration";
  9. ITEM.uniqueID = "ration";
  10. ITEM.model = "models/weapons/w_packatc.mdl";
  11. ITEM.weight = 2;
  12. ITEM.useText = "Open";
  13. ITEM.description = "ItemRationDesc";
  14.  
  15. -- Called when a player attempts to pick up the item.
  16. function ITEM:CanPickup(player, quickUse, itemEntity)
  17. if (quickUse) then
  18. if (!player:CanHoldWeight(self.weight)) then
  19. Clockwork.player:Notify(player, {"YourInventoryFull"});
  20.  
  21. return false;
  22. end;
  23. end;
  24. end;
  25.  
  26. -- Called when a player uses the item.
  27. function ITEM:OnUse(player, itemEntity)
  28. if (Schema:PlayerIsCombine(player) != true) then
  29.  
  30. return false;
  31.  
  32. else
  33. Clockwork.player:Notify(player, {"YouCannotOpenRation"});
  34.  
  35. return true;
  36. elseif (player:GetFaction() == FACTION_ADMIN) then
  37. Clockwork.player:Notify(player, {"YouCannotOpenRation"});
  38.  
  39. return false;
  40. else
  41. Clockwork.player:GiveCash(player, 50, {"CashRationPacket"});
  42.  
  43. player:GiveItem(Clockwork.item:CreateInstance("citizen_supplements"), true);
  44. player:GiveItem(Clockwork.item:CreateInstance("smooth_breen_s_water"), true);
  45.  
  46. Clockwork.plugin:Call("PlayerUseRation", player);
  47. end;
  48. end;
  49.  
  50. -- Called when a player drops the item.
  51. function ITEM:OnDrop(player, position) end;
  52.  
  53. ITEM:Register();
  54.  
  55. -- Test --
  56.  
  57. local ITEM = Clockwork.item:New();
  58.  
  59. ITEM.name = "Standard Ration";
  60. ITEM.uniqueID = "cpration";
  61. ITEM.model = "models/weapons/w_packatc.mdl";
  62. ITEM.weight = 2;
  63. ITEM.useText = "Open";
  64. ITEM.description = "ItemRationDesc";
  65.  
  66. -- Called when a player attempts to pick up the item.
  67. function ITEM:CanPickup(player, quickUse, itemEntity)
  68. if (quickUse) then
  69. if (!player:CanHoldWeight(self.weight)) then
  70. Clockwork.player:Notify(player, {"YourInventoryFull"});
  71.  
  72. return false;
  73. end;
  74. end;
  75. end;
  76.  
  77. -- Called when a player uses the item.
  78. function ITEM:OnUse(player, itemEntity)
  79. if (Schema:PlayerIsCitizen(player)) then
  80. Clockwork.player:Notify(player, {"YouCannotOpenRation"});
  81.  
  82. return false;
  83. elseif (player:GetFaction() == FACTION_ADMIN) then
  84. Clockwork.player:Notify(player, {"YouCannotOpenRation"});
  85.  
  86. return false;
  87. else
  88. Clockwork.player:GiveCash(player, 50, {"CashRationPacket"});
  89.  
  90. player:GiveItem(Clockwork.item:CreateInstance("citizen_supplements"), true);
  91. player:GiveItem(Clockwork.item:CreateInstance("smooth_breen_s_water"), true);
  92.  
  93. Clockwork.plugin:Call("PlayerUseRation", player);
  94. end;
  95. end;
  96.  
  97. -- Called when a player drops the item.
  98. function ITEM:OnDrop(player, position) end;
  99.  
  100. ITEM:Register();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement