• Money Printer For DarkRP
    23 replies, posted
  • Avatar of thoron174
  • Can someone please make me a money printer for darkrp.I tried to make it but it did not work.Can some one help me I am a complete noob at lua. I understand very little so can some one help ?
  • Avatar of thoron174
  • [QUOTE=philxyz]Look inside RRPX :-)[/QUOTE] I did that but how do I get it to work with the new darkrp? I can't get the chat command to work. and I want to add that when a cop spawns he has a swep.He has the Tranquilizer gun and not a real gun link to the swep is here [url]http://forums.facepunchstudios.com/showthread.php?t=505658[/url] [b]Edit:[/b] ok I got the Tranquilizer gun to work and made it so cops have it at start but I just can get the money printer to work this is what I did 1 - I added the the entity "money_printer" from "RRPX" in to DarkRP\entities\entities 2 - I added this to line 847 in to the "rplol.lua" file [lua] function MakeMprinter( ply ) local trace = { } --if( args == "" ) then return ""; end trace.start = ply:EyePos(); trace.endpos = trace.start + ply:GetAimVector() * 85; trace.filter = ply; if( ply:GetTable().Arrested ) then return ""; end local tr = util.TraceLine( trace ); if( not tr.Entity:IsValid() and tr.Entity ~= "craftingtable") then Notify( ply, 1, 4, "Must be looking at your crafting table and close enough!" ) return ""; end if tr.Entity:GetNWEntity("ownu") ~= ply then Notify( ply, 1, 4, "That's not your crafting table!" ) return ""; end if( ply:Team() ~= 16 and ply:Team() ~= 31 ) then Notify( ply, 1, 4, "Must be a Crafter!") return ""; end if( ply:GetTable().Arrested ) then return ""; end if( not ply:CanAfford( GetGlobalInt("mprintercost") / 2 ) ) then Notify( ply, 1, 3, "Cannot afford this" ); return ""; end if(ply:GetNWInt("maxmprinters") == CfgVars["maxmprinters"])then Notify( ply, 1, 3, "Max Money Printers Reached!" ); return ""; end ply:AddMoney( GetGlobalInt("mprintercost") / 2 * -1 ); Notify( ply, 1, 3, "You made a Money Printer for "..GetGlobalInt("mprintercost") / 2 .."!" ); local moneyprinter = ents.Create( "money_printer" ); moneyprinter:SetNWEntity( "ownu", ply ); local drugPos = tr.Entity:GetPos() moneyprinter:SetPos(Vector(drugPos.x,drugPos.y,drugPos.z + 10)) moneyprinter:Spawn(); return ""; end AddChatCommand( "/makemoneyprinter", MakeMprinter ); [/lua] 3 -I added this console commands in to rprofl.lua [lua] SetGlobalInt("mprintamount", 250) SetGlobalInt("mprintercost", 1000) [/lua] and in to init.lua i added this at line 235 CfgVars["maxmprinters"] = 2; 4 - I added this to cl_init.lua to line 181 [lua] if( tr.Entity:GetClass() == "money_printer" ) then pos = LocalPlayer():GetEyeTrace().HitPos:ToScreen(); draw.DrawText( "Money Printer", "TargetID", pos.x + 1, pos.y + 1, Color( 255, 255, 255, 200 ), 1 ); end [/lua] [b]Edit:[/b] can someone please help me [b]Edit:[/b] any body please help me [b]Edit:[/b] [QUOTE=philxyz]Look inside RRPX :-)[/QUOTE] here look this is what I did.Can you please look and tell me what I have to add or modify.
  • Avatar of otoris
  • May I ask what version of Dark RP are you using? There are so many other Dark RP updates done by different people than the original. Then maybe I can take a look into this.
  • Avatar of thoron174
  • [QUOTE=otoris]May I ask what version of Dark RP are you using? There are so many other Dark RP updates done by different people than the original. Then maybe I can take a look into this.[/QUOTE] this is darkrp version 2.2.12 I think its the last one.I think
  • Avatar of Unib5
  • [QUOTE=thoron174]this is darkrp version 1.1.12 I think its the last one.I think[/QUOTE] Don't you mean 2.2.12?
  • Avatar of philxyz
  • [code] function BuyMoneyPrinter(ply, args) if ply:GetTable().Arrested then return "" end local trace = {} trace.start = ply:EyePos() trace.endpos = trace.start + ply:GetAimVector() * 85 trace.filter = ply local tr = util.TraceLine(trace) if not ply:CanAfford(GetGlobalInt("mprintercost") then Notify(ply, 1, 3, "Cannot afford this") return "" end if ply:GetNWInt("maxmprinters") >= CfgVars["maxmprinters"] then Notify(ply, 1, 3, "Max Money Printers Reached!") return "" end ply:AddMoney(GetGlobalInt("mprintercost") * -1) Notify( ply, 1, 3, "You bought a Money Printer for " .. GetGlobalInt("mprintercost") .. "!") local moneyprinter = ents.Create("money_printer") moneyprinter:SetNWEntity("ownu", ply) local drugPos = tr.Entity:GetPos() moneyprinter:SetPos(Vector(drugPos.x,drugPos.y,drugPos.z + 10)) moneyprinter:Spawn() return "" end AddChatCommand("/moneyprinter", BuyMoneyPrinter) [/code]
  • Avatar of thoron174
  • [QUOTE=philxyz][code] function BuyMoneyPrinter(ply, args) if ply:GetTable().Arrested then return "" end local trace = {} trace.start = ply:EyePos() trace.endpos = trace.start + ply:GetAimVector() * 85 trace.filter = ply local tr = util.TraceLine(trace) if not ply:CanAfford(GetGlobalInt("mprintercost") then Notify(ply, 1, 3, "Cannot afford this") return "" end if ply:GetNWInt("maxmprinters") >= CfgVars["maxmprinters"] then Notify(ply, 1, 3, "Max Money Printers Reached!") return "" end ply:AddMoney(GetGlobalInt("mprintercost") * -1) Notify( ply, 1, 3, "You bought a Money Printer for " .. GetGlobalInt("mprintercost") .. "!") local moneyprinter = ents.Create("money_printer") moneyprinter:SetNWEntity("ownu", ply) local drugPos = tr.Entity:GetPos() moneyprinter:SetPos(Vector(drugPos.x,drugPos.y,drugPos.z + 10)) moneyprinter:Spawn() return "" end AddChatCommand("/moneyprinter", BuyMoneyPrinter) [/code][/QUOTE] so if i replace the line 847 in the file "rplol.lua" with this it will work ? the coding did not work what have i done wrong ? here is the money printer init.lua [lua] -- ============================================ -- = = -- = Crate SENT by Mahalis = -- = = -- ============================================ AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include('shared.lua') function ENT:Initialize() self.Entity:SetModel( "models/props_c17/consolebox01a.mdl") self.Entity:PhysicsInit(SOLID_VPHYSICS) self.Entity:SetMoveType(MOVETYPE_VPHYSICS) self.Entity:SetSolid(SOLID_VPHYSICS) local phys = self.Entity:GetPhysicsObject() if(phys:IsValid()) then phys:Wake() end timer.Create( self.Entity, 180, 0, self.createMoneybag, self) timer.Create( "Egg", 3600, 0, self.Destruct, self) timer.Create( "Egg2", 3600, 0, self.Remove, self) self.Entity:SetNWBool("sparking",false) self.Entity:SetNWInt("damage",100) local ply = self.Entity:GetNWEntity( "ownu" ) ply:SetNWInt("maxmprinters",ply:GetNWInt("maxmprinters") + 1) --timer.Create( self.Entity:EntIndex() .. "moneybag", 60, 1, self.createMoneybag, self ) end function ENT:OnTakeDamage(dmg) self.Entity:SetNWInt("damage",self.Entity:GetNWInt("damage") - dmg:GetDamage()) if(self.Entity:GetNWInt("damage") <= 0) then self.Entity:Destruct() self.Entity:Remove() end end function ENT:Destruct() local vPoint = self.Entity:GetPos() local effectdata = EffectData() effect******SetStart( vPoint ) effect******SetOrigin( vPoint ) effect******SetScale( 1 ) util.Effect( "Explosion", effectdata ) end --function ENT:Use(activator,caller) -- self.Entity:SetNWEntity( "usero", activator ) -- if( activator:GetNWInt("maxmprint") >= 5 ) then -- Notify( activator, 1, 3, "Printed Max Money" ); -- else -- self.Entity:SetNWBool("sparking",true) -- timer.Create( self.Entity:EntIndex() .. "moneybag", 1, 1, self.createMoney, self ) -- end --end function ENT:createMoneybag() local ply = self.Entity:GetNWEntity( "ownu" ) local userb = self.Entity:GetNWEntity( "usero" ) self.Entity:SetNWEntity( "usero", ply ) if( ply:GetNWInt("maxmprint") >= 10 ) then Notify( ply, 1, 3, "Printer jammed, try taking some money." ); return ""; end local MoneyPos = self.Entity:GetPos() local rnd1 = math.random(1, 22) if(rnd1 == 3) then Notify( ply, 1, 3, "Your money printer exploded!" ); self.Entity:Destruct() self.Entity:Remove() end --local moneybag = ents.Create( "prop_physics" ); --moneybag:SetPos( tr.HitPos ); --moneybag:Spawn(); --moneybag:GetTable().MoneyBag = true; --moneybag:GetTable().Amount = amount; local moneybag = ents.Create("prop_physics") moneybag:SetModel( "models/props/cs_assault/money.mdl" ); moneybag:SetPos(Vector(MoneyPos.x + 15,MoneyPos.y,MoneyPos.z + 15)) moneybag:SetNWEntity( "ownu", userb ) moneybag:SetColor( 175, 255, 175, 255 ) moneybag:Spawn() moneybag:GetTable().MoneyBag = true; moneybag:SetNWEntity("ownu", ply ) moneybag:GetTable().Amount = GetGlobalInt("mprintamount"); self.Entity:SetNWBool("sparking",false) end function ENT:Think() if(self.Entity:GetNWBool("sparking") == true) then local effectdata = EffectData() effect******SetOrigin( self.Entity:GetPos() ) effect******SetMagnitude( 1 ) effect******SetScale( 1 ) effect******SetRadius( 2 ) util.Effect( "Sparks", effectdata ) end end function ENT:OnRemove( ) timer.Destroy(self.Entity:EntIndex()) timer.Destroy(self.Entity) local ply = self.Entity:GetNWEntity( "ownu" ) ply:SetNWInt("maxmprinters",ply:GetNWInt("maxmprinters") - 1) end [/lua]
  • Avatar of philxyz
  • I'll release this tomorrow as a patch for DarkRP 2.2.12 for those that want it.
  • Avatar of thoron174
  • [QUOTE=philxyz]I'll release this tomorrow as a patch for DarkRP 2.2.12 for those that want it.[/QUOTE] ok thanks man
  • Avatar of philxyz
  • Here it is. It's a little more "fun" than the normal Money Printer but I'm sure you won't mind. It needed some work anyway. [url]http://garrysmod.org/downloads/?a=view&id=54057[/url] [b]EDIT: Re-download it if you have a lua error; I made a typo in hints.lua[/b]
  • Avatar of thoron174
  • [QUOTE=philxyz]Here it is. It's a little more "fun" than the normal Money Printer but I'm sure you won't mind. It needed some work anyway. [url]http://garrysmod.org/downloads/?a=view&id=54027[/url] [b]EDIT: Re-download it if you have a lua error; I made a typo in hints.lua[/b][/QUOTE] ok and thanks so much =D
  • Avatar of philxyz
  • No problema. [b]Edit:[/b] Update: Fixed version: [url]http://garrysmod.org/downloads/?a=view&id=54057[/url]
  • Avatar of thoron174
  • [QUOTE=philxyz]No problema. [b]Edit:[/b] Update: Fixed version: [url]http://garrysmod.org/downloads/?a=view&id=54057[/url][/QUOTE] I made a soda machine that works its only bug is that the can spawns in the machine.How do I get it to spawn at a certain place ? thanks for you files now I understand how do make them =D
  • Avatar of philxyz
  • [QUOTE=thoron174]I made a soda machine that works its only bug is that the can spawns in the machine.How do I get it to spawn at a certain place ? thanks for you files now I understand how do make them =D[/QUOTE] Just make sure that when you spawn, the vector you are spawning at is offset. For example, to make something higher by 15 inches, it is: Vector(x, y+15, z)
  • Avatar of thoron174
  • [QUOTE=philxyz]Just make sure that when you spawn, the vector you are spawning at is offset. For example, to make something higher by 15 inches, it is: Vector(x, y+15, z)[/QUOTE] thanks now that works. [URL=http://img90.imageshack.us/my.php?image=gmconstruct0000tx2.jpg][IMG]http://img90.imageshack.us/img90/2628/gmconstruct0000tx2.th.jpg[/IMG][/URL][URL=http://g.imageshack.us/thpix.php][IMG]http://img90.imageshack.us/images/thpix.gif[/IMG][/URL][URL=http://img504.imageshack.us/my.php?image=gmconstruct0002xb0.jpg][IMG]http://img504.imageshack.us/img504/7488/gmconstruct0002xb0.th.jpg[/IMG][/URL][URL=http://g.imageshack.us/thpix.php][IMG]http://img504.imageshack.us/images/thpix.gif[/IMG][/URL] how do you add a message for the entity in f2 like you put for the money printer.
  • Avatar of Diaklu
  • If only DarkRP was like this. [lua]local ArmsDealer = DarkRP.CreateTeam("Arms Dealer"); ArmsDealer.DefaultHP = 100; ArmsDealer.DefaultArmor = 100; function ArmsDealer:Loadout() local loadout = {}; -- Gravgun, Physgun and Toolgun auto added depending on server variables. loadout[1] = "weapon_pistol"; loadout[2] = "weapon_keys"; return loadout; end function ArmsDealer:OnSpawn(ply) end function ArmsDealer:OnDeath(ply, attacker) end DarkRP.RegisterTeam(ArmsDealer);[/lua] [lua]function Awesome(ply, args) if (DarkRP.GetTeam(ply) == "Arms Dealer") then ply:SetMoney(ply:GetMoney() + 9000 + 1); DarkRP.NotifyAll(ply:Name().." is awesome, Also THE GAME."); else DarkRP.Notify(ply, "You're not an Arms Dealer!"); end end -- Only 'awesome' because prefix is auto added. DarkRP.AddChatCommand("awesome", Awesome);[/lua] Of course this would be a better approach instead of the hard coded shit. I love OOP, by the way. :)
  • Avatar of philxyz
  • DarkRP will never be like that while I'm working on it, I simply can't justify it due to the time it takes to test it all. 2.2.15 however has had some cleanup in terms of massive lists of if statements in favor of tables. SeriousRP will be OOP but please bear in mind it is a MASSIVE task to change it all and I'm not going to do it twice. Also, DarkRP was never designed to be a framework gamemode for people to just "easily" change with their own classes... if I added something like that you would then have another 10,000 threads asking why another area of the code isn't like that and "how do I change the skins" and "I want to make it so that... " it would become a support nightmare because the demand to make it OO is so high that I'd just never stop making it more and more and more OO until all that's left is Cakescript, which might seem to be a good thing but not DarkRP... I want SeriousRP to be able to do that. (Though I'm still not too happy about the idea of supporting everyone's custom stuff added via OO when I can just support the core code) which is what will happen if it's all OO I love OO, too by the way but... there's just SO MUCH code to go wrong.
  • Avatar of philxyz
  • I've removed most of the massive "if" blocks and replaced them with something smaller in DarkRP 2.2.15 beta (release coming in a few hrs) but I'll make sure to do a proper job in SeriousRP and go as OO as I can :) It's just cleaner that way. My goal with DarkRP 2.2 is stability and if I change too much in one go, that's when the regressions start (like in 2.2.13 and 2.2.14) 2.2.15: [url]http://garrysmod.org/downloads/?a=view&id=54506[/url]
  • Avatar of thoron174
  • [QUOTE=philxyz]I've removed most of the massive "if" blocks and replaced them with something smaller in DarkRP 2.2.15 beta (release coming in a few hrs) but I'll make sure to do a proper job in SeriousRP and go as OO as I can :) It's just cleaner that way. My goal with DarkRP 2.2 is stability and if I change too much in one go, that's when the regressions start (like in 2.2.13 and 2.2.14) 2.2.15: [url]http://garrysmod.org/downloads/?a=view&id=54506[/url][/QUOTE] I have one question how do you add something to the f2 menu ?
  • Avatar of DrengenD
  • Dont use rppx,s Money printers they are bug,d so you can duplicate them [highlight](User was banned for this post ("Colossal pointless bump" - mahalis))[/highlight]
  • Avatar of selby3962
  • *cough* post date *cough* [highlight](User was banned for this post ("Bumping to complain about bumping" - mahalis))[/highlight]