Advertisement
Guest User

init.lua

a guest
May 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. --init.lua
  2.  
  3. AddCSLuaFile("cl_init.lua");
  4. AddCSLuaFile("shared.lua");
  5. include("shared.lua");
  6.  
  7. function ENT:Initialize()
  8.     self:SetModel("models/w_models/weapons/w_eq_painpills.mdl");
  9.     self:PhysicsInit(SOLID_VPHYSICS);
  10.    
  11.     self:SetMoveType(MOVETYPE_VPHYSICS);
  12.     self:SetSolid(SOLID_VPHYSICS);
  13.    
  14.     self:GetPhysicsObject():SetMass(10);
  15.     self:GetPhysicsObject():SetVelocity((self:GetUp() * 2));
  16.     self.jailWall = true;
  17.     self.SetColor = (Color(15, 72, 217, 255));
  18.  
  19. end;
  20.  
  21. function ENT:OnTakeDamage(dmginfo)
  22.     self:Remove();
  23. end;
  24.  
  25. function ENT:SalePrice(activator)
  26.     return math.random(math.Round(self:Getprice() / 8), math.Round(self:Getprice() / 4))
  27. end
  28.  
  29. function ENT:canUse(activator)
  30.     if activator.maxDrugs and activator.maxDrugs >= GAMEMODE.Config.maxdrugs then
  31.         DarkRP.notify(activator, 1, 3, DarkRP.getPhrase("limit", self.itemPhrase))
  32.         return false
  33.     end
  34.     return true
  35. end
  36.  
  37. function ENT:createItem(activator)
  38.     local drugPos = self:GetPos()
  39.     local drug = ents.Create("d_methadone_pill")
  40.     drug:SetPos(Vector(drugPos.x, drugPos.y, drugPos.z + 35))
  41.     drug:Setowning_ent(activator)
  42.     drug.SID = activator.SID
  43.     drug.nodupe = true
  44.     drug:Setprice(self:Getprice() or self.initialPrice)
  45.     drug:Spawn()
  46.     if not activator.maxDrugs then
  47.         activator.maxDrugs = 0
  48.     end
  49.     activator.maxDrugs = activator.maxDrugs + 1
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement