[QUOTE=Exho;46383680][url]http://wiki.garrysmod.com/page/NPC/AddEntityRelationship[/url]
I've never used it but I did look into it when I was trying to make a TTT zombie that would only attack innocents, never got it to work...[/QUOTE]
Did you ever post a facepunch thread? We could of helped you
How can I create a set of buttons that I can change the text separately and the functions called when its clicked without having to use vgui.Create for each one?
[QUOTE=_Entity;46390551]How can I create a set of buttons that I can change the text separately and the functions called when its clicked without having to use vgui.Create for each one?[/QUOTE]
Have a table with keys as names and the values as functions then iterate through that table, making a new vgui element setting the name as the key and the .DoClick value as the value.
Alternatively, make a helper function that makes the button with the name and function you give it, using a similar method.
[QUOTE=Sm63;46390209]Did you ever post a facepunch thread? We could of helped you[/QUOTE]
Nah that was before I knew of Facepunch, REALLY bad at lua too then
[QUOTE=Scarface3353;46389211]Well, I'm making a CS-like gamemode on fretta based on a NiandraLades gamemode (thanks), and i want players to be able to press F1 to get weapons and armor. Is there any way to do that?[/QUOTE]
As a heads up, Fretta has the vote for change/team select bound to f1 and then f2 for just team select
You could either use f3/f4, or look into modifying the vgui of the f1 menu to add more buttons, which probably isn't too hard
If I spawn a HL2 weapon when my entity is not spawned, it spawns fine.
However if I spawn my entity, then try and spawn a HL2 weapon I get the following error and my server restarts.
[CODE]
SGN | Semajnad<STEAM_0:1:22686651> spawned sent weapon_vendor
ServerLog: SGN | Semajnad (STEAM_0:1:22686651) Gave himself a weapon_357
Giving SGN | Semajnad a weapon_357
!Get!Get
!Get
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Sun Nov 2 12:51:47 GMT 2014: Server restart in 10 seconds
[/CODE]
I can add my entity code if needed, but thought someone might have seen this error before.
Any way to deactivate a pointshop item on a gamemode? like disabling pointshop playermodels for zombie survival
How do I use this hook?
[url]http://wiki.garrysmod.com/page/GM/SetPlayerSpeed[/url]
Pretty pissed that this isn't working as I want it to.
I'm so fucking confused about Client And Server, and how to communicate between them.
[code]function SWEP:PrimaryAttack()
if self.IsHealing == false then
if self:CheckForLatch() == true then
self.IsHealing = true
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:EmitSound("custom_tf2_medicgunloop")
print("Setting NWBool for CreateBeam...")
self:SetNWBool("CreateBeam",true)
end
else
self.IsHealing = false
self:SendWeaponAnim(ACT_VM_IDLE)
self:StopSound("custom_tf2_medicgunloop")
print("Setting NWBool for DestroyBeam...")
self:SetNWBool("DestroyBeam",true)
end
end
function SWEP:CheckForLatch()
local ent = self.Owner:GetEyeTrace().Entity
if ent:IsPlayer() or ent:IsNPC() then
if ent:GetPos():Distance(self.Owner:GetPos()) < 500 then
return true
else
return false
end
else
return false
end
end
function SWEP:Think()
if self:GetNWBool("CreateBeam",false) == true then
print("SHOULD SAY CLIENT AND SERVER")
end
if self:GetNWBool("CreateBeam",false) == true then
print("NWBool Received for CreateBeam, telling it to self:CreateBeam")
if CLIENT then
print("Running the function self:CreateBeam on Client...")
self:CreateBeam(self.Owner:GetEyeTrace().Entity )
end
self:SetNWBool("CreateBeam",false)
end
if self:GetNWBool("DestroyBeam",false) == true then
print("NWBool Received for DestroyBeam, telling it to self:DestroyBeam")
if CLIENT then
print("Running the function self:DestroyBeam on Client...")
self:DestroyBeam()
end
self:SetNWBool("DestroyBeam",false)
end
end
function SWEP:CreateBeam(target)
if CLIENT then
print("Creating Particle System of a beam. Everything went right.")
PrecacheParticleSystem("medicgun_beam_red")
local CPoint0 = {
["entity"] = self.Owner,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
local CPoint1 = {
["entity"] = target,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
--Create the particle effect!
LocalPlayer():CreateParticleEffect("medicgun_beam_red",{CPoint0,CPoint1})
end
end
function SWEP:DestroyBeam()
if CLIENT then
print("Removing Particle System of a beam. Everything went right.")
LocalPlayer():StopParticleEmission("medicgun_beam_red")
end
end[/code]
Like this is rightfully pissing me off. Like all the print debug messages are all blue (server) and the only time it registers as yellow is when I spam mouse1
I just want to create a basic healing weapon for fuck sakes
[editline]2nd November 2014[/editline]
Also can someone give me some proper documentation on CreateParticleEffect because there is literally none
I prefer always coding in a dedicated server, sometimes I get bugs randomly on a listen server.
Have you tried it on a dedicated server?
A video would be really helpful too.
[QUOTE=AnonTakesOver;46395518]I prefer always coding in a dedicated server, sometimes I get bugs randomly on a listen server.
Have you tried it on a dedicated server?
A video would be really helpful too.[/QUOTE]
Yeah I was coding it in singleplayer, and it works fine. But I want it to work in singleplayer.
I just have a problem with the particle attach part because It's not doing what I want it to do.
I want the particle to attach to the muzzle of my gun (both viewmodel and worldmodel) and also attach to the center of the entity I want to heal. What I am getting is the beam coming from my torso and going to the feet of the target.
This is what I have so far
I've tried position and startpos but none of those work. Some proper documentation would be stellar but gmod seems to be dying and no one cares anymore.
[code] if CLIENT then
print("Creating Particle System of a beam. Everything went right.")
PrecacheParticleSystem("medicgun_beam_red")
local CPoint0 = {
["entity"] = self.Weapon,
--["position"] = self.Owner:GetViewModel():GetAttachment(1),
--["position"] = self.Owner:EyePos(),
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
local CPoint1 = {
["entity"] = target,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
LocalPlayer():CreateParticleEffect("medicgun_beam_red",{CPoint0,CPoint1})
end[/code]
literally no documentation on control points that I can find. I found this code from a russian website that precaches gmod wiki pages.
If you are having trouble getting it to come out of the front of the gun like tf2 medic heal, try using the view model hook that is called on client to draw the view model. You can get the position from their probably and use a bool to check if it should be drawing
I don't know sweps though, so I won't be as much help, you can check old gmod addons, I think their was a tf2 gamemode
[QUOTE=AnonTakesOver;46395581]If you are having trouble getting it to come out of the front of the gun like tf2 medic heal, try using the view model hook that is called on client to draw the view model. You can get the position from their probably and use a book to check if it should be drawing
I don't know sweps though, so I won't be as much help, you can check old gmod addons, I think their was a tf2 gamemode[/QUOTE]
ParticleEffectAttach can't take vectors, as far as I know.
It only can take entities. If it could take vectors I would easily get the muzzle pos of the viewmodel and worldmodel.
[QUOTE=ROFLBURGER;46395641]ParticleEffectAttach can't take vectors, as far as I know.
It only can take entities. If it could take vectors I would easily get the muzzle pos of the viewmodel and worldmodel.[/QUOTE]
Make a fake entity and set the pos?
Im looking at this tf2 gamemode you mentioned and they used info_targets. I was planning to do that if there was no such function that would help me.
When I use an entity, a GUI should come up, but doesn't, yet ones for my SWEPs do just fine. Any ideas?
Code:
[lua]
AddCSLuaFile()
--util.AddNetworkString("fbox_buy_item")
local FBoxTestItems = {}
FBoxTestItems.Melon = {
name = "Melon",
desc = "Your standard food item.",
price = 50,
model = "models/props_junk/watermelon01.mdl",
class = "item_fbox_melon"
}
FBoxTestItems.Award = {
name = "Award",
desc = "Limited time award, for free.",
price = 0,
model = "models/weapons/c_models/c_saxxy/c_saxxy.mdl",
class = "item_fbox_award"
}
ENT.Type = "anim"
ENT.Base = "base_ai"
ENT.PrintName = "NPC Shop"
ENT.Category = "FlexBox"
ENT.Spawnable = true --for testing
ENT.AdminOnly = true
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * size
local ent = ents.Create(ClassName)
ent:SetPos(SpawnPos)
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel("models/player/group01/male_0"..math.random(1,9)..".mdl")
self:SetSolid(2)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSequence("idle_all_01")
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Draw()
self:DrawModel()
end
function ShopGUI()
if SERVER then return end
if CLIENT then
shopframe = shopframe or NULL
if IsValid(shopframe) then return end
shopframe = vgui.Create("DFrame")
shopframe:SetSize(550,600)
shopframe:Center()
shopframe:SetTitle("")
shopframe:SetDraggable(false)
shopframe:MakePopup()
shopframe.btnMaxim:SetVisible(false)
shopframe.btnMinim:SetVisible(false)
function shopframe.btnClose.Paint()
draw.RoundedBox(0,0,0,32,8,Color(180,0,0))
draw.RoundedBox(0,0,8,32,8,Color(160,0,0))
draw.DrawText("r","marlett",8,0,color_white)
end
function shopframe.Paint()
draw.RoundedBox(4,0,0,shopframe:GetWide(),shopframe:GetTall(),color_black)
end
local title = vgui.Create("DLabel",shopframe)
title:SetPos(20,2)
title:SetText("Shop")
title:SetColor(color_white)
title:SizeToContents()
local icon = vgui.Create("DImage",shopframe)
icon:SetPos(2,2)
icon:SetImage("icon16/cart.png")
icon:SizeToContents()
local tabs = vgui.Create("DPropertySheet",shopframe)
tabs:SetPos(2,28)
tabs:SetSize(shopframe:GetWide()-4,shopframe:GetTall()-30)
local buytab = vgui.Create("DScrollPanel",tabs)
buytab:SetBackgroundColor(color_transparent)
buytab:SetPos(0,0)
buytab:SetSize(tabs:GetWide(),tabs:GetTall())
local selltab = vgui.Create("DScrollPanel",tabs)
selltab:SetBackgroundColor(color_transparent)
selltab:SetPos(0,0)
selltab:SetSize(tabs:GetWide(),tabs:GetTall())
for num,item in pairs(FBoxTestItems) do
local itemtab = vgui.Create("DPanel",buytab)
itemtab:SetSize(150,buytab:GetWide()-10)
itemtab:SetPos(5,5+( num*itemtab:GetTall() )-itemtab:GetTall())
function itemtab.Paint()
draw.RoundedBoxEx(4,0,0,itemtab:GetWide(),itemtab:GetTall()/2,Color(237,237,237),true,true,false,false)
draw.RoundedBoxEx(4,0,itemtab:GetTall()/2,itemtab:GetWide(),itemtab:GetTall()/2,Color(217,217,217),false,false,true,true)
end
local itemname = vgui.Create("DLabel",itemtab)
itenname:SetPos(150,5)
itemname:SetFont("DermaLarge")
itemname:SetText(item.name)
itemname:SizeToContents()
local itemicon = vgui.Create("DModelPanel",itemtab)
itemicon:SetPos(5,5)
itemicon:SetSize(95,95)
itemicon:SetModel(item.model)
local itembuy = vgui.Create("DButton",itemtab)
itembuy:SetPos(itemtab:GetWide()-64-5,itemtab:GetTall()-32-5)
itembuy:SetSize(64,32)
itembuy:SetText("Buy")
function itembuy.DoClick()
net.Start("fbox_buy_item")
net.WriteEntity(LocalPlayer())
net.WriteString(item.class)
net.SendToServer()
end
end
tabs:AddSheet("Buy",buytab,"icon16/cart_add.png",false,false,"Buy Items")
tabs:AddSheet("Sell",selltab,"icon16/cart_delete.png",false,false,"Sell Items")
function tabs.Paint()
draw.RoundedBox(4,0,22,tabs:GetWide(),tabs:GetTall()-22,color_white)
end
end
end
function ENT:Use(ply)
self:SetUseType(SIMPLE_USE)
self:EmitSound("vo/npc/male01/hi02.wav")
ShopGUI()
print("Opened ShopGUI")
end
[/lua]
IIRC the base_ai type does not use ENT:Use()
I don't know what else it uses but a quick google search on your end would show you.
Also, you are doing set use type completely wrong, it should be called before ENT:Use() is called, not after.
Im not good with vector math. I really need help with this bullet penetration weapon but as you can probably tell by the formula, there's issues with it.
[lua]function SWEP:LaunchBullet(Num,Src,Dir,Spread,Force,Damage)
local bullet = {}
bullet.Num = Num
bullet.Src = Src
bullet.Dir = Dir
bullet.Spread = Spread
bullet.Tracer = 0
bullet.TracerName = "Tracer"
bullet.Force = Force
bullet.Damage = Damage
bullet.Callback = function( attacker, tr, dmginfo)
if GetConVar("sv_css_enable_penetration"):GetInt() == 1 then
if Damage > 2 and tr.HitSky == false then
self:LaunchBullet(1,tr.HitPos - tr.HitNormal*20, Dir, Vector(0,0,0), Force * GetConVar("sv_css_penetration_scale"):GetInt() , Damage * GetConVar("sv_css_penetration_scale"):GetInt())
end
end
end
self.Owner:FireBullets(bullet)
end[/lua]
because i'm doing it like this, I get this effect
[img]http://i.imgur.com/rja5tUf.png[/img]
It adds the hitnormal so it basically distorts the bullet, which I don't want. I want it to penetrate but I don't know how.
[QUOTE=Ott;46394066]How do I use this hook?
[url]http://wiki.garrysmod.com/page/GM/SetPlayerSpeed[/url][/QUOTE]
[url=https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/player_shd.lua#L17]By taking a peek inside the base gamemode[/url].
[QUOTE=Ott;46394066]How do I use this hook?
[url]http://wiki.garrysmod.com/page/GM/SetPlayerSpeed[/url][/QUOTE]
(I know I mentioned this to you in gmod coders chat, but to clarify)
SetPlayerSpeed isn't ever called by default code, it's just a helper function you're able to call either through the hook library or through the gamemode table.
[code]
-- From a gamemode's method
function GM:MyGamemodeMethod( ply )
self:SetPlayerSpeed( ply, desired_walk_speed, desired_run_speed )
end
-- From any other code (optionally call it straight from the GAMEMODE global table)
hook.Run( "SetPlayerSpeed", ply, desired_walk_speed, desired_run_speed )
[/code]
I wouldn't recommend using it at all as it's much more straightforward and common to use [url=http://wiki.garrysmod.com/page/Player/SetWalkSpeed]ply:SetWalkSpeed()[/url] and [url=http://wiki.garrysmod.com/page/Player/SetRunSpeed]ply:SetRunSpeed()[/url]
[QUOTE=ROFLBURGER;46397443]Im not good with vector math. I really need help with this bullet penetration weapon but as you can probably tell by the formula, there's issues with it.
[lua]-code-[/lua]
because i'm doing it like this, I get this effect
[img]http://i.imgur.com/rja5tUf.png[/img]
It adds the hitnormal so it basically distorts the bullet, which I don't want. I want it to penetrate but I don't know how.[/QUOTE]
[lua]function SWEP:LaunchBullet(Num,Src,Dir,Spread,Force,Damage)
local bullet = {}
bullet.Num = Num
bullet.Src = Src
bullet.Dir = Dir
bullet.Spread = Spread
bullet.Tracer = 0
bullet.TracerName = "Tracer"
bullet.Force = Force
bullet.Damage = Damage
bullet.Callback = function( attacker, tr, dmginfo)
if GetConVar("sv_css_enable_penetration"):GetInt() == 1 then
if Damage > 2 and tr.HitSky == false then
self:LaunchBullet(1,tr.HitPos - Dir*20, Dir, Vector(0,0,0), Force * GetConVar("sv_css_penetration_scale"):GetInt() , Damage * GetConVar("sv_css_penetration_scale"):GetInt())
end
end
end
self.Owner:FireBullets(bullet)
end[/lua]
tr.HitNormal returns the way the wall is facing, Dir is the way the bullet is going
Posting this again too try and get support:
I'm getting the following error when spawning a weapon while my entity is placed in the world:
[CODE]
SGN | Semajnad<STEAM_0:1:22686651> spawned sent weapon_vendor
ServerLog: SGN | Semajnad (STEAM_0:1:22686651) Gave himself a weapon_357
Giving SGN | Semajnad a weapon_357
!Get!Get
!Get
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
dlopen failed trying to load:
/opt/server-files/source/linux32/libsteam.so
with error:
/opt/server-files/source/linux32/libsteam.so: cannot open shared object file: No such file or directory
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Sun Nov 2 12:51:47 GMT 2014: Server restart in 10 seconds
[/CODE]
[B]Edit: This also happens if I spawn any other entity such as weapon attachments for FAS2.0 sweps. It just crashes with the error above.[/B]
I started scripting again just recently and I'm working on a simple round system that starts the round after more than one player has joined and then a 15 seconds waiting period. The only issue I am having is that the round never gets changed to ROUND_FIGHT... I don't think the timer is working properly for some reason... Any help?
[code]
hook.Add("Think", "CheckRoundStart", function()
net.Start("RoundState")
net.WriteString(GAMEMODE.Round.ToString(GAMEMODE.Round:GetStatus()))
net.Broadcast()
if (GAMEMODE.Round:GetStatus() != ROUND_WAIT) then return end
if (#player.GetAll() > 1) then
timer.Create( "PrepareTimer", 15, 0, function()
GAMEMODE.Round:SetStatus(ROUND_FIGHT)
timer.Destroy( "PrepareTimer" )
end)
end
end)
[/code]
-snip figured it out-
PS: In order to use render.SetScissorRect, you gotta set it BEFORE you draw your normal rectangle and set enabled to TRUE, then copy that render code and paste it afterwards with the bool set to FALSE. That does it
Don't do this:
[code]
net.Start("RoundState")
net.WriteString(GAMEMODE.Round.ToString(GAMEMODE.Round:GetStatus()))
net.Broadcast()[/code]
Send the information only when it changes or the player spawns. You are just wasting resources.
As for your problem, you are recreating the timer 66 times per second, so it never executes. Add a timer.Exists() check. If the timer exists, don't make a new one. If the player count is less than 1, you should destroy the timer.
My entity/NPC still isn't working, I changed over the base class and moved the use type code, but the GUI isn't working and I'm getting this error
[lua]
[ERROR] <0:0:58178275|Flex><flex_npc_shop.lua>:51: attempt to call method 'SetUseType' (a nil value)
1. unknown - <0:0:58178275|Flex><flex_npc_shop.lua>:51
[/lua]
[lua]
AddCSLuaFile()
--util.AddNetworkString("fbox_buy_item")
local FBoxTestItems = {}
FBoxTestItems.Melon = {
name = "Melon",
desc = "Your standard food item.",
price = 50,
model = "models/props_junk/watermelon01.mdl",
class = "item_fbox_melon"
}
FBoxTestItems.Award = {
name = "Award",
desc = "Limited time award, for free.",
price = 0,
model = "models/weapons/c_models/c_saxxy/c_saxxy.mdl",
class = "item_fbox_award"
}
ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.PrintName = "NPC Shop"
ENT.Category = "FlexBox"
ENT.Spawnable = true --for testing
ENT.AdminOnly = true
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * size
local ent = ents.Create(ClassName)
ent:SetPos(SpawnPos)
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel("models/player/group01/male_0"..math.random(1,9)..".mdl")
self:SetSolid(2)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSequence("idle_all_01")
self:SetUseType(SIMPLE_USE) --Weirdly erroring line
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Draw()
self:DrawModel()
end
function ShopGUI()
if SERVER then return end
if CLIENT then
shopframe = shopframe or NULL
if IsValid(shopframe) then return end
shopframe = vgui.Create("DFrame")
shopframe:SetSize(550,600)
shopframe:Center()
shopframe:SetTitle("")
shopframe:SetDraggable(false)
shopframe:MakePopup()
shopframe.btnMaxim:SetVisible(false)
shopframe.btnMinim:SetVisible(false)
function shopframe.btnClose.Paint()
draw.RoundedBox(0,0,0,32,8,Color(180,0,0))
draw.RoundedBox(0,0,8,32,8,Color(160,0,0))
draw.DrawText("r","marlett",8,0,color_white)
end
function shopframe.Paint()
draw.RoundedBox(4,0,0,shopframe:GetWide(),shopframe:GetTall(),color_black)
end
local title = vgui.Create("DLabel",shopframe)
title:SetPos(20,2)
title:SetText("Shop")
title:SetColor(color_white)
title:SizeToContents()
local icon = vgui.Create("DImage",shopframe)
icon:SetPos(2,2)
icon:SetImage("icon16/cart.png")
icon:SizeToContents()
local tabs = vgui.Create("DPropertySheet",shopframe)
tabs:SetPos(2,28)
tabs:SetSize(shopframe:GetWide()-4,shopframe:GetTall()-30)
local buytab = vgui.Create("DScrollPanel",tabs)
buytab:SetBackgroundColor(color_transparent)
buytab:SetPos(0,0)
buytab:SetSize(tabs:GetWide(),tabs:GetTall())
local selltab = vgui.Create("DScrollPanel",tabs)
selltab:SetBackgroundColor(color_transparent)
selltab:SetPos(0,0)
selltab:SetSize(tabs:GetWide(),tabs:GetTall())
for num,item in pairs(FBoxTestItems) do
local itemtab = vgui.Create("DPanel",buytab)
itemtab:SetSize(150,buytab:GetWide()-10)
itemtab:SetPos(5,5+( num*itemtab:GetTall() )-itemtab:GetTall())
function itemtab.Paint()
draw.RoundedBoxEx(4,0,0,itemtab:GetWide(),itemtab:GetTall()/2,Color(237,237,237),true,true,false,false)
draw.RoundedBoxEx(4,0,itemtab:GetTall()/2,itemtab:GetWide(),itemtab:GetTall()/2,Color(217,217,217),false,false,true,true)
end
local itemname = vgui.Create("DLabel",itemtab)
itenname:SetPos(150,5)
itemname:SetFont("DermaLarge")
itemname:SetText(item.name)
itemname:SizeToContents()
local itemicon = vgui.Create("DModelPanel",itemtab)
itemicon:SetPos(5,5)
itemicon:SetSize(95,95)
itemicon:SetModel(item.model)
local itembuy = vgui.Create("DButton",itemtab)
itembuy:SetPos(itemtab:GetWide()-64-5,itemtab:GetTall()-32-5)
itembuy:SetSize(64,32)
itembuy:SetText("Buy")
function itembuy.DoClick()
net.Start("fbox_buy_item")
net.WriteEntity(LocalPlayer())
net.WriteString(item.class)
net.SendToServer()
end
end
tabs:AddSheet("Buy",buytab,"icon16/cart_add.png",false,false,"Buy Items")
tabs:AddSheet("Sell",selltab,"icon16/cart_delete.png",false,false,"Sell Items")
function tabs.Paint()
draw.RoundedBox(4,0,22,tabs:GetWide(),tabs:GetTall()-22,color_white)
end
end
end
function ENT:Use(ply)
self:EmitSound("vo/npc/male01/hi02.wav")
ShopGUI()
end
[/lua]
Add a print in the use function, check the print and make sure the client is calling it, I'm pretty sure you need to do
ply:SendLua("ShopGUI")
I think the use is server side only
Any way to grab a [URL="http://wiki.garrysmod.com/page/Enums/MAT"]Material type[/URL] without using trace result?
[QUOTE=ROFLBURGER;46402306]Any way to grab a [URL="http://wiki.garrysmod.com/page/Enums/MAT"]Material type[/URL] without using trace result?[/QUOTE]
Guess depending on the material :v:
[QUOTE=LUModder;46402391]Guess depending on the material :v:[/QUOTE]
Can't guess. For what I'm making, something depends on the material type.
Sorry, you need to Log In to post a reply to this thread.