[QUOTE=prang123;38942296]How would I use that to stop the models from "overflowing"?
Any chance of an example so I can understand, I really don't follow.[/QUOTE]
[url]https://github.com/adamdburton/pointshop/blob/master/lua/vgui/DPointShopItem.lua#L98[/url]
I made a shared table called EV = {} where I put all clientside and serverside functions aswell as information about some stuff releated to mod, but when I try to call serverside function from EV called EV.ActivateEvents using concommand I receive info that
[code]
[ERROR] gamemodes/darkrp/gamemode/server/sv_events.lua:30: attempt to call field 'ActivateEvents' (a nil value)
1. unknown - gamemodes/darkrp/gamemode/server/sv_events.lua:30
2. unknown - lua/includes/modules/concommand.lua:69
[/code]
but when I try to run it inside the file, it runs smoothly with no problem.
Is it because concommand is in shared realm ? What else can I use ?
[QUOTE=Netheous;38943059]I made a shared table called EV = {} where I put all clientside and serverside functions aswell as information about some stuff releated to mod, but when I try to call serverside function from EV called EV.ActivateEvent using concommand I receive info that
[code]
[ERROR] gamemodes/darkrp/gamemode/server/sv_events.lua:30: attempt to call field 'ActivateEvents' (a nil value)
1. unknown - gamemodes/darkrp/gamemode/server/sv_events.lua:30
2. unknown - lua/includes/modules/concommand.lua:69
[/code]
but when I try to run it inside the file, it runs smoothly with no problem.
Is it because concommand is in shared realm ? What else can I use ?[/QUOTE]
You've said ActivateEvent and ActivateEvents, which is it supposed to be?
[QUOTE=_Undefined;38943190]You've said ActivateEvent and ActivateEvents, which is it supposed to be?[/QUOTE]
Sorry, ActivateEvent and Events is the same function, I just mistyped it, it's "ActivateEvents"
I have a file in gamemodedirectory/contents/materials/file.jpg
is the resource.AddFile process still resource.AddFile("materials/file.jpg") or do I have to go from the root garry's mod directory?
I need help with "surface.CreateFont"
I have these 2 lines that need to be fixed but i don't know how, can anyone [U][B]explain[/B][/U] to me please?
Code:
[CODE]surface.CreateFont( "coolvetica", 19, 500, true, false, "ScoreboardPlayerName" )
surface.CreateFont( "coolvetica", 22, 500, true, false, "ScoreboardPlayerNameBig" )[/CODE]
[QUOTE=andre_bule;38944549]I need help with "surface.CreateFont"
I have these 2 lines that need to be fixed but i don't know how, can anyone [U][B]explain[/B][/U] to me please?
Code:
[CODE]surface.CreateFont( "coolvetica", 19, 500, true, false, "ScoreboardPlayerName" )
surface.CreateFont( "coolvetica", 22, 500, true, false, "ScoreboardPlayerNameBig" )[/CODE][/QUOTE]
Fonts are made like this now:
[lua]
surface.CreateFont( "TheDefaultSettings", {
font = "Arial",
size = 13,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false
} )
[/lua]
If you leave a property out of the table it will default to the one I just posted.
[url]http://wiki.garrysmod.com/page/Libraries/surface/CreateFont[/url]
[QUOTE=Hyper Iguana;38944599]Fonts are made like this now:
[lua]
surface.CreateFont( "TheDefaultSettings", {
font = "Arial",
size = 13,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false
} )
[/lua]
If you leave a property out of the table it will default to the one I just posted.
[url]http://wiki.garrysmod.com/page/Libraries/surface/CreateFont[/url][/QUOTE]
Thanks I as looking for this page, thank you again
[QUOTE=Hyper Iguana;38944492]I have a file in gamemodedirectory/contents/materials/file.jpg
is the resource.AddFile process still resource.AddFile("materials/file.jpg") or do I have to go from the root garry's mod directory?[/QUOTE]
I believe it's materials/file.jpg, since gmod mounts gamemodedirectory/contents onto the filesystem when the gamemode is loaded. Gmod has always been finnicky about the gamemode contents folder so if it doesn't work properly, try the other way.
[QUOTE=_Undefined;38942357][url]https://github.com/adamdburton/pointshop/blob/master/lua/vgui/DPointShopItem.lua#L98[/url][/QUOTE]
[table="width: 500"]
[tr]
[td][IMG]http://cloud.steampowered.com/ugc/560961672075251959/A54194BF370976DA7C54E325A5CD36B27FE21209/[/IMG][/td]
[/tr]
[/table]
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
render.SetScissorRect(0, 0, ScrW() / 2, ScrH() / 2, true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
[/lua]
I tried your way, didn't work. Tried the way on the wiki and it removes the panels custom paint but it doesn't remove the models from being drawn.
Remove line 7 in that snippet, and try that.
How can I get if a entity in the map like a func_button is currently toggled?
[QUOTE=thomasfn;38946893]Remove line 7 in that snippet, and try that.[/QUOTE]
Same result Thomas,
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
render.SetScissorRect(0, 0, ScrW() / 2, ScrH() / 2, true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua]
[QUOTE=Moka;38946919]How can I get if a entity in the map like a func_button is currently toggled?[/QUOTE]
The best way would probably be to hook into PlayerUse, and if the entity used was a func_button, toggle the pressed state on it.
[lua]hook.Add( "PlayerUse", "blah", function( ply, ent )
if (ent:GetClass() == "func_button") then
ent.PressedState = not ent.PressedState
end
end )[/lua]
Won't work if your map toggles the button through hammer IO though.
[editline]23rd December 2012[/editline]
[QUOTE=brandonj4;38946926]Same result Thomas,
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
render.SetScissorRect(0, 0, ScrW() / 2, ScrH() / 2, true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua][/QUOTE]
Oh I see, try this:
[code]render.SetScissorRect( 0, 0, self:GetWide(), self:GetTall(), true )[/code]
Replace line 7 in your latest snippet with this.
[QUOTE=thomasfn;38946941]
Oh I see, try this:
[code]render.SetScissorRect( 0, 0, self:GetWide(), self:GetTall(), true )[/code]
Replace line 7 in your latest snippet with this.[/QUOTE]
Yeah, that will make it not draw at all, tried this and still nothing aside from what DPanelList already does with the Panels inside with Panel.NoClipping.
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = self.Parent:LocalToScreen(0,0)
render.SetScissorRect( 0, 0, (x + self.Parent:GetWide()), (y + self.Parent:GetTall()), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua]
[QUOTE=brandonj4;38947042]Yeah, that will make it not draw at all, tried this and still nothing aside from what DPanelList already does with the Panels inside with Panel.NoClipping.
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = self.Parent:LocalToScreen(0,0)
render.SetScissorRect( 0, 0, (x + self.Parent:GetWide()), (y + self.Parent:GetTall()), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua][/QUOTE]
I'm not quite sure if the x and y it asks for is relative to the screen or not.
Try this:
[code]local x, y = self:LocalToScreen( 0, 0 )
render.SetScissorRect( x, y, x + self:GetWide(), y + self:GetTall(), true )[/code]
[QUOTE=thomasfn;38947085]I'm not quite sure if the x and y it asks for is relative to the screen or not.
Try this:
[code]local x, y = self:LocalToScreen( 0, 0 )
render.SetScissorRect( x, y, x + self:GetWide(), y + self:GetTall(), true )[/code][/QUOTE]
Tried it, still nothing. Went as far as doing this:
[video=youtube;7mXICTGCg2I]http://www.youtube.com/watch?v=7mXICTGCg2I&feature=youtu.be[/video]
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = gui.MousePos()
LocalPlayer():ChatPrint(x.."-"..y)
render.SetScissorRect(x, y, (x + self.Parent:GetWide()), (y + self.Parent:GetTall()), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua]
[QUOTE=thomasfn;38947085]I'm not quite sure if the x and y it asks for is relative to the screen or not.
Try this:
[code]local x, y = self:LocalToScreen( 0, 0 )
render.SetScissorRect( x, y, x + self:GetWide(), y + self:GetTall(), true )[/code][/QUOTE]
The x, y is relative to 0,0 regardless of whether it's in a panel hook or not, just fyi
(so that should work)
[QUOTE=brandonj4;38947180]Tried it, still nothing. Went as far as doing this:
[video=youtube;7mXICTGCg2I]http://www.youtube.com/watch?v=7mXICTGCg2I&feature=youtu.be[/video]
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = gui.MousePos()
LocalPlayer():ChatPrint(x.."-"..y)
render.SetScissorRect(x, y, (x + self.Parent:GetWide()), (y + self.Parent:GetTall()), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua][/QUOTE]
I guess this method won't work then. You'll have to find the source code of DModelPanel and reimplement the paint method completely, render.SetScissorRect probably has to go somewhere specific to work with the 3d rendering.
-knsip-Why do I always solve stuff just after posting.
Hey, I have a problem with a model.
I have a model I downloaded, I put in its lua, materials, and models, then also added them to FAST DL. Then I gerneated a resource.lua file yet it still doesn't work..
Resource: [IMG]http://puu.sh/1EsUd[/IMG]
Model Link: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=111603898&searchtext=pedo+bear[/url]
[QUOTE=Astrid;38948005]Hey, I have a problem with a model.
I have a model I downloaded, I put in its lua, materials, and models, then also added them to FAST DL. Then I gerneated a resource.lua file yet it still doesn't work..
Resource: [IMG]http://puu.sh/1EsUd[/IMG]
Model Link: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=111603898&searchtext=pedo+bear[/url][/QUOTE]
Do you have any red errors in the server console about missing files?
Also what do you mean "it doesn't work", do the files just not download on the client?
[QUOTE=brandonj4;38947180]Tried it, still nothing. Went as far as doing this:
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = gui.MousePos()
LocalPlayer():ChatPrint(x.."-"..y)
render.SetScissorRect(x, y, (x + self.Parent:GetWide()), (y + self.Parent:GetTall()), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua][/QUOTE]
When you end the scissor rect, the w and h should still be the same.
[QUOTE=Chessnut;38948812]When you end the scissor rect, the w and h should still be the same.[/QUOTE]
Doesn't affect the models that are being drawn. -nope-
[QUOTE=Chessnut;38948812]When you end the scissor rect, the w and h should still be the same.[/QUOTE]
I've always used 0, 0, 0, 0, false and it works fine?
I've been wasting time writing extra stuff then.
[QUOTE=Chessnut;38948921]I've been wasting time writing extra stuff then.[/QUOTE]
You're not on steam?
Last attempt:
[lua]
local ItemPanel = vgui.Create("ItemModelPanel")
ItemPanel:SetModel(item.Model)
ItemPanel:SetSize(150,120)
ItemPanel.PaintOrig = ItemPanel.Paint
ItemPanel.Parent = ItemPanel:GetParent()
function ItemPanel.Paint(self, w, h)
local x, y = gui.MousePos()
LocalPlayer():ChatPrint(x.."-"..y)
render.SetScissorRect(x, y, ScrW(), ScrH(), true)
self.PaintOrig(self)
render.SetScissorRect(0, 0, 0, 0, false)
end
[/lua]
Doesn't seem to affect the models.
Where is a good place, to run this:
[LUA] Player:ConCommand("record","demodemodemo");
print("Player is recording");
[/LUA]
I need this, before the Clients gets all the Server-data,
Didnt work at the InitialSpawn and OnConnect Hook
I don't think you can make a player do that
Well, you actually can, by running it Clientside
Any way to remove that oversized REC label?
Sorry, you need to Log In to post a reply to this thread.