• Disabling Money Printers
    4 replies, posted
I am trying to make some money printers for DarkRP. I want to set them to be disabled after 10 minutes (600 seconds). Nothing I have tried has worked. I tried setting a NWInt for it, and using a timer. Whenever I make a time to run the function to set the NWInt to true, the console says Timer Failed! (setting it to true should disable the printer and also print in the console, disabled, for testing purposes...) Any ideas? EDIT: Posted code in 2 posts down.
Post the timer line.
NWInt stands for Networked Integer. Ergo, integer is a number, not a boolean. Posting code might help in this case...
[CODE]local PrintMore function ENT:Initialize() self:SetModel("models/props_c17/consolebox01a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end self:SetColor( Color( 255, 255, 255, 255 ) ) self.sparking = false self.damage = 100 self.IsMoneyPrinter = true timer.Simple(10, function() PrintMore(self) end) self:SetNWInt("Level", 1) self:SetNWInt("disabled", 0) // not dis timer.Simple( 3, function() isdisabled(self) end ) end function isdisabled(self) self:SetNWInt("disabled", 1) // dis self:SetColor( Color ( 255, 0, 0, 255 ) ) print(GetNWInt("disabled")) end[/CODE] [CODE]function ENT:Use( activator, caller ) if self:GetNWInt("disabled") == 1 then //if disabled self:SetNWInt("disabled", 0) //reinable self:SetColor( Color ( 255, 255, 255, 255) ) print(self:GetNWInt("disabled")) end local ug0 = HOOPLA.MoneyPrinter1.Upgrade0 local ug1 = HOOPLA.MoneyPrinter1.Upgrade1 local ug2 = HOOPLA.MoneyPrinter1.Upgrade2 local ug3 = HOOPLA.MoneyPrinter1.Upgrade3 local ug4 = HOOPLA.MoneyPrinter1.Upgrade4 local currentlvl = self:GetNWInt("Level") local price = ug0 if currentlvl == 1 then price = ug1 end if currentlvl == 2 then price = ug2 end if currentlvl == 3 then price = ug3 end if currentlvl == 4 then price = ug4 end if self:GetNWInt("Level") < HOOPLA.MoneyPrinter1.MaxLevel then if activator:canAfford(price) then activator:addMoney(-price) self:SetNWInt("Level", self:GetNWInt("Level") + 1) DarkRP.notify( activator, 1, 4, "Your "..HOOPLA.MoneyPrinter1.DisplayName.." is now level "..self:GetNWInt("Level").."." ) end end end[/CODE] 1 is disabled, 0 is not disabled. This does disable it, but when I re-enable it, it never deactivates again. Also this breaks my upgrade printer code...
Could really use any insight..
Sorry, you need to Log In to post a reply to this thread.