• What do you need help with? V3
    6,419 replies, posted
[QUOTE=Mitsudigi;38164871]Having odd problem in 13: [code] self:SetRenderMode(RENDERMODE_TRANSALPHA) self:SetColor(Color(0,0,0,0)) [/code] Completely invisible. [code] self:SetRenderMode(RENDERMODE_TRANSALPHA) self:SetColor(Color(0,0,0,20)) [/code] Completely visible. Why can't I get my entity to be just slightly transparent anymore?[/QUOTE] I'm having the same issue as this guy, anybody managed to solve this?
[QUOTE=Sc00by22;38714648]I'm having the same issue as this guy, anybody managed to solve this?[/QUOTE] Try 0.2 for alpha
[QUOTE=JVanover;38708108]Okay, so I just found out about [URL="http://wiki.garrysmod.com/page/Player_Classes"]the new Player Classes[/URL] and I'm trying to implement them into my gamemode, but it isn't working and I know next to nothing about lua so I can't figure out how to make it work without any documentation. Essentially, I have a derma menu with buttons, and each button is supposed to change your class; the derma function is in client, and the class change is in server. There isn't any documentation that explains how to make it work and I have no examples to use or look at. Here is the relevant client code: [CODE]-- Medic bdBluClass7 = vgui.Create( "DButton" ) bdBluClass7:SetText( "Medic - M416" ) bdBluClass7.DoClick = function() surface.PlaySound( "jessev92/bf2/menu/kitSelect.wav" ) RunConsoleCommand("bd_mode_medic416") -- Run command frame:Close() end CategoryList:AddItem( bdBluClass7 ) [/CODE] Here is the relevant server code: [code]function class_Medic() MsgN("Test1") -- This prints player_manager.SetPlayerClass( ply, "soldier_medic" ) - This gives no error end concommand.Add("bd_mode_medic416", class_Medic)[/code] No errors are given. The custom class name is 'soldier_medic'. Edit: any errors I do get are the same every time: [code]lua/includes/modules/player_manager.lua:148: attempt to index local 'ply' (a nil value)[/code][/QUOTE] I'm sure you'll have to add a ply into the function. Tho I'm just guessing. I haven't used player_manager.SetPlayerClass before. [lua] function class_Medic(ply) MsgN("Test1") -- This prints player_manager.SetPlayerClass( ply, "soldier_medic" ) - This gives no error end concommand.Add("bd_mode_medic416", class_Medic) [/lua]
[QUOTE=JVanover;38708108][code]function class_Medic() MsgN("Test1") -- This prints player_manager.SetPlayerClass( ply, "soldier_medic" ) - This gives no error end concommand.Add("bd_mode_medic416", class_Medic)[/code] No errors are given. The custom class name is 'soldier_medic'. Edit: any errors I do get are the same every time: [code]lua/includes/modules/player_manager.lua:148: attempt to index local 'ply' (a nil value)[/code][/QUOTE] The error you're getting is because ply, a variable, is not set by default in a concommand call. You need to assign the 3 sets of args into the concommand function and give the first argument, which is a Player, the same variable name as what you're calling on SetPlayerClass. This should work for you: [code]function class_Medic( ply, cmd, args ) MsgN("Test1") -- This prints player_manager.SetPlayerClass( ply, "soldier_medic" ) - This gives no error end concommand.Add("bd_mode_medic416", class_Medic)[/code]
[QUOTE=Darkwater124;38714818]Try 0.2 for alpha[/QUOTE] Completely invisible still.
Why doess this fail? [lua] local dpanel = vgui.Create("DFrame") dpanel:SetSize(700, 500) dpanel:Center()[/lua]
[QUOTE=amkoc;38715526]Why doess this fail? [lua] local dpanel = vgui.Create("DFrame") dpanel:SetSize(700, 500) dpanel:Center()[/lua][/QUOTE] No errors? Try adding [lua]dpanel:MakePopup( ) dpanel:SetVisible( true )[/lua] to your code.
[QUOTE=Acecool;38715867]No errors? [/QUOTE] Error is something like 'failed to create VGUI 'DFrame', forgot, sorry
[QUOTE=amkoc;38716540]Error is something like 'failed to create VGUI 'DFrame', forgot, sorry[/QUOTE] Are you running it too early? (Make sure you're not running it on scriptload or something, have the menu open on PlayerInitialSpawn instead)
How do I save tables to files? I guess glon did that but it got removed and also was extremely slow.
[QUOTE=Ndsbot;38717296]How do I save tables to files? I guess glon did that but it got removed and also was extremely slow.[/QUOTE] [lua] local table = {}; local data = util.TableToJSON( table ); file.Write("gameinfo.txt", data); [/lua] and to load it [lua] local table = util.JSONToTable( file.Read("gameinfo.txt") ); [/lua] Something like that.
What the fuck? [lua][ERROR] ...ua_updated/lua/weapons/gmod_tool/stools/transparency.lua:9: attempt to call field 'AddNetworkString' (a nil value) 1. unknown - ...ua_updated/lua/weapons/gmod_tool/stools/transparency.lua:9 2. include - [C]:-1 3. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua:131 4. include - [C]:-1 5. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:349 6. include - [C]:-1 7. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/cl_init.lua:5[/lua] [lua]] lua_run print(util.AddNetworkString) > print(util.AddNetworkString)... function: 0x1b438370[/lua] so it exists? said line [lua]util.AddNetworkString( "transparency_blend_value" )[/lua] and I was directed here after tried to send it without pooling it [url]http://wiki.garrysmod.com/page/Calling_net.Start_with_unpooled_message_name[/url] EDIT: FIXED Yeah it was getting called in both sides. Wrapping it in 'if SERVER then' worked.
In what hook should I draw props with render.SetBlend()? PreDrawTranslucentRenderables PreRender
[QUOTE=JustSoFaded;38717336][lua] local table = {}; local data = util.TableToJSON( table ); file.Write("gameinfo.txt", data); [/lua] and to load it [lua] local table = util.JSONToTable( file.Read("gameinfo.txt") ); [/lua] Something like that.[/QUOTE] Personally I'd recommend using vON instead of JSON just because JSON has a reputation for mangling things when you unserialize them. It also likes to convert very large numbers (like, say, [i]timestamps[/i], which I use all the time) to scientific notation and immediately loses all the small bits.
I've got an entity that creates a util.Effect however I need to remove the effect later on and haven't found a good way to do this. Does anybody know of one? EDIT: It just came to me, all I really needed to do was just call util.Effect in my entities Think loop to produce the effect over and over again.
[QUOTE=centran;38700761]How would you write server side lua to block a client from running a console command?[/QUOTE] Ok to answer my own question I think the following code should work. [code] hook.Add( 'PlayerBindPress', 'StopDancing', function(ply,bind,pressed) if string.find(bind,'act') then return true end end ) [/code] However, that should only stop them from using the command if is bound to a key. They would still be able to manualy enter the command in console to run it. I don't think there is a way to block that.
Anyone happen to know the max length of a derma label? I'm making a little function to auto make new labels and auto newline so the text doesn't overflow the parent frame Thanks
[QUOTE=Trumple;38719482]Anyone happen to know the max length of a derma label? I'm making a little function to auto make new labels and auto newline so the text doesn't overflow the parent frame Thanks[/QUOTE] Why not set the max size and word wrap? [editline]5th December 2012[/editline] (or am I misunderstanding what you're asking?)
[QUOTE=Banana Lord.;38719547]Why not set the max size and word wrap? [editline]5th December 2012[/editline] (or am I misunderstanding what you're asking?)[/QUOTE] Wait does the word wrap flag make new lines when the text exceeds the size of the label?
[QUOTE=Trumple;38719645]Wait does the word wrap flag make new lines when the text exceeds the size of the label?[/QUOTE] iirc, yes
Hang on let me explain a little better. I want to be safe in the knowledge that when I write a bit of text to put on a derma frame, it wont exceed the size of said frame and get cut off. So, I want to make a new line automatically when the label width exceeds that of the parent frame. I have that bit done okay (and it sounds like Wrap does that already, oh well), but I also want to make sure the label doesn't get too long (put too much text in it and it will cut it off) Now I should probably use HTML frames for this but oh well. All I wanted to know was what the cutoff limit was for the label. I ended up doing it manually and found its about 800 chars [editline]6th December 2012[/editline] I was just being lazy, thanks anyway - I got it sorted :)
Any ways to color weapon's world models? ply:GetActiveWeapon():SetColor( Color( 255, 255, 255, 0 ) ) does nothing either clientside or serverside. Many thanks, even if the simple answer is "no".
[url]http://wiki.garrysmod.com/page/Classes/Entity/SetRenderMode[/url] [editline]5th December 2012[/editline] [lua]objEnt:SetRenderMode( RENDERMODE_TRANSALPHA ); -- before setting the color[/lua]
[QUOTE=CrashLemon;38719878]Any ways to color weapon's world models? ply:GetActiveWeapon():SetColor( Color( 255, 255, 255, 0 ) ) does nothing either clientside or serverside. Many thanks, even if the simple answer is "no".[/QUOTE] weapon:SetWeaponColor( Vector ) This takes a vector as input, so Vector( r / 255, g / 255, b / 255 ) Edit: Only works on some weapons, such as physgun.
[QUOTE=Banana Lord.;38720082][URL]http://wiki.garrysmod.com/page/Classes/Entity/SetRenderMode[/URL] [editline]5th December 2012[/editline] objEnt:SetRenderMode( RENDERMODE_TRANSALPHA ); -- before setting the color[/QUOTE] [lua] -- Set our viewmodel color self:GetViewModel():SetColor( self.viewModelColor ) self:GetViewModel():SetRenderMode( RENDERMODE_TRANSALPHA ) if self:GetActiveWeapon() and self:Alive() then self:GetActiveWeapon():SetRenderMode( RENDERMODE_TRANSALPHA ) self:GetActiveWeapon():SetColor( self.viewModelColor ) end[/lua] That's what I had clientside and serverside is pretty much the same without the ViewModel(), any other ideas?
How do I add an image onto the screen that loops? for example, I want the whole screen to be snowing, but actually the map isn't snowing, its just an image that has snow falling.
I am looking for a script which draws motionblur around your screen when you are sprinting. I tried several things without luck :| Could anybody provide this please? Thanks! :D
[QUOTE=TheTrueAndy;38712072]I need to reproduce SetModelScale()[/QUOTE] This is as close as I ever got it. [lua] local meta = FindMetaTable("Entity") if not meta then return end function meta:SetModelScaleVector(vec) if self:GetBoneCount() > 1 then local scale if type(vec) == "number" then scale = vec else scale = math.min(vec.x, vec.y, vec.z) end self._ModelScale = Vector(scale, scale, scale) self:SetModelScale(scale, 0) else if type(vec) == "number" then vec = Vector(vec, vec, vec) end self._ModelScale = vec local m = Matrix() m:Scale(vec) self:EnableMatrix("RenderMultiply", m) end end function meta:GetModelScaleVector() return self._ModelScale or Vector(1, 1, 1) end [/lua]
Hi. I'm working on an inventory system for DarkRp. It's almost done. The only thing missing is a way to save the inventory data and I want to use the Gmod sql database to do this. Here's my question: [IMG]https://photos-1.dropbox.com/t/0/AACpi-YXxRWfEwLMRiClM3IZ74t8w0mNpD6Nu6TLY9_hCQ/10/122278602/png/320x320/1/_/0/4/ScreenShot009.png/qul5ng4s0wtoih5/AzWYYT92OC/ScreenShot009.png[/IMG] This table structure doesn't feel right to me, but I can't come up with a better one. How would you do it, or is this ok?
[QUOTE=itkuitkzhji;38722313]Hi. I'm working on an inventory system for DarkRp. It's almost done. The only thing missing is a way to save the inventory data and I want to use the Gmod sql database to do this. Here's my question: [IMG]https://photos-1.dropbox.com/t/0/AACpi-YXxRWfEwLMRiClM3IZ74t8w0mNpD6Nu6TLY9_hCQ/10/122278602/png/320x320/1/_/0/4/ScreenShot009.png/qul5ng4s0wtoih5/AzWYYT92OC/ScreenShot009.png[/IMG] This table structure doesn't feel right to me, but I can't come up with a better one. How would you do it, or is this ok?[/QUOTE] [img]http://i46.tinypic.com/2rfvle8.gif[/img] 1) pull the player's information from the database, searching by his SteamID, in playerinitial spawn 2) if he isn't in the database, insert him and fetch his new ID 3) set his player ID 4) use his player ID instead of his SteamID when selecting/inserting/updating the database
Sorry, you need to Log In to post a reply to this thread.