Advertisement
Guest User

init.lua

a guest
Mar 19th, 2010
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. -- RRPX Money Printer reworked for DarkRP by philxyz
  2. AddCSLuaFile("cl_init.lua")
  3. AddCSLuaFile("shared.lua")
  4. include("shared.lua")
  5.  
  6. function ENT:Initialize()
  7.     self:SetModel("models/props/cs_office/plant01.mdl")
  8.     self:PhysicsInit(SOLID_VPHYSICS)
  9.     self:SetMoveType(MOVETYPE_VPHYSICS)
  10.     self:SetSolid(SOLID_VPHYSICS)
  11.     local phys = self:GetPhysicsObject()
  12.     if phys:IsValid() then phys:Wake() end
  13.     self:SetNWBool("weed_plant", true)
  14.     self.sparking = false
  15.     self.damage = 100
  16.     self.IsWeedPlant = true
  17.     ply = self:GetNWEntity("owning_ent")
  18.     if not ply.maxplants then
  19.         ply.maxplants = 0
  20.     end
  21.     ply.maxplants = ply.maxplants + 1
  22.     timer.Simple(30, self.CreateWeed, self)
  23. end
  24.  
  25. function ENT:OnTakeDamage(dmg)
  26.     self.damage = self.damage - dmg:GetDamage()
  27.     if self.damage <= 0 then
  28.             self:Remove()
  29.     end
  30. end
  31.  
  32.  
  33. local function PrintMore(ent)
  34.     if ValidEntity(ent) then
  35.         timer.Simple(3, ent.CreateWeed, ent)
  36.     end
  37. end
  38.  
  39. function ENT:CreateWeed()
  40.     if not ValidEntity(self) then return end
  41.     if self:IsOnFire() then return end
  42.     local WeedPos = self:GetPos()
  43.  
  44.     local weed = ents.Create("durgz_weed")
  45.     weed:SetNWString("Owner", "Shared")
  46.     weed:SetPos(Vector(WeedPos.x, WeedPos.y, WeedPos.z + 15))
  47.     weed.nodupe = true
  48.     weed:Spawn()
  49.     weed:GetPhysicsObject():Wake()
  50.     timer.Simple(math.random(100, 350), PrintMore, self)
  51. end
  52.  
  53. function ENT:OnRemove()
  54.     if not ValidEntity(ply) then return end
  55.     if not ply.maxplants then
  56.         ply.maxplants = 0
  57.         return
  58.     end
  59.     ply.maxplants = ply.maxplants - 1
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement