Can someone help me doing a cam3D2D browser window?
Code:
[Lua]
local pos = Vector(116.015526 ,-289.976074, -11330.187500)
local ang = Angle(0, 0, 90)
local width = 1024
local height = 768
local scale = 0.125
local url = "http://google.com"
surface.CreateFont( "t", {
font = "Arial",
size = 13,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
outline = false,
additive = false,
} )
local pnl = vgui.Create("DFrame")
pnl:SetSize(500,500)
pnl:SetPos(100,100)
pnl:SetVisible(true)
pnl:ShowCloseButton(true)
pnl:MakePopup()
local browser = vgui.Create("DHTML", pnl)
browser:SetSize(100, 000)
browser:SetPos(30,30)
browser:SetMouseInputEnabled(true)
browser:SetVisible( true )
browser:OpenURL("http://www.google.com/")
local function lol()
if !browser then return end;
if !browser:GetHTMLMaterial() then return end;
if browser then
cam.Start3D2D(pos, ang, 1)
surface.SetMaterial(browser:GetHTMLMaterial())
surface.DrawTexturedRect( 0, 0, 500, 500)
cam.End3D2D()
end
end
hook.Add("PostDrawTranslucentRenderables","test",lol)
[/lua]
There is a flickery screen showing up,
but i want it without a HTML panel on the screen, only the 3D2D one
[url]http://www.garrysmod.org/downloads/?a=view&id=127925[/url]
Here is a working 3D2D panel
concommand.Add( "derma", function()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 275,75 ) -- Position on the players screen
DermaPanel:SetSize( 750, 500 ) -- Size of the frame
DermaPanel:SetTitle( "Testing Derma Stuff" ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup() -- Show the frame
end )
If I have this Derma panel, how would I change the colour of it?
@ExtremLapin
Nope, that one is not working^^
Can someone please help me? I've been stuck on this for three days now.
I'm trying to create a auto-include system for items and it finds the file but says it doesn't exist.
[lua]
global_items = {}
local function LoadItems()
local path = GAMEMODE.Folder
local files, dir = file.Find(path.."/gamemode/items/*","GAME")
for k,v in pairs(files) do
print("File: "..v)
include("items/"..v)
AddCSLuaFile("items/"..v)
end
end
hook.Add("Initialize","LoadItems",LoadItems)
function RegisterItem(itemtbl)
print("Item registered.")
end
--Item Code
local ITEM = {}
ITEM.Name = "Test"
ITEM.Description = "DURR TEST ITEM"
print("TEST ITEM")
RegisterItem(ITEM)
[/lua]
Error:
[code]
Couldn't include file 'items\item_test.lua' (File not found) (@gamemodes/gflight/gamemode/sh_items.lua (line 7))
[AddCSLuaFile] Couldn't find 'items/item_test.lua' (@gamemodes/gflight/gamemode/sh_items.lua (line 8))
File: item_test2.lua
Couldn't include file 'items\item_test2.lua' (File not found) (@gamemodes/gflight/gamemode/sh_items.lua (line 7))
[AddCSLuaFile] Couldn't find 'items/item_test2.lua' (@gamemodes/gflight/gamemode/sh_items.lua (line 8))
[/code]
I've been trying to update Kermite's weapons to Gmod 13, as I haven't found any updates elsewhere. The error I'm getting is
[ERROR] addons/kermite/lua/weapons/kermite_base/shared.lua:433: ')' expected near '|'
1. unknown - addons/kermite/lua/weapons/kermite_base/shared.lua:0
I think this means I need to change what's in the file into a table, based on what I've heard before. But is there a general format for how it should look? The error is repeating for every lua file in the same kermite_base directory.
[QUOTE=DetCalver;38865961]concommand.Add( "derma", function()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 275,75 ) -- Position on the players screen
DermaPanel:SetSize( 750, 500 ) -- Size of the frame
DermaPanel:SetTitle( "Testing Derma Stuff" ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup() -- Show the frame
end )
If I have this Derma panel, how would I change the colour of it?[/QUOTE]
Override the [URL="http://wiki.garrysmod.com/page/Events/Panel/Paint"]Panel.Paint[/URL] function.
[QUOTE=jrj996;38866969]Can someone please help me? I've been stuck on this for three days now.
I'm trying to create a auto-include system for items and it finds the file but says it doesn't exist.
[lua]
global_items = {}
local function LoadItems()
local path = GAMEMODE.Folder
local files, dir = file.Find(path.."/gamemode/items/*","GAME")
for k,v in pairs(files) do
print("File: "..v)
include("items/"..v)
AddCSLuaFile("items/"..v)
end
end
hook.Add("Initialize","LoadItems",LoadItems)
function RegisterItem(itemtbl)
print("Item registered.")
end
--Item Code
local ITEM = {}
ITEM.Name = "Test"
ITEM.Description = "DURR TEST ITEM"
print("TEST ITEM")
RegisterItem(ITEM)
[/lua]
Error:
[code]
Couldn't include file 'items\item_test.lua' (File not found) (@gamemodes/gflight/gamemode/sh_items.lua (line 7))
[AddCSLuaFile] Couldn't find 'items/item_test.lua' (@gamemodes/gflight/gamemode/sh_items.lua (line 8))
File: item_test2.lua
Couldn't include file 'items\item_test2.lua' (File not found) (@gamemodes/gflight/gamemode/sh_items.lua (line 7))
[AddCSLuaFile] Couldn't find 'items/item_test2.lua' (@gamemodes/gflight/gamemode/sh_items.lua (line 8))
[/code][/QUOTE]
[lua]
for k, v in pairs(file.Find("GAMEMODEFOLDERNAME/gamemode/items/*.lua", "LUA")) do
include("items/" .. v)
end
[/lua]
You can just replace include with AddCSLuaFile and then use the code shared, server and client.
Just put it at the top of the file, without any hook attached to it.
[QUOTE=jrj996;38866969]Can someone please help me? I've been stuck on this for three days now.[/QUOTE]
Replace "GAME" with "LUA" and GAMEMODE.Folder with GAMEMODE.FolderName
Thanks guys that worked, but now I'm getting this error;
[code]
[ERROR] gamemodes/gflight/gamemode/items/item_test2.lua:9: attempt to call global 'RegisterItem' (a nil value)
1. unknown - gamemodes/gflight/gamemode/items/item_test2.lua:9
2. include - [C]:-1
3. LoadItems - gamemodes/gflight/gamemode/sh_items.lua:6
4. unknown - gamemodes/gflight/gamemode/sh_items.lua:10
5. include - [C]:-1
6. unknown - gamemodes/gflight/gamemode/cl_init.lua:5
[/code]
EDIT:
Nevermind, I defined RegisterItem after I load the items.
OK, so what I want to do is get the value of Rank from [B]init.lua[/B] in [B]cl_init.lua[/B] but not sure at all about how to go about doing so.
[B]I need to get the value of an integer server side and send it to the client.[/B]
Server side:
[CODE]...
[B]Rank = 1[/B]
...[/CODE]
Client side:
[CODE]
[B]I need to check for the Rank's value here! :)[/B]
if (Rank == 1) then
RankName = "Private " .. LocalPlayer():Nick()
surface.SetTexture(surface.GetTextureID("gui/silkicons/award_star_bronze_1"))
surface.DrawTexturedRect(25 + 130,ScrH() - 60,16,16)
elseif (Rank == 2) then
RankName = "Lance Corporal " .. LocalPlayer():Nick()
surface.SetTexture(surface.GetTextureID("gui/silkicons/award_star_bronze_2"))
surface.DrawTexturedRect(25 + 200,ScrH() - 60,16,16)[/CODE]
I would really really appreciate some help here, I've been working on this for days and still haven't cracked it.
[QUOTE=Par3210;38868736]OK, so what I want to do is get the value of Rank from [B]init.lua[/B] in [B]cl_init.lua[/B] but not sure at all about how to go about doing so.
[B]I need to get the value of an integer server side and send it to the client.[/B]
Server side:
[CODE]...
[B]Rank = 1[/B]
...[/CODE]
Client side:
[CODE]
[B]I need to check for the Rank's value here! :)[/B]
if (Rank == 1) then
RankName = "Private " .. LocalPlayer():Nick()
surface.SetTexture(surface.GetTextureID("gui/silkicons/award_star_bronze_1"))
surface.DrawTexturedRect(25 + 130,ScrH() - 60,16,16)
elseif (Rank == 2) then
RankName = "Lance Corporal " .. LocalPlayer():Nick()
surface.SetTexture(surface.GetTextureID("gui/silkicons/award_star_bronze_2"))
surface.DrawTexturedRect(25 + 200,ScrH() - 60,16,16)[/CODE]
I would really really appreciate some help here, I've been working on this for days and still haven't cracked it.[/QUOTE]
Usermessages:
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd325.html[/url]
or use the net library
[url]http://wiki.garrysmod.com/page/Libraries/net[/url]
The net library is great, but I still use usermessages for simple stuff
[CODE]grenade:SetAngles(Vector(math.random(1, 100), math.random(1, 100), math.random(1, 100)))[/CODE]
Since GM13, Entity:SetAngles(angle) hates vectors. Anyway to fix this?
Exact error goes[ERROR] .../shared.lua:249: attempt to index global 'Vector' (a function value)
AND
[CODE]timer.Simple(0.35, function() if not self.Owner then return end self:ThrowGrenade() self.Owner:ViewPunch(Vector(math.Rand(1, 2), math.Rand(0, 0), math.Rand(0, 0))) end)[/CODE]
[ERROR] .../shared.lua:169: bad argument #1 to 'ViewPunch' (Angle expected, got userdata)
Edit: managed to fix the angle stuff by myself. The problem now is the new format of timer
If anyone has a lot of time on their hands, and are bored, I can't figure out why Baddog's Katana doesn't fire the melee damage projectile type thing, much appreciated if anyone could point out the error, or fix the one on line 367.
[url]http://codepad.org/yezMgL7d[/url]
Does anyone know how I could do a http.Fetch and add a header?
e.g. "Authorization: Basic " .. util.Base64Encode(username .. ":" .. password)
Does anyone have a function to detect the distance between two lines? Like util.DistanceToLine but takes another line instead of a point.
Hi, I've been making a DarkRP hud. The problem is if the players name is too long it overlaps over the next section of the HUD (I'm doing a long straight hud)
How can I make it so when the text becomes longer, the rest of the hud moves with it.
Code:
local function DrawHUD()
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
v1 = LocalPlayer().DarkRPVars.money
if not v1 then v1 = "" end
v2 = LocalPlayer().DarkRPVars.salary
if not v2 then v2 = "" end
draw.RoundedBox(1, 25, ScrH() - 50, 600, 30, Color(25,25,25,200))
surface.SetDrawColor(255,255,255)
surface.SetTexture(surface.GetTextureID("gui/silkicons/user"))
surface.DrawTexturedRect(1 + 30,ScrH() - 45,16,16)
surface.SetTexture(surface.GetTextureID("gui/silkicons/money"))
surface.DrawTexturedRect(1 + 250,ScrH() - 45,16,16)
draw.SimpleText(LocalPlayer():Nick(),"TargetID", 1 + 60,ScrH() - 27, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText("$" .. v2,"TargetID", 1 + 150,ScrH() - 27, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText("$" .. v1,"TargetID", 25 + 30,ScrH() - 145, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
Scrw, Scrh = ScrW(), ScrH()
RelativeX, RelativeY = 0, Scrh
DoActualHUD()
GunLicense()
Agenda()
JobHelp()
DrawVoiceChat()
LockDown()
Arrested()
AdminTell()
end
Are the lines parallel? If so, you can use util.DistanceToLine for any point.
Are they skew? Then the distance varies.
[editline]18th December 2012[/editline]
re:
[QUOTE=amkoc;38878756]Does anyone have a function to detect the distance between two lines? Like util.DistanceToLine but takes another line instead of a point.[/QUOTE]
Is there any more documentation for creating binary modules for Gmod 13 LUA? I found this -> [url]http://wiki.garrysmod.com/page/Creating_Binary_Modules[/url] and I downloaded, built, and compiled the example, but I'm not sure how to activate it (I.E. where to put it, how to run it). The readme file and the website say I should put it in lua\bin, however, when I use lua_run requrie('example') from my client console, it tells me it can't find it in lua\modules, and that it's looking for example.lua. I'm also unsure about naming conventions. For example, the file is named gmsv_example.dll, which I assume means server dll file. do I have to have one with gmcl_ for it to work on my client? (If yes, does this mean that my distribution of the addon would require lua/bin/gmsv_myaddon.dll AND lua/bin/gmcl_myaddon.dll?)
Long question shortened, are there any tutorials that go through EVERY step on setting up a binary LUA module?
[QUOTE=Labrasones;38879183]Is there any more documentation for creating binary modules for Gmod 13 LUA? I found this -> [url]http://wiki.garrysmod.com/page/Creating_Binary_Modules[/url] and I downloaded, built, and compiled the example, but I'm not sure how to activate it (I.E. where to put it, how to run it). The readme file and the website say I should put it in lua\bin, however, when I use lua_run requrie('example') from my client console, it tells me it can't find it in lua\modules, and that it's looking for example.lua. I'm also unsure about naming conventions. For example, the file is named gmsv_example.dll, which I assume means server dll file. do I have to have one with gmcl_ for it to work on my client? (If yes, does this mean that my distribution of the addon would require lua/bin/gmsv_myaddon.dll AND lua/bin/gmcl_myaddon.dll?)
Long question shortened, are there any tutorials that go through EVERY step on setting up a binary LUA module?[/QUOTE]
It needs to be lua/bin/gmsv_example_win32.dll now (or _osx or _linux)
And no there aren't, I considered writing one but never got round to it. Also to stop you before you try, I don't think binary modules will load from addons, but yes you'd need to distribute both.
Thanks!
[QUOTE=Drakehawke;38879292]Also to stop you before you try, I don't think binary modules will load from addons[/QUOTE]
You're right, I was going to try that. Saved me some time there.
I'm currently trying to make a fade effect that uses math.Approach, but if frames are low it fades away wayyy too slowly, how do I fix this?
[QUOTE=vegasx;38873649]If anyone has a lot of time on their hands, and are bored, I can't figure out why Baddog's Katana doesn't fire the melee damage projectile type thing, much appreciated if anyone could point out the error, or fix the one on line 367.
[url]http://codepad.org/yezMgL7d[/url][/QUOTE]
on 367, change the != to ~=
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index3be2.html[/url]
Do these tutoirals still work with gmod 13? Looking at freta specifically.
[QUOTE=Slacker101;38880481][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index3be2.html[/url]
Do these tutoirals still work with gmod 13? Looking at freta specifically.[/QUOTE]
The stuff that hasn't changed still works but there is old outdated stuff on there as well. Not much has been updated to my knowledge. Fretta will not work.
[QUOTE=centran;38881120]The stuff that hasn't changed still works but there is old outdated stuff on there as well. Not much has been updated to my knowledge. Fretta will not work.[/QUOTE]
Know any good tutorials for learning lua then? I am looking to make a gamemode by the end of January.
[URL="http://glua.me/"]http://glua.me/[/URL]
[URL="http://wiki.garrysmod.com/page/Main_Page"]http://wiki.garrysmod.com/page/Main_Page[/URL]
You can learn hooks/functions there. There's also a few tutorials on the old wiki. If you want to make a gamemode it will take much longer than january, unless your making a very basic gamemode. I've been coding for garrysmod for almost two years and I have just gotten to the point where I feel I can make a legitimate gamemode. Sure, if I wanted to make a simple gungame or deathmatch gamemode, I could have made that the first three months of learning lua. However, if you want to make a gamemode that has a high replay value, you need to learn all sorts of information. Even some games you think are simple can sometimes be complex. If you really are set on making one, the best thing you can do is break down each of the components, the menu, the rules etc. and determine how much time you plan on spending on it.
[editline]18th December 2012[/editline]
Anyone know how to fix this PCF bug I'm getting? I made a small effect for testing, and I used this script to see if I'm using ParticleEffectAttach() correctly:
[lua]
if (CLIENT) then game.AddParticles( "particles/test1.pcf" ) end
function AttachParticle()
for k,v in pairs(player.GetAll()) do
if v:IsPlayer() && v:Alive() then
local id = v:LookupAttachment("eyes")
//local att = v:GetAttachment(id)
ParticleEffectAttach("test2",PATTACH_ABSORIGIN_FOLLOW,v,id)
end
end
end
concommand.Add("test_particle", AttachParticle)
function StopParticles()
for k,v in pairs(player.GetAll()) do
if v:IsPlayer() then v:StopParticles() end
end
end
concommand.Add("stop_particles", StopParticles)
[/lua]
The effect works, but it only spawn at Vector(0,0,0) on whatever map i choose. In gmod 12, I used ply.GetAttachment( attachmentID ) rather than just ply.LookupAttachment( string ) and it worked fine. This is the first effect I made, so I don't know if I'm using the function wrong, or if my effect is bugged. Thanks.
[QUOTE=PortalGod;38880228]on 367, change the != to ~=[/QUOTE]
Just comepletely get rid of the != nil part.
[lua]
if( self.ActivityTranslate[ act ] ) then
return self.ActivityTranslate[ act ];
end
[/lua]
[QUOTE=M0dSe7en;38882002][URL]http://glua.me/[/URL]
[URL]http://wiki.garrysmod.com/page/Main_Page[/URL]
You can learn hooks/functions there. There's also a few tutorials on the old wiki. If you want to make a gamemode it will take much longer than january, unless your making a very basic gamemode. I've been coding for garrysmod for almost two years and I have just gotten to the point where I feel I can make a legitimate gamemode. Sure, if I wanted to make a simple gungame or deathmatch gamemode, I could have made that the first three months of learning lua. However, if you want to make a gamemode that has a high replay value, you need to learn all sorts of information. Even some games you think are simple can sometimes be complex. If you really are set on making one, the best thing you can do is break down each of the components, the menu, the rules etc. and determine how much time you plan on spending on it.
[/QUOTE]
Well the gamemode I'm thinking of isn't that complex it's just two team fighting over a canon to blow up the others ship, set in space though.
Sorry, you need to Log In to post a reply to this thread.