• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=Avil;48082780]Here is what I am doing, ignore what I said before. [CODE] concommand.Add("_buyammo",function(ply) ply:GiveAmmo(120, ply:GetPrimaryAmmoType(),true) ply:SetPoints(ply:GetPoints() - 500) end) [/CODE] [editline]29th June 2015[/editline] What you said works great thank you~![/QUOTE] Hey there! Before I joined Facepunch I coded some stuff in Gmod Lua, so I figured I might help with something. You see, you could add a simple "if" statement to your code, so that players can't buy ammo if their points are too low. Like this: [lua]concommand.Add("_buyammo",function(ply,cmd,args) if ply:GetPoints() >= 500 then --If we have enough points then if SERVER then ply:Give( "bowie_knife" ) --if you want the player to be given specific weapons depending on what they type after the concommand( like _buyammo "ar2" ) then use ply:Give( args[1] ) ply:SetPoints(ply:GetPoints() - 500) end else --or else(in this case this would be "or else if we don't have enough points") ply:ChatPrint( "You don't have enough points for that weapon! Your points: "..ply:GetPoints()..", required points: 500." ) --print a chat message to our screen telling us how many credits we need and have if we can't afford it end end) [/lua]
[QUOTE=MegaTronJohn;48083031]Hey there! Before I joined Facepunch I coded some stuff in Gmod Lua, so I figured I might help with something. You see, you could add a simple "if" statement to your code, so that players can't buy ammo if their points are too low. Like this: [lua]concommand.Add("_buyammo",function(ply,cmd,args) if ply:GetPoints() >= 500 then --If we have enough points then if SERVER then ply:Give( "bowie_knife" ) --if you want the player to be given specific weapons depending on what they type after the concommand( like _buyammo "ar2" ) then use ply:Give( args[1] ) ply:SetPoints(ply:GetPoints() - 500) end else --or else(in this case this would be "or else if we don't have enough points") ply:ChatPrint( "You don't have enough points for that weapon! Your points: "..ply:GetPoints()..", required points: 500." ) --print a chat message to our screen telling us how many credits we need and have if we can't afford it end end) [/lua][/QUOTE] Thanks alot you're very helpful!
I don't have Photoshop but I would like to create the VGUI icons for some custom TTT weapons. Does anyone have any suggestions for free software that I can easily create the VGUI icons? [url]http://ttt.badking.net/custom-weapon-guide#TOC-Icon[/url]
[QUOTE=PigeonTroll;48083781]I don't have Photoshop but I would like to create the VGUI icons for some custom TTT weapons. Does anyone have any suggestions for free software that I can easily create the VGUI icons? [url]http://ttt.badking.net/custom-weapon-guide#TOC-Icon[/url][/QUOTE] The guide you posted literally tells you how to do it.
[QUOTE=James xX;48083794]The guide you posted literally tells you how to do it.[/QUOTE] [QUOTE=PigeonTroll;48083781]Does anyone have any suggestions for free software that I can easily create the VGUI icons?[/QUOTE] I'm looking for the software itself that I can create it.
[QUOTE=PigeonTroll;48083804]I'm looking for the software itself that I can create it.[/QUOTE] [QUOTE]An alternative is to save as TGA (32 bit, alpha channels enabled), and then use another method of converting that into a VTF. For example, you could import the TGA into VTFEdit and then save as VTF.[/QUOTE] You can also convert TGA to VTF using software provided by the source SDK. There is also a VTF plugin for paint.NET. As I said before, the guide tells you how to do it, but even if you missed that, a quick google search could have revealed what you needed to know. You could also have found a tutorial on the [URL="https://developer.valvesoftware.com/wiki/Creating_a_Material"]valve developer documentation wiki[/URL], which gives you some links to programs you can use.
[QUOTE=James xX;48083837]You can also convert TGA to VTF using software provided by the source SDK. There is also a VTF plugin for paint.NET. As I said before, the guide tells you how to do it, but even if you missed that, a quick google search could have revealed what you needed to know. You could also have found a tutorial on the [URL="https://developer.valvesoftware.com/wiki/Creating_a_Material"]valve developer documentation wiki[/URL], which gives you some links to programs you can use.[/QUOTE] Or you know, he was discreetly asking whether or not to use paint.net or gimp, since he thinks we could give him an opinion of a more common consumer program, rather than a developer tool provided by valve?
Still having trouble getting [url=http://wiki.garrysmod.com/page/ents/FindInCone]ents.FindInCone[/url] to work. I want to check if a player is looking at one specific player. Can someone explain to me exactly how the function works? I'm using player's EyePos for the first argument, EyeAngles for the second. Still not 100% sure how the other two arguments work. [editline]29th June 2015[/editline] Should I be using EyeVector for the normal?
[QUOTE=zeaga;48084494]Still having trouble getting [url=http://wiki.garrysmod.com/page/ents/FindInCone]ents.FindInCone[/url] to work. I want to check if a player is looking at one specific player. Can someone explain to me exactly how the function works? I'm using player's EyePos for the first argument, EyeAngles for the second. Still not 100% sure how the other two arguments work. [editline]29th June 2015[/editline] Should I be using EyeVector for the normal?[/QUOTE] The normal is the direction of the cone, and you should probably use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetEyeTraceNoCursor]Player:GetEyeTraceNoCursor[/url] for that. IE [code]ents.FindInCone( ply:EyePos(), ply:GetEyeTraceNoCursor().Normal, 80, ply:EyeAngles() )[/code] might work? I'm not sure either what the angle of the cone would be in relation to the player's eyes.
[QUOTE=Z0mb1n3;48084578]The normal is the direction of the cone, and you should probably use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetEyeTraceNoCursor]Player:GetEyeTraceNoCursor[/url] for that. IE [code]ents.FindInCone( ply:EyePos(), ply:GetEyeTraceNoCursor().Normal, 80, ply:EyeAngles() )[/code] might work? I'm not sure either what the angle of the cone would be in relation to the player's eyes.[/QUOTE] Thanks! That helps a lot. The angle should be a number, by the way :v: Still very confused about that. Pretty sure it would be redundant anyway since we've got the normal (I think?)
Hi, I'm back. I setup myself a nice scoreboard and I want to use SetAlpha on my DFrame without effecting the buttons that are parented to the frame. How can I do that?
How would I go about loading all the files in a specific folder? Like iterate through a folder and load txt file to a table?
[QUOTE=RedNinja;48085299]How would I go about loading all the files in a specific folder? Like iterate through a folder and load txt file to a table?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Find]file.Find[/url] Loops through the [B]garrysmod/data[/B] folder's .txt files [lua]local files = file.Find("*.txt", "DATA") for k, v in pairs(files) do -- v is the file name end[/lua] I'm not sure what you mean by loading into a table. Do you mean getting the file contents? [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Read]file.Read[/url] Otherwise, if you mean loading like a Lua script, you can use include or CompileFile. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/include]Global.include[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/CompileFile]Global.CompileFile[/url]
[QUOTE=man with hat;48085344][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Find]file.Find[/url] Loops through the [B]garrysmod/data[/B] folder's .txt files [lua]local files = file.Find("*.txt", "DATA") for k, v in pairs(files) do -- v is the file name end[/lua] I'm not sure what you mean by loading into a table. Do you mean getting the file contents? [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Read]file.Read[/url] Otherwise, if you mean loading like a Lua script, you can use include or CompileFile. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/include]Global.include[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/CompileFile]Global.CompileFile[/url][/QUOTE] Cheers
I wish to make a button in Derma that makes the player join a specified IP. It (somewhat) works, however it keeps on stating, that the IP is a bad adress, even though I can connect with it by writing 'connect IP'. [lua] local MButton = vgui.Create("DButton", Frame) MButton:SetText("JOIN MURDER") MButton:SetTextColor(Color(255, 255, 255 )) MButton:SetPos(ScrW() * 0.0325, ScrH() * 0.31) MButton:SetSize(100, 30) MButton.Paint = function(self, w, h) draw.RoundedBox(0, 0, 0, w, h, Color(41, 128, 185, 250)) end MButton.DoClick = function() RunConsoleCommand("connect", '108.61.198.226:27019') end [/lua] The error is: Bad server address ("108.61.198.226:27019") Doing it without quotations doesn't work either.
[QUOTE=Legendahkiin;48089003]I wish to make a button in Derma that makes the player join a specified IP. It (somewhat) works, however it keeps on stating, that the IP is a bad adress, even though I can connect with it by writing 'connect IP'. [lua] local MButton = vgui.Create("DButton", Frame) MButton:SetText("JOIN MURDER") MButton:SetTextColor(Color(255, 255, 255 )) MButton:SetPos(ScrW() * 0.0325, ScrH() * 0.31) MButton:SetSize(100, 30) MButton.Paint = function(self, w, h) draw.RoundedBox(0, 0, 0, w, h, Color(41, 128, 185, 250)) end MButton.DoClick = function() RunConsoleCommand("connect", '108.61.198.226:27019') end [/lua] The error is: Bad server address ("108.61.198.226:27019") Doing it without quotations doesn't work either.[/QUOTE] RunConsoleCommand automatically puts quotes around the arguments to the command. I believe you have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ConCommand]Player:ConCommand[/url] clientside to achieve the effect you desire. For server console commands that get messed up with quotes, use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/game/ConsoleCommand]game.ConsoleCommand[/url].
[QUOTE=Legendahkiin;48089003]I wish to make a button in Derma that makes the player join a specified IP. It (somewhat) works, however it keeps on stating, that the IP is a bad adress, even though I can connect with it by writing 'connect IP'. [lua] local MButton = vgui.Create("DButton", Frame) MButton:SetText("JOIN MURDER") MButton:SetTextColor(Color(255, 255, 255 )) MButton:SetPos(ScrW() * 0.0325, ScrH() * 0.31) MButton:SetSize(100, 30) MButton.Paint = function(self, w, h) draw.RoundedBox(0, 0, 0, w, h, Color(41, 128, 185, 250)) end MButton.DoClick = function() RunConsoleCommand("connect", '108.61.198.226:27019') end [/lua] The error is: Bad server address ("108.61.198.226:27019") Doing it without quotations doesn't work either.[/QUOTE] RunConsoleCommand appends quotes onto the arguments, whereas the connect concommand doesn't utilize arguments, it reads the entire command entered. Try LocalPlayer():ConCommand( "connect...." ) [editline]e[/editline] Damn you!
[QUOTE=James xX;48089163]RunConsoleCommand appends quotes onto the arguments, whereas the connect concommand doesn't utilize arguments, it reads the entire command entered. Try LocalPlayer():ConCommand( "connect...." ) [editline]e[/editline] Damn you![/QUOTE] I was trying with 'Player:ConCommand' before, LocalPlayer works fine. Thanks a lot :)
Does anyone know how RenderScreenspaceEffects works with the tf2 Ubercharge effect? Any help would be great!
Hey, I trying to use this code [CODE] for i,ply in pairs(player.GetAll()) do ClientsideScene( "scenes/breencast/collaboration.vcd", LocalPlayer() ) end [/CODE] I trying to start the scene to all palyers in the server but for some reason its only play it for me. I also tried this : [CODE] for i,ply in pairs(player.GetAll()) do ClientsideScene( "scenes/breencast/collaboration.vcd", ply ) end [/CODE] same problem. Any help with that?
[QUOTE=hanm13;48090590]Hey, I trying to use this code [CODE] for i,ply in pairs(player.GetAll()) do ClientsideScene( "scenes/breencast/collaboration.vcd", LocalPlayer() ) end [/CODE] I trying to start the scene to all palyers in the server but for some reason its only play it for me. I also tried this : [CODE] for i,ply in pairs(player.GetAll()) do ClientsideScene( "scenes/breencast/collaboration.vcd", ply ) end [/CODE] same problem. Any help with that?[/QUOTE] You're running the code on the client, you'll need to broadcast a netmessage to all clients on the server that the clients will then receive. On the client call net.Receive() and put ClientsideScreen("yourscenehere.vcd", LocalPlayer()) into the callback. Take a look at these for more information: [url]http://wiki.garrysmod.com/page/Global/ClientsideScene[/url] [url]http://wiki.garrysmod.com/page/Category:net[/url] [url]http://wiki.garrysmod.com/page/net/Start[/url] [url]http://wiki.garrysmod.com/page/net/Broadcast[/url] [url]http://wiki.garrysmod.com/page/net/Receive[/url] [url]http://wiki.garrysmod.com/page/util/AddNetworkString[/url]
Is there any possible way to make TraceLine ignore ragdolls that are collide-able? Having a problem where using TraceLine gets a ragdoll and screws up a few checks currently could make it ignore any Entity that is prop_ragdoll but I'd also have to make it find what's behind the ragdoll Edit: Totally forgot about using filter but I'm unsure if this would work [code] local filter = function(ent) if ent:GetClass() == "prop_ragdoll" then return false else return owner:GetMeleeFilter() end end local tr = owner:TraceLine(64, MASK_SOLID, filter)[/code]
How can I redesign [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dlistview.lua"]DListView[/URL] and it's [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dlistview_column.lua"]DListView_Column[/URL] in a good way? I tried to make my own panel, based on DListView_Column, then overwrite the DListView AddColumn function to add my own DListView_Column, and tried to use Paint in my DListView_Column panel, but it did absolutely nothing.
Does anyone know how can I replace every word that gets put into DTextEntry with a star(*)? I've tried, string.Replace(), string.SetChar(), basically every string function that could work here but with no luck :(
[QUOTE=Invule;48091134]Does anyone know how can I replace every word that gets put into DTextEntry with a star(*)? I've tried, string.Replace(), string.SetChar(), basically every string function that could work here but with no luck :([/QUOTE] [code] string.gsub(str, '.', '*') [/code] in conjunction with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DTextEntry/OnValueChange]DTextEntry/OnValueChange[/url] and DTextEntry/SetValue. [B]Edit:[/B] Or alternatively, [code] string.rep('*', #str) [/code]
[QUOTE=AK to Spray;48091162][code] string.gsub(str, '.', '*') [/code] in conjunction with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DTextEntry/OnValueChange]DTextEntry/OnValueChange[/url] and DTextEntry/SetValue. [B]Edit:[/B] Or alternatively, [code] string.rep('*', #str) [/code][/QUOTE] Holy shit, thank you.
Any idea why my gamemode will not load entity's/weapons when it is in "garrysmod/addons/addon_folder/gamemodes" but loads fine when it's in "garrysmod/gamemodes"?
Yeah I can't figure out how to get TraceLine to not get ragdolls so far I have this which works somewhat [code]local tr = owner:TraceLine(64, MASK_SOLID, table.Merge( owner:GetMeleeFilter(), ents.FindByClass("prop_ragdoll") ))[/code] GetMeleeFilter returns a table that has the owner, and all players within the players team eg this [code]function meta:GetMeleeFilter() return GAMEMODE.RoundEnded and {self} or team.GetPlayers(self:Team()) end[/code] but once a ragdoll is added to the filters the trace will fail for everything
[QUOTE=ForrestMarkX;48092032]Yeah I can't figure out how to get TraceLine to not get ragdolls[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetClass]Entity:GetClass[/url] [lua] local tr = owner:TraceLine() if !tr.Entity or tr.Entity:GetClass() == "prop_ragdoll" then return end [/lua] You could also use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/IsRagdoll]Entity:IsRagdoll[/url]
[QUOTE=101kl;48092082][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetClass]Entity:GetClass[/url] [lua] local tr = owner:TraceLine() if !tr.Entity or tr.Entity:GetClass() == "prop_ragdoll" then return end [/lua] You could also use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/IsRagdoll]Entity:IsRagdoll[/url][/QUOTE] Hmm would this make it ignore the ragdoll and pass through? Cause ragdolls also can't block the trace. The system this is in is the Hammer for Zombie Survival I want to say have the hammer be able to nail a prop that is behind a ragdoll to the ground
Sorry, you need to Log In to post a reply to this thread.