• What do you need help with? V3
    6,419 replies, posted
Whats the command that allows you to use lua_run_cl and lua_openscript_cl commands again? I can't find it. Also, how do you make it so fonts you make scale equally with the screen?
Trying to get a custom MOTD to work and I get this error: [lua] [ERROR] addons/motd/lua/autorun/client/cl_easymotd.lua:136: attempt to call method 'GetSelected' (a nil value) 1. SkinHook - addons/motd/lua/autorun/client/cl_easymotd.lua:136 2. unknown - lua/vgui/dbutton.lua:85 [/lua] Here is the problematic area: [lua] function skin:PaintButton(button) local w, h = button:GetSize() local x, y = 0,0 local bordersize = 8 if w <= 32 or h <= 32 then bordersize = 4 end -- This is so small buttons don't look messed up if button.m_bBackground then local color1 = Color(50, 50, 50, 255) local color2 = Color(150, 150, 150, 150) if button:GetDisabled() then color2 = Color(80, 80, 80, 255) elseif button.Depressed or button:GetSelected() then color2 = Color(color2.r + 40, color2.g + 100, color2.b + 40, color2.a + 40) elseif button.Hovered then color1 = Color(color1.r + 40, color1.g + 40, color1.b + 40, color1.a) color2 = Color(color2.r + 40, color2.g + 40, color2.b + 40, color2.a + 40) end draw.RoundedBox(bordersize, x, y, w, h, color1) draw.RoundedBox(bordersize, x+1, y+1, w-2, h-2, color2) draw.RoundedBox(bordersize, x+1, y+1, w-2, (h-2)/2, Color(color2.r + 80, color2.g + 80, color2.b + 80, 50)) end end [/lua] Thanks in advance, I appreciate the help.
[QUOTE=Apozen;38340813]Trying to get a custom MOTD to work and I get this error: [lua] [ERROR] addons/motd/lua/autorun/client/cl_easymotd.lua:136: attempt to call method 'GetSelected' (a nil value) 1. SkinHook - addons/motd/lua/autorun/client/cl_easymotd.lua:136 2. unknown - lua/vgui/dbutton.lua:85 [/lua] Here is the problematic area: [lua] function skin:PaintButton(button) local w, h = button:GetSize() local x, y = 0,0 local bordersize = 8 if w <= 32 or h <= 32 then bordersize = 4 end -- This is so small buttons don't look messed up if button.m_bBackground then local color1 = Color(50, 50, 50, 255) local color2 = Color(150, 150, 150, 150) if button:GetDisabled() then color2 = Color(80, 80, 80, 255) elseif button.Depressed or button:GetSelected() then color2 = Color(color2.r + 40, color2.g + 100, color2.b + 40, color2.a + 40) elseif button.Hovered then color1 = Color(color1.r + 40, color1.g + 40, color1.b + 40, color1.a) color2 = Color(color2.r + 40, color2.g + 40, color2.b + 40, color2.a + 40) end draw.RoundedBox(bordersize, x, y, w, h, color1) draw.RoundedBox(bordersize, x+1, y+1, w-2, h-2, color2) draw.RoundedBox(bordersize, x+1, y+1, w-2, (h-2)/2, Color(color2.r + 80, color2.g + 80, color2.b + 80, 50)) end end [/lua] Thanks in advance, I appreciate the help.[/QUOTE] Try this, haven't coded lua in a while though [lua]button:GetSelected()[1] [/lua] or above it [lua]if button:GetSelected()[1] == nil then return end [/lua]
[QUOTE=CherryJim;38318144]How do I simply disable the creations menu in my server?[/QUOTE] I don't want to block the duplicator tool.
[QUOTE=highvoltage;38340779]Whats the command that allows you to use lua_run_cl and lua_openscript_cl commands again? I can't find it.[/QUOTE] sv_allowcslua 1
I've tried looking for tmysql4 for linux, is it out? I can't find it. I tried using the boost version, but it seems like that's not alike the tmysql4 one.
I'm working on a custom gamemode, but for the love of god I cannot figure out how to create a simple outline. Since the change of SetModelScale and GetModelScale I'm ripping my hair out, I have tryed Matrix() [code] local mat = Matrix() mat:Scale(1.1 ) self:EnableMatrix( "RenderMultiply", mat ) render.MaterialOverride( Material("white_outline" ) self:DrawModel() [/code] I want to make it so the player is highlighted when you use a certain item on him, but all it does it make him all white instead.
I would like to play an intro sound for when people join my server however I am having a problem with it sometimes cutting off short. I think this is due to the fact that the console command play filename.wav only allows one sound to be played at a time. How would I make it so that the sound file doesn't cut off? Is there a way to play multiple sounds at once?
[QUOTE=Bitroid;38345072]I would like to play an intro sound for when people join my server however I am having a problem with it sometimes cutting off short. I think this is due to the fact that the console command play filename.wav only allows one sound to be played at a time. How would I make it so that the sound file doesn't cut off? Is there a way to play multiple sounds at once?[/QUOTE] In lua you can do sound.play() for onplayerinitalspawn i think the hook is
[QUOTE=Bitroid;38345072]How would I make it so that the sound file doesn't cut off? Is there a way to play multiple sounds at once?[/QUOTE] LocalPlayer():EmitSound("whatever.wav", 0, 100)
How would I get the actual name of an NPC? I wanted to print out that a player was killed by a zombie, but i've tried [b][url=http://wiki.garrysmod.com/page/Classes/Entity/GetClass]Entity:GetClass[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] and [b][url=http://wiki.garrysmod.com/page/Classes/Entity/GetName]Entity:GetName[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b], but [I]GetClass[/I] returns npc_zombie and the like, while [I]GetName[/I] just doesn't print anything. Is there any quick way to display the actual name, or would I have to do it myself and check what npc they were?
[QUOTE=JetBoom;38345517]LocalPlayer():EmitSound("whatever.wav", 0, 100)[/QUOTE] When I used that, nothing seemed to play. This is my code if it might help. [lua] function ShowMOTD( ply ) ply:ConCommand( "motd" ) ply:EmitSound("bitroid/intro000.wav", 0, 100) end hook.Add( "PlayerInitialSpawn", "show_motd", ShowMOTD ) [/lua]
I can't load my addons from my addons folder what am I doing wrong? Am I missing something, It's a fresh install btw!
[QUOTE=NinjaS;38346653]I can't load my addons from my addons folder what am I doing wrong? Am I missing something, It's a fresh install btw![/QUOTE] You need to have an addon.txt file now, instead of info.txt
[QUOTE=LuckyLuke;38345939]How would I get the actual name of an NPC? I wanted to print out that a player was killed by a zombie, but i've tried [b][url=http://wiki.garrysmod.com/page/Classes/Entity/GetClass]Entity:GetClass[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] and [b][url=http://wiki.garrysmod.com/page/Classes/Entity/GetName]Entity:GetName[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b], but [I]GetClass[/I] returns npc_zombie and the like, while [I]GetName[/I] just doesn't print anything. Is there any quick way to display the actual name, or would I have to do it myself and check what npc they were?[/QUOTE] Can't you just do something like: [code]local newClass = string.gsub(ent:GetClass(), "npc_", "") local npcName = string.gsub(newClass, "_", " ") [/code]
[QUOTE=Crazy Quebec;38346746]You need to have an addon.txt file now, instead of info.txt[/QUOTE] Thank you very much. [img]http://www.facepunch.com/fp/ratings/heart.png[/img]
Why does this cause my game to instantly crash if I shoot and kill an NPC right after applying this effect? Here is my code: [lua] -- snippet of code in weapons primary fire function if ( SERVER ) and IsValid(trace.Entity) then local fx = EffectData() fx:SetEntity(trace.Entity) fx:SetMagnitude(1) util.Effect("ut2k4_overlay", fx, true) -- DamageInfo is applied here and only crashes if it kills the NPC end [/lua] [lua] --effects/UT2K4_Overlay.lua function EFFECT:Init(data) self.ent = data:GetEntity() self.mat = "sprites/UT2K4/Lightning_Energy" //data:GetMaterial() doesn't exist :( self.delay = CurTime()+data:GetMagnitude() if IsValid(self.ent) then self.model = ClientsideModel( self.ent:GetModel(), RENDERGROUP_OPAQUE) self.model:SetMaterial(self.mat) self.model:SetParent(self.ent) self.model:AddEffects(EF_BONEMERGE) end end function EFFECT:Think() if IsValid(self.ent) and self.ent:IsPlayer() and !self.ent:Alive() and IsValid( self.ent:GetRagdollEntity() ) then self.ent = self.ent:GetRagdollEntity() end if CurTime() > self.delay or !IsValid(self.ent) then self.model:Remove() self.model = nil return false end return true end function EFFECT:Render() end [/lua] It only happens when I shoot a NPC and kill it. I spawned monk and a crow, shot monk fine then shot the crow and crashed. Here is my crash log if it helps: [url]https://dl.dropbox.com/u/34886768/hl2_147_crash_2012_11_7T4_22_27C0.mdmp[/url]
I noticed that since the update nothing in my addon folder loads, what is the new format to be used for items to load?
[QUOTE=theVendetta;38353913]I noticed that since the update nothing in my addon folder loads, what is the new format to be used for items to load?[/QUOTE] info.txt => addon.txt because garry has yet to give us a .gma packer that doesn't involve polluting Steam Workshop with other people's unmaintained addons, or 300MB+ content packs, or slight edits
[QUOTE=Luni;38353977]info.txt => addon.txt because garry has yet to give us a .gma packer that isn't Steam Workshop[/QUOTE] Thankyou :D Is there a way to kick a player with only his IP Address, and display a message?
[QUOTE=theVendetta;38353983]Is there a way to kick a player with only his IP Address, and display a message?[/QUOTE] You should try looking at [url="http://wiki.garrysmod.com/page/Main_Page"]the wiki[/url] for simple things like that, it'll be faster than waiting for someone to reply here [lua]for _,v in pairs( player.GetAll() ) do if v:IPAddress()=="127.0.0.1" then v:Kick( "You were kicked because of your IP address!" ) end end[/lua]
Why can't I disable physicsobject motion on vehicles? [lua] print(Vehicle:GetPhysicsObject():IsMotionEnabled()) // prints true Vehicle:GetPhysicsObject():EnableMotion(false) print(Vehicle:GetPhysicsObject():IsMotionEnabled()) // prints true [/lua] Is there any other way to freeze cars?
[QUOTE=my_hat_stinks;38355691]You should try looking at [url="http://wiki.garrysmod.com/page/Main_Page"]the wiki[/url] for simple things like that, it'll be faster than waiting for someone to reply here [lua]for _,v in pairs( player.GetAll() ) do if v:IPAddress()=="127.0.0.1" then v:Kick( "You were kicked because of your IP address!" ) end end[/lua][/QUOTE] Ban by steamid instead or they'll just use an IP changer.
Is there any way to use [b][url=http://wiki.garrysmod.com/page/Libraries/string/upper]string.upper[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] to capitalise just the first letter of a string? Or is there another method of doing it?
[QUOTE=LuckyLuke;38357841]Is there any way to use [b][url=http://wiki.garrysmod.com/page/Libraries/string/upper]string.upper[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] to capitalise just the first letter of a string? Or is there another method of doing it?[/QUOTE] [lua] mystr = "whatever" mystr = mystr[1]:upper() .. mystr:sub( 2, #mystr )[/lua]
Does tmysql4 support linux yet? (Not the boost version)
[QUOTE=Persious;38358333]Does tmysql4 support linux yet? (Not the boost version)[/QUOTE] tmysql3 didn't have a non-boost Linux version iirc
Uh, so, how do I use the linux version of boost? Does it work exactly the same?
[QUOTE=Persious;38358375]Uh, so, how do I use the linux version of boost? Does it work exactly the same?[/QUOTE] Yes, it works exactly the same. The only difference is that it uses boost libraries which I provided in my svn. For whatever reason I can't compile any modules against the source sdk on linux, so I had to use boost. There is no difference in functionality at all. Instead of just needing just libmysql.so, you will need like 3 extra along side it.
[QUOTE=BlackAwps;38358433]Yes, it works exactly the same. The only difference is that it uses boost libraries which I provided in my svn. For whatever reason I can't compile any modules against the source sdk on linux, so I had to use boost. There is no difference in functionality at all. Instead of just needing just libmysql.so, you will need like 3 extra along side it.[/QUOTE] I'm new to Linux, and the host that I use uses Linux. Can you explain how I install it?
Sorry, you need to Log In to post a reply to this thread.