So my shop NPC is basically done, all I have to do is make the buying part work, check jobs, and spawn the ships if they are a certain job, but anyway, my main issue is that when someone opens the menu, all my derma images are missing textures, so it looks really bad, I'm not sure how to put my custom images in the server content to make it show for other people. Here are the files:
init.lua
[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/tfa/comm/gg/npc_cit_sw_droid_tactical.mdl")
self:SetHullType( HULL_HUMAN );
self:SetHullSizeNormal();
self:SetSolid( SOLID_BBOX )
self:SetMoveType( MOVETYPE_STEP )
self:CapabilitiesAdd(CAP_TURN_HEAD + CAP_ANIMATEDFACE)
self:SetHullType(HULL_HUMAN)
self:SetHullSizeNormal()
self:SetUseType( SIMPLE_USE )
self:SetMaxYawSpeed( 5000 )
self:SetSequence(ACT_IDLE)
end
util.AddNetworkString("OpenMenu")
util.AddNetworkString("BuyDelta")
util.AddNetworkString("BuyVWing")
util.AddNetworkString("BuyYWing")
function ENT:AcceptInput(input, activator, caller)
if input == "Use" || IsValid(caller:IsPlayer()) then
net.Start("OpenMenu")
net.Send(caller)
end
end
function ENT:OnTakeDamage()
if CurTime() > self.PainSoundT then
self:EmitSound("vo/npc/male01/pain0"..math.random(1,9)..".wav")
self.PainSoundT = CurTime() + 1
end
end
net.Receive("BuyDelta", function(len, ply)
entity = ents.Create("delta7")
entity:SetAngles(Angle(0, 180, 0))
entity:SetPos(ply:EyePos() + ply:GetAngles():Right() * 350 + Vector(-30, 0, 10))
entity:Spawn()
timer.Simple( .25, function()
PrintMessage(HUD_PRINTTALK, "Your ship has been delivered.")
end)
end)
net.Receive("BuyVWing", function(len, ply)
entity = ents.Create("v-wing")
entity:SetAngles(Angle(0, 180, 0))
entity:SetPos(ply:EyePos() + ply:GetAngles():Right() * 350 + Vector(-30, 0, 10))
entity:Spawn()
timer.Simple( .25, function()
PrintMessage(HUD_PRINTTALK, "Your ship has been delivered.")
end)
end)
net.Receive("BuyYWing", function(len, ply)
entity = ents.Create("y-wing")
entity:SetAngles(Angle(0, 180, 0))
entity:SetPos(ply:EyePos() + ply:GetAngles():Right() * 350 + Vector(-30, 0, 10))
entity:Spawn()
timer.Simple( .25, function()
PrintMessage(HUD_PRINTTALK, "Your ship has been delivered.")
end)
end)[/CODE]
cl_init.lua
[CODE]include("shared.lua")
ENT.RenderGroup = RENDERGROUP_BOTH
surface.CreateFont( "Shop Title", {
font = "coolvetica",
size = 55,
weight = 1000,
antialias = true,
} )
surface.CreateFont( "DLabel", {
font = "coolvetica",
size = 30,
weight = 1000,
antialias = true,
} )
surface.CreateFont( "DButton", {
font = "coolvetica",
size = 25,
weight = 1000,
antialias = true,
} )
surface.CreateFont( "Price", {
font = "coolvetica",
size = 25,
weight = 1000,
antialias = true,
} )
net.Receive("OpenMenu", function()
local frame = vgui.Create("DFrame")
frame:SetSize(1035 ,800)
frame:Center()
frame:MakePopup()
frame:SetScreenLock(true)
frame:ShowCloseButton(false)
frame:SetTitle("")
function frame:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w+10, h+10, Color( 0, 0, 0 ) )
draw.RoundedBox(5,5,5,w-10,h-10,Color(111,111,111))
end
local YWing = vgui.Create( "DImage", frame )
YWing:SetPos( 5, 5 )
YWing:SetSize( 1025, 790 )
YWing:SetImage("M:/SteamLibrary/steamapps/common/GarrysMod/garrysmod/materials/spawnicons/models/StarWarsShips/Hangar.png")
local Shape = vgui.Create( "DShape", frame )
Shape:SetType( "Rect" ) -- This is the only type it can be
Shape:SetPos( 10, 20 )
Shape:SetColor( Color( 66, 66, 66 ) )
Shape:SetSize( 1015, 70 )
function Shape:Paint( w, h )
draw.RoundedBox( 80, 2, 2, w, h, Color( 0, 0, 0, 255 ) )
draw.RoundedBox(6,6,6,w-10,h-10,Color(66,66,66, 75))
end
local text = vgui.Create("DLabel", frame)
text:SetText("Hey there, so you wanna try your hand at piloting? Go ahead.")
text:SetPos(175, 25)
text:SetFont("DLabel")
text:SetColor(Color(255, 144, 0))
text:SetSize(1000, 30)
local text2 = vgui.Create("DLabel", frame)
text2:SetText("Here is a list of ships you can buy.")
text2:SetPos(325, 55)
text2:SetFont("DLabel")
text2:SetColor(Color(255, 144, 0))
text2:SetSize(1000, 30)
local rgb = Color
local DScrollPanel = vgui.Create( "DScrollPanel", frame )
DScrollPanel:SetSize( 565, 300 )
DScrollPanel:SetPos( 5, 500 )
DScrollPanel:Dock( FILL )
DScrollPanel:Center()
local sbar = DScrollPanel:GetVBar()
function sbar:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, rgb(52, 73, 94,100) )
end
function sbar.btnUp:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, rgb(192, 57, 43) )
end
function sbar.btnDown:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, rgb(192, 57, 43) )
end
function sbar.btnGrip:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, rgb(44, 62, 80) )
end
local Shape2 = vgui.Create( "DShape", frame )
Shape2:SetType( "Rect" ) -- This is the only type it can be
Shape2:SetPos( 10, 100 )
Shape2:SetColor( Color( 66, 66, 66 ))
Shape2:SetSize( 250, 550 )
function Shape2:Paint( w, h )
draw.RoundedBox( 4, 2, 2, w, h, Color( 0, 0, 0, 150 ) )
draw.RoundedBox(6,6,6,w-10,h-10,Color(66,66,66, 150))
end
local button = vgui.Create("DButton", frame)
button:SetSize(350,125)
button:SetPos(355, 660)
button:SetTextColor(Color(255,144,0))
button:SetText("Don't wanna buy a ship?")
button:SetFont("DButton")
button.DoClick = function()
frame:Close()
end
function button:Paint( w, h )
draw.RoundedBox( 4, 2, 2, w, h, Color( 0, 0, 0, 150 ) )
draw.RoundedBox( 40, 2, 2, w, h, Color( 0, 0, 0, 150 ) )
draw.RoundedBox(6,6,6,w-10,h-10,Color(66,66,66, 150))
end
local Shape3 = vgui.Create( "DShape", frame )
Shape3:SetType( "Rect" ) -- This is the only type it can be
Shape3:SetPos( 275, 100 )
Shape3:SetColor( Color( 66, 66, 66 ))
Shape3:SetSize( 750, 550 )
function Shape3:Paint( w, h )
draw.RoundedBox( 4, 2, 2, w, h, Color( 0, 0, 0, 150 ) )
draw.RoundedBox( 40, 2, 2, w, h, Color( 0, 0, 0, 150 ) )
draw.RoundedBox(6,6,6,w-10,h-10,Color(66,66,66, 150))
end
local button = vgui.Create("DButton", frame)
button:SetSize(200,150)
button:SetPos(35, 125)
button:SetText("Buy a Delta")
button:SetFont("DButton")
button:SetColor(Color(255,144,0))
button.DoClick = function()
net.Start("BuyDelta")
net.SendToServer()
frame:Close()
end
function button:Paint( w, h )
draw.RoundedBox( 4, 2, 2, w, h, Color( 0, 0, 0) )
draw.RoundedBox( 40, 2, 2, w, h, Color( 0, 0, 0) )
draw.RoundedBox(6,6,6,w-10,h-10,Color(66,66,66))
end
local text2 = vgui.Create(
Sorry, you need to Log In to post a reply to this thread.