• What do you need help with? V3
    6,419 replies, posted
Well for some reason I can't get this Derma menu to show up. I'm getting this error: [ERROR] addons/enemy hit box/lua/autorun/hitbox.lua:20: attempt to index local 'DPanel' (a nil value) [lua] // Enemy HitBox \\ if SERVER then function DamageTaken( target, dmginfo ) if( target:IsPlayer() == false ) then Msg( target:GetName(), " Took Damage" ) end end hook.Add("EntityTakeDamage", "HitDetection", DamageTaken) end if CLIENT then local DPanel = vgui.Create( "DFrame" ) // Create the frame in a local variable DPanel:SetPos( 100, 100 ) // Set the position to 100, 100 ( x, y ) DPanel:SetSize( 300, 200 ) // Set the size to 300, 200 pixels DPanel:SetTitle( "My new Derma frame" ) // Set the title DPanel:SetVisible( true ) // Can you see it? ( Optional - default true ) DPanel:SetDraggable( true ) // Can you move/drag it? ( optional - default true ) DPanel:ShowCloseButton( true ) // Can you see the close button ( reccomended ) ( optional - default true ) DPanel:MakePopup() // Make it popup end [/lua]
you are probably trying to use vgui before it or derma has been initialized so it cant create the menu. try putting it in InitPostEntity or make a timer or something.
I was wondering if it was possible in gmod lua to get whether or not caps lock is on (clientside of course).
Ah alright. Would you recommended a better way of doing this, or is this the most efficient way? [lua] if CLIENT then hook.Add("InitPostEntity", "Init GUI", function() local DPanel = vgui.Create( "DFrame" ) // Create the frame in a local variable DPanel:SetPos( 100, 100 ) // Set the position to 100, 100 ( x, y ) DPanel:SetSize( 300, 200 ) // Set the size to 300, 200 pixels DPanel:SetTitle( "My new Derma frame" ) // Set the title DPanel:SetVisible( true ) // Can you see it? ( Optional - default true ) DPanel:SetDraggable( true ) // Can you move/drag it? ( optional - default true ) DPanel:ShowCloseButton( true ) // Can you see the close button ( reccomended ) ( optional - default true ) DPanel:MakePopup() // Make it popup end) end [/lua] It works, I was just curious if I was doing this the best way.
well you could use a usermessage from the server in PlayerInitialSpawn which would work just as well i guess but you dont really need it. having the client create it when its ready is a better option in my opinion.
Can't find an entry relevant to the other thread with this, so I figure this is fitting here: [code] [ERROR] addons/warmelons/lua/entities/base_warmelon/init.lua:124: attempt to perform arithmetic on a nil value 1. DoMoves - addons/warmelons/lua/entities/base_warmelon/init.lua:124 2. unknown - addons/warmelons/lua/entities/base_warmelon/init.lua:224[/code] Error occurs when a melon is ordered to move and persists until melon is removed or destroyed. [code] Line 121 local angle1 = self.TargetVec[1] - self.Entity:GetPos(); . . Line 124 self.Entity:GetPhysicsObject():ApplyForceCenter (angle1:Normalize() * self.MovingForce * melonspeed);[/code] Included line 121 as it declares angle1, and I presume this is the troublesome component.
you cant use Normalize() in an expression anymore. instead go local angle1 = self.TargetVec[1] - self.Entity:GetPos(); angle1:Normalize(); then use self.Entity:GetPhysicsObject():ApplyForceCenter (angle1 * self.MovingForce * melonspeed);
Can someone give me the keyvalues of env_skypaint, please?
sure. [lua] local e = ents.Create("env_skypaint") PrintTable(e:GetKeyValues()) [/lua] :)
arr furk *facetable* thanks. um lol, gmod 13 says [lua] RunConsoleCommand("trigger_target_parameter", "\<none\>") [/lua] [code] invalid escape sequence near '"' [/code] but it worked before the update to 13. o_o
\< and \> arent proper escape sequences just use < and >
[QUOTE=G4MB!T;38245463]\< and \> arent proper escape sequences just use < and >[/QUOTE] I did [code]\r<none\r>[/code] now xD [editline]:[/editline] I always though he wouldn't recognize "<none>", but now I get it: It was just a lag as I ran the code. So now I did "<none>"
uhm.. what?
Nothing. All good.
I wana learn how to make effects pop out of something any help will be appreciated.
could you be more specific?
[QUOTE=G4MB!T;38245592]could you be more specific?[/QUOTE] i want effects to be poping out in a string like a lazer from a npc when i shoot him.
I want to include a file in "lua/" from a file in "lua/autorun/", but if I do [lua] include("filename.lua")[/lua] it says it can't find the lua file. It worked before gmod 13. How can I include files in the main "lua/" folder now?
include looks in the lua/ directory, not autorun. use include("autorun/file.lua")
[QUOTE=G4MB!T;38246068]include looks in the lua/ directory, not autorun. use include("autorun/file.lua")[/QUOTE] Well, it should. [quote=wiki]Description: Executes a Lua script either relative to the current file, or absolute(relative to the /lua/ folder). [/quote]
why should it look in autorun instead of lua? thats just stupid. and thats exactly what i just said.
Not sure what Garry changed, I hope you guys can help me with these piece of codes: [code] [ERROR] gamemodes/blackbox/gamemode/core/sh_core.lua:2588: bad argument #2 to 'Find' (string expected, got nil) 1. Find - [C]:-1 2. IncludeDirectory - gamemodes/blackbox/gamemode/core/sh_core.lua:2588 3. unknown - gamemodes/blackbox/gamemode/core/sh_auto.lua:47 4. include - [C]:-1 5. unknown - gamemodes/blackbox/gamemode/core/sv_auto.lua:29 6. include - [C]:-1 7. unknown - gamemodes/blackbox/gamemode/init.lua:7 8. DeriveGamemode - [C]:-1 9. unknown - gamemodes/fallout/gamemode/init.lua:9 [/code] [lua] -- A function to include files in a directory. function BLACKBOX:IncludeDirectory(directory) if (string.sub(directory, -1) != "/") then directory = directory.."/"; end; for k, v in pairs( g_File.Find(directory.."*.lua", LUA_PATH) ) do -- <- Line 2588 BLACKBOX:IncludePrefixed(directory..v); end; end; [/lua] -- [code] [ERROR] gamemodes/blackbox/gamemode/core/sh_core.lua:283: attempt to index field 'player' (a nil value) 1. unknown - gamemodes/blackbox/gamemode/core/sh_core.lua:283 2. AnimRestartGesture - [C]:-1 3. HandlePlayerLanding - gamemodes/base/gamemode/animations.lua:129 4. unknown - gamemodes/base/gamemode/animations.lua:280 [/code] [lua] function BLACKBOX:TranslateActivity(player, act) local model = player:GetModel(); local raised = blackbox.player.GetWeaponRaised(player, true); -- <- Line 283 if ( string.find(model, "/player/") ) then local newAct = player:TranslateWeaponActivity(act); if (!raised or act == newAct) then return IdleActivityTranslate[act]; else return newAct; end; end; return act; end; [/lua] Thanks!
use "LUA" instead of LUA_PATH
Anyone know where the lua source for the playermodel menu is (if anywhere)?
[QUOTE=jmazouri;38246853]Anyone know where the lua source for the playermodel menu is (if anywhere)?[/QUOTE] I spent ages trying to find this yesterday [url]http://glua.me/bin/?path=/gamemodes/sandbox/gamemode/editor_player.lua[/url]
[QUOTE=TheTrueAndy;38246051]I want to include a file in "lua/" from a file in "lua/autorun/", but if I do [lua] include("filename.lua")[/lua] it says it can't find the lua file. It worked before gmod 13. How can I include files in the main "lua/" folder now?[/QUOTE] [QUOTE=G4MB!T;38246068]include looks in the lua/ directory, not autorun. use include("autorun/file.lua")[/QUOTE] I'll tell you why I got irritated from this: I said my lua file is in "lua/", but you told me I should use autorun. I did say the include function will be called from a file in lua/autorun/ and the file to be included is in lua/. That's what I meant. I know include looks in lua/ so I don't know why it's not working. (I just didn't wrote it properly, you mistunderstood and I followed the mistake.) [editline]:[/editline] Thanks to Noiwex, sv_allowcslua was at fault! :<
[QUOTE=thejjokerr;38246841]You are going to run into a lot more issues with Blackbox Lite than just those bits of code. It's my version of Blueprint 2 for gmod12. Having said its based of a framework by kuro, go figure how much broke in this update.[/QUOTE] Dont worry about that part, I just have two more issues which I have no idea how to fix. [code] [ERROR] gamemodes/blackbox/gamemode/core/libraries/sh_plugin.lua:215: attempt to call field 'FindDir' (a nil value) 1. Register - gamemodes/blackbox/gamemode/core/libraries/sh_plugin.lua:215 2. Include - gamemodes/blackbox/gamemode/core/libraries/sh_plugin.lua:494 3. IncludeDesign - gamemodes/blackbox/gamemode/core/sh_core.lua:1096 4. unknown - gamemodes/blackbox/gamemode/core/sh_auto.lua:108 5. include - [C]:-1 6. unknown - gamemodes/blackbox/gamemode/core/sv_auto.lua:29 7. include - [C]:-1 8. unknown - gamemodes/blackbox/gamemode/init.lua:7 9. DeriveGamemode - [C]:-1 10. unknown - gamemodes/hl2rp/gamemode/init.lua:9 [/code] [lua] -- A function to register a new plugin. function blackbox.plugin.Register(plugin) blackbox.plugin.stored[plugin.name] = plugin; blackbox.plugin.stored[plugin.name].plugins = {}; blackbox.plugin.buffer[plugin.folderName] = plugin; for k, v in pairs( g_File.FindDir(plugin.directory.."/plugins/*", LUA_PATH) ) do -- <- Line 215 - "LUA" doesnt work. if (v != ".." and v != ".") then table.insert( blackbox.plugin.stored[plugin.name].plugins, string.lower(v) ); end; end; if ( !blackbox.plugin.IsUnloaded(plugin) ) then blackbox.plugin.IncludeExtras(plugin.directory); if (CLIENT) then plugin.helpID = blackbox.directory.AddCode("Plugins", [[ <b> <font size="3"> ]]..plugin.name..[[ <font size="2"><i>by ]]..plugin.author..[[</i></font> </font> </b> <br> <font size="1"> <i>]]..plugin.description..[[</i> </font> ]], nil, plugin.author); end; end; blackbox.plugin.IncludePlugins(plugin.directory); end; [/lua] [code] [ERROR] gamemodes/blackbox/gamemode/core/sv_auto.lua:46: attempt to index global '_R' (a nil value) 1. unknown - gamemodes/blackbox/gamemode/core/sv_auto.lua:46 2. include - [C]:-1 3. unknown - gamemodes/blackbox/gamemode/init.lua:7 4. DeriveGamemode - [C]:-1 5. unknown - gamemodes/hl2rp/gamemode/init.lua:9 [/code] [lua] _R["CRecipientFilter"].IsValid = function() return true; end; [/lua]
[QUOTE=G4MB!T;38246229]use "LUA" instead of LUA_PATH[/QUOTE] [editline]30th October 2012[/editline] and _R was removed, use debug.getregistry()
[QUOTE=Apozen;38234747]It exists, you can see here [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5b6d.html[/url] Also, this worked before GMOD13, something new is messing it up. ;-)[/QUOTE] I know its late but I went through the old fonts in Gmod 13 awhile ago and made a list with all the ones still working: [url]http://wiki.garrysmod.com/page/Talk:Libraries/surface/SetFont[/url]
[QUOTE=RP-01;38230978]You keep getting this error, because self.Pilot is probably nil. You should change line 48 to 81 into this: [lua]function ENT:DoKill() self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetNetworkedBool("isDriveShuttle",false) self.Pilot:SetPos(self.Entity:GetPos()+Vector(0,0,100)) end function ENT:OnTakeDamage(dmg) if self.Inflight and DESTROYABLE and not self.Done then local health=self.Entity:GetNetworkedInt("health") self.Entity:SetNetworkedInt("health",health-dmg:GetDamage()) local health=self.Entity:GetNetworkedInt("health") if health<1 then self.Entity:DoKill() self.Done=true self.Entity:Remove() end end end function ENT:OnRemove() if (self.Sound) then self.Sound:Stop() end local effectdata = EffectData() effectdata:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", effectdata, true, true ) if self.Pilot then self.Entity:DoKill() end end[/lua] Your code is pretty messy btw. You really should clean it up "a bit".. [/QUOTE] Thanks.
Sorry, you need to Log In to post a reply to this thread.