Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Suggestion For A New Crate Based Item


Recommended Posts

example lua:

entities > customzs_collecter (originally a darkrp basic printer)

 

include("shared.lua")

 

surface.CreateFont( "MoneyFont",

{

font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name

size = 30,

weight = 500,

blursize = 0,

scanlines = 0,

antialias = true,

underline = false,

italic = false,

strikeout = false,

symbol = false,

rotary = false,

shadow = false,

additive = false,

outline = false,

} )

 

surface.CreateFont( "MoneyFontCAM",

{

font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name

size = 75,

weight = 500,

blursize = 0,

scanlines = 0,

antialias = true,

underline = false,

italic = false,

strikeout = false,

symbol = false,

rotary = false,

shadow = false,

additive = false,

outline = false,

} )

 

 

function ENT:Draw()

 

self:DrawModel()

 

local ang = self:GetAngles()

 

ang:RotateAroundAxis(self:GetAngles():Right(), 90)

cam.Start3D2D(self:GetPos(),self:GetAngles(),0.1)

 

 

draw.RoundedBox(0,0,0,200,200,Color(120,255,120,255))

draw.RoundedBox(0,0,0,200-75,200-175,Color(255,255,255,255))

 

draw.SimpleText("GetMoneyAmount","MoneyFontCAM",50,50,Color(120,120,255),1, 1)

 

 

cam.End3D2D()

 

end

 

hook.Add( "HUDPaint" , "DrawMoney" , function()

 

local eye = LocalPlayer() :GetEyeTrace()

 

if eye.Entity:GetClass() == "cam3d" then

 

draw.SimpleText(eye.Entity:GetMoneyAmount(), "MoneyFont",ScrW()/2, ScrH()/2 , Color(255,0,0) , 1 , 1)

end

 

end)

Link to comment
Share on other sites

Lua cont. example:

still lua for dark rp printer

 

AddCSLuaFile("cl_init.lua")

AddCSLuaFile("shared.lua")

 

include("shared.lua")

 

 

local interval = 1.5

 

function ENT:Initialize()

 

self:SetModel("models/props_c17/consolebox03a.mdl")

self:PhysicsInit(SOLID_VPHYSICS)

self:SetMoveType(MOVETYPE_VPHYSICS)

self:SetSolid(SOLID_VPHYSICS)

 

self.timer = CurTime()

 

 

 

local phys = self:GetPhysicsObject()

 

if phys:IsValid() then

 

phys:Wake()

 

end

 

 

end

 

function ENT:Think()

 

 

if CurTime() > self.timer + interval then

 

self.timer = CurTime()

 

self:SetMoneyAmount(self:GetMoneyAmount() + 100 )

 

 

end

 

 

 

end

 

 

function ENT:Use(a , c)

 

local money = self:GetMoneyAmount()

self:SetMoneyAmount(0)

c:addMoney(money)

 

end

Link to comment
Share on other sites

shared file for printer

 

ENT.Type = "anim"

ENT.Base = "base_gmodentity"

 

ENT.PrintName = "Custom Money Printer"

 

ENT.Spawnable = true

 

function ENT:SetupDataTables()

 

self:NetworkVar("Int", 1 ,"MoneyAmount")

 

end

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share