I'm making a map for which it will have dark rp on it. How do I make it so this button spawns $50?
Trying not to give to much away, dont want to spoil the map.
I just want on pressed for the button to forcespawn $50 which can be picked up and goes into your dark rp wallet/pocket.
I dont want just the model i want the scripted money from dark rp.
Thanks.
I haven't really mapped for darkRP, but if adding money can be expressed as a console command, you could try the method of a named point_servercommand and an activator (trigger, button, etc.) with the output:
OnTrigger/Pressed/Whatever
[I]name of point_servercommand[/I]
Command
[I]command for adding money[/I]
[QUOTE=robmaister12;19838910]I haven't really mapped for darkRP, but if adding money can be expressed as a console command, you could try the method of a named point_servercommand and an activator (trigger, button, etc.) with the output:
OnTrigger/Pressed/Whatever
[I]name of point_servercommand[/I]
Command
[I]command for adding money[/I][/QUOTE]
Hmm I can't seem to find the command for spawning money. But Im looking for the moneyprinter file since that spawns money and I could maybe copy it.
Edit
In the lua files I found
ply:AddMoney
For adding money.
Is there a way to use that in console or make it into a command?
Just need a server admin only command that spawns 50$ on the ground where on x y z axis.
And Here Is The Money Printer Code.
[code] -- RRPX Money Printer reworked for DarkRP by philxyz
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/props_c17/consolebox01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
self:SetNWBool("money_printer", true)
self.sparking = false
self.damage = 100
self.IsMoneyPrinter = true
local ply = self:GetNWEntity("owning_ent")
if not ply.maxmprinters then
ply.maxmprinters = 0
end
ply.maxmprinters = ply.maxmprinters + 1
timer.Simple(30, self.CreateMoneybag, self)
end
function ENT:OnTakeDamage(dmg)
if self.burningup then return end
self.damage = self.damage - dmg:GetDamage()
if self.damage <= 0 then
local rnd = math.random(1, 10)
if rnd < 3 then
self:BurstIntoFlames()
else
self:Destruct()
self:Remove()
end
end
end
function ENT:Destruct()
local vPoint = self:GetPos()
local effectdata = EffectData()
effectdata:SetStart(vPoint)
effectdata:SetOrigin(vPoint)
effectdata:SetScale(1)
util.Effect("Explosion", effectdata)
Notify(self:GetNWEntity("owning_ent"), 1, 4, "Your money printer has exploded!")
end
function ENT:BurstIntoFlames()
Notify(self:GetNWEntity("owning_ent"), 1, 4, "Your money printer is overheating!")
self.burningup = true
local burntime = math.random(8, 18)
self:Ignite(burntime, 0)
timer.Simple(burntime, self.Fireball, self)
end
function ENT:Fireball()
local dist = math.random(20, 280) -- Explosion radius
self:Destruct()
for k, v in pairs(ents.FindInSphere(self:GetPos(), dist)) do
if not v:IsPlayer() and not v.IsMoneyPrinter then v:Ignite(math.random(5, 22), 0) end
end
self:Remove()
end
local function PrintMore(ent)
if ValidEntity(ent) then
ent.sparking = true
timer.Simple(3, ent.CreateMoneybag, ent)
end
end
function ENT:CreateMoneybag()
if not ValidEntity(self) then return end
if self:IsOnFire() then return end
local MoneyPos = self:GetPos()
if math.random(1, 22) == 3 then self:BurstIntoFlames() end
local moneybag = ents.Create("prop_physics")
moneybag:SetModel("models/props/cs_assault/money.mdl")
moneybag:SetNWString("Owner", "Shared")
moneybag:SetPos(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15))
moneybag.nodupe = true
moneybag:Spawn()
moneybag:GetTable().MoneyBag = true
local amount = GetGlobalInt("mprintamount")
if amount == 0 then
amount = 250
end
moneybag:GetTable().Amount = amount
self.sparking = false
timer.Simple(math.random(100, 350), PrintMore, self)
end
function ENT:Think()
if not self.sparking then return end
local effectdata = EffectData()
effectdata:SetOrigin(self:GetPos())
effectdata:SetMagnitude(1)
effectdata:SetScale(1)
effectdata:SetRadius(2)
util.Effect("Sparks", effectdata)
end
function ENT:OnRemove()
if not ValidEntity(ply) then return end
local ply = self:GetNWEntity("owning_ent")
if not ply.maxmprinters then
ply.maxmprinters = 0
return
end
ply.maxmprinters = ply.maxmprinters - 1
end
[/code]
Add the garrysmod .fgd and use the "lua_run" entity.
emulate a player, make the player have infinite money and make him say "/dropmoney 50" everytime you press a button :P
Also, try magic.
[QUOTE=Cookiemonster93;19839930]emulate a player, make the player have infinite money and make him say "/dropmoney 50" everytime you press a button :P
Also, try magic.[/QUOTE]
That's funny. Your best bet is using a console commands, I'd say.
[QUOTE=~ZOMG;19842100]That's funny. Your best bet is using a console commands, I'd say.[/QUOTE]
Yes thats what I've been looking for, there doesnt seem to be a command for spawning money. Only setting money, and values.
Is it hard to create a server command?
If it isnt could someone tell me how.
Thanks.
[Quote] Add the garrysmod .fgd and use the "lua_run" entity. [/Quote]
Okay i've done that, now I just need the lua command xD.
That's called a printer.
a point_clientcommand is probably your best bet but you'd need to figure out the command to give money.
[QUOTE=Strider_07;19852961]That's called a printer.
a point_clientcommand is probably your best bet but you'd need to figure out the command to give money.[/QUOTE]
Yes i put the printer there because in the printers files it has commands that spawn money and I thought they might help.
There is no current command to give money, do you know how to create commands?
point_clientcommand is disabled in gmod.
Why don't you set it equal to the players money +"X" amount with a console command? You said there's a command for that right?
It sets the players to a certain number. I don't think you can use it to set the players money relative to their current money.
Lua is definitely your best bet. Please tell me if/when you find it out. I'd like to know too.
Im now putting this map onto a new game mode and they are making the command to spawn money.
Hopefully it will work.
[QUOTE=Proost;19907360]Im now putting this map onto a new game mode and they are making the command to spawn money.
Hopefully it will work.[/QUOTE]
Damnit, I wish I'd know how to do it for Dark RP.
[QUOTE=Cookiemonster93;19839930]emulate a player, make the player have infinite money and make him say "/dropmoney 50" everytime you press a button :P
Also, try magic.[/QUOTE]
I thought you were serious for a minute there...
I was like wow this dude is a moron.
By the way, the command is "rp_setmoney player amount"
Sorry, you need to Log In to post a reply to this thread.