1. Post #1
    thoron174's Avatar
    June 2008
    59 Posts
    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 ?
    Reply With Quote Edit / Delete Reply France Show Events Dumb Dumb x 2 (list)

  2. Post #2
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    Look inside RRPX :-)

  3. Post #3
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    Look inside RRPX :-)

    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 http://forums.facepunchstudios.com/s...d.php?t=505658

    Edit:

    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

    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 );
    

    3 -I added this console commands in to rprofl.lua
    
    SetGlobalInt("mprintamount", 250)
    SetGlobalInt("mprintercost", 1000)
    
    
    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
    			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
    

    Edit:

    can someone please help me

    Edit:

    any body please help me

    Edit:

    philxyz posted:
    Look inside RRPX :-)
    here look this is what I did.Can you please look and tell me what I have to add or modify.

  4. Post #4
    otoris's Avatar
    March 2007
    138 Posts
    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.

  5. Post #5
    thoron174's Avatar
    June 2008
    59 Posts
    otoris posted:
    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.
    this is darkrp version 2.2.12 I think its the last one.I think

  6. Post #6
    FLUTTERSHY <3 (also hats suck)
    Unib5's Avatar
    May 2008
    1,700 Posts
    thoron174 posted:
    this is darkrp version 1.1.12 I think its the last one.I think
    Don't you mean 2.2.12?

  7. Post #7
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    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)

  8. Post #8
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    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)
    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
    -- ============================================
    -- =                                          =
    -- =          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
    

  9. Post #9
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    I'll release this tomorrow as a patch for DarkRP 2.2.12 for those that want it.

  10. Post #10
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    I'll release this tomorrow as a patch for DarkRP 2.2.12 for those that want it.
    ok thanks man

  11. Post #11
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    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.

    http://garrysmod.org/downloads/?a=view&id=54057

    EDIT: Re-download it if you have a lua error; I made a typo in hints.lua

  12. Post #12
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    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.

    http://garrysmod.org/downloads/?a=view&id=54027

    EDIT: Re-download it if you have a lua error; I made a typo in hints.lua
    ok and thanks so much =D

  13. Post #13
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    No problema.

    Edit:

    Update: Fixed version:


    http://garrysmod.org/downloads/?a=view&id=54057

  14. Post #14
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    No problema.

    Edit:

    Update: Fixed version:


    http://garrysmod.org/downloads/?a=view&id=54057
    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

  15. Post #15
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    thoron174 posted:
    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
    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)

  16. Post #16
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    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)
    thanks now that works.



    how do you add a message for the entity in f2 like you put for the money printer.

  17. Post #17
    Gold Member
    Diaklu's Avatar
    August 2007
    1,236 Posts
    If only DarkRP was like this.

    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);

    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);

    Of course this would be a better approach instead of the hard coded shit. I love OOP, by the way. :)

  18. Post #18
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    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.

  19. Post #19
    Gold Member
    Diaklu's Avatar
    August 2007
    1,236 Posts
    I guess so, I'll wait for SeriousRP.

  20. Post #20
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    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: http://garrysmod.org/downloads/?a=view&id=54506

  21. Post #21
    thoron174's Avatar
    June 2008
    59 Posts
    philxyz posted:
    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: http://garrysmod.org/downloads/?a=view&id=54506
    I have one question how do you add something to the f2 menu ?

  22. Post #22
    Gold Member
    philxyz's Avatar
    September 2007
    716 Posts
    Take a look in cl_init.lua

    There's not much space though

  23. Post #23
    DrengenD's Avatar
    September 2009
    4 Posts
    Dont use rppx,s Money printers they are bug,d so you can duplicate them

    (User was banned for this post ("Colossal pointless bump" - mahalis))
    Reply With Quote Edit / Delete Reply Denmark Show Events Funny Funny x 1Late Late x 1 (list)

  24. Post #24
    Gold Member
    selby3962's Avatar
    February 2009
    2,189 Posts
    *cough* post date *cough*

    (User was banned for this post ("Bumping to complain about bumping" - mahalis))
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Funny Funny x 3 (list)