• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
Last time I checked, poster is a console command in vanilla gmod. :smile: [editline]12th February 2015[/editline] Just have it run the console command on the client!
Okay so I am not a super hero at this but could you guys give me some help? So I am trying to create a ulx module that allows me to open the motd on a player but with a special url instead of the standard one. Not sure how to do that yet so just using gui for now. So the problem I am having is that is says I an trying to use a null value. [CODE] [ERROR] LuaCmd:1: attempt to concatenate global 'rulenum' (a nil value) 1. unknown - LuaCmd:1 [/CODE] Any help would be appreciated. If you could let me know why it says the number is null while also letting me know how to do showMotd with a special url rather than standard one that would be AMAZINGGGGG Also this code could prob be done cleaner so feel free to tell me. [CODE] function ulx.rule( calling_ply, target_plys, rulenum ) local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] if rulenum > 0 then v:SendLua([[gui.OpenURL("http://www.vdempire.ca/rules.html?rule=" .. rulenum)]]) table.insert( affected_plys, v) else v:SendLua([[gui.OpenURL("http://www.vdempire.ca/rules.html")]]) table.insert( affected_plys, v ) end end if rulenum > 0 then ulx.fancyLogAdmin( calling_ply, "#A opened rule #i on #T ", affected_plys, rulenum ) else ulx.fancyLogAdmin( calling_ply, "#A opened the rules on #T ", affected_plys ) end end local rule = ulx.command( CATEGORY_NAME, "ulx rule", ulx.rule, "!rule" ) rule:addParam{ type=ULib.cmds.PlayersArg } rule:addParam{ type=ULib.cmds.NumArg, min=0, max=20, default=0, hint="rule #", ULib.cmds.optional, ULib.cmds.round } rule:defaultAccess( ULib.ACCESS_ADMIN ) rule:help( "Open a specific rule on a player." ) [/CODE]
How do I bind a button to my menu, it an addon.
[QUOTE=Monoleg;47125167]How do I bind a button to my menu, it an addon.[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/IsKeyDown]input.IsKeyDown[/url]
[QUOTE=StrangerDang;47125002]Okay so I am not a super hero at this but could you guys give me some help? So I am trying to create a ulx module that allows me to open the motd on a player but with a special url instead of the standard one. Not sure how to do that yet so just using gui for now. So the problem I am having is that is says I an trying to use a null value. [CODE] [ERROR] LuaCmd:1: attempt to concatenate global 'rulenum' (a nil value) 1. unknown - LuaCmd:1 [/CODE] Any help would be appreciated. If you could let me know why it says the number is null while also letting me know how to do showMotd with a special url rather than standard one that would be AMAZINGGGGG Also this code could prob be done cleaner so feel free to tell me. [CODE] -- code [/CODE][/QUOTE] The error is pretty self explanatory, rulenum is nil. [editline]12th February 2015[/editline] change: [lua]v:SendLua([[gui.OpenURL("http://www.vdempire.ca/rules.html?rule=" .. rulenum)]])[/lua] to: [lua]v:SendLua([[gui.OpenURL("http://www.vdempire.ca/rules.html?rule=]] .. rulenum .. [[")]])[/lua]
[QUOTE=bran92don;47124732]I feel like I am misunderstanding what order to place the points in for surface.polygon. I am trying to make a angled bar that needs to decrease along with the players health. [IMG]http://i.gyazo.com/ccba5855c72f06c3ae212c6f4da83820.png[/IMG] [lua] local hpp = 100/100 local hadd = -30 local c = 10 local ang = math.rad( -70 ) local b = math.sin( ang )*c local a = math.cos( ang )*c local xp = ScrW()-300 local yp = ScrH()-200 local triangle = { { x = xp, y = yp }, { x = (xp+250)*hpp, y = (yp+30)*hpp }, { x = (xp+250+b)*hpp, y = (yp+40+a)*hpp }, { x = xp+b, y = yp+10+a }, } [/lua][/QUOTE] Are you just trying to angle the ends, or make it rise / fall? With poly it's simply connect the dots without allowing the lines to cross. Here's an example of a simple angled bar ( using easy input of x, y, w, h and tilt-shift amount ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/poly/tilted_rectangle_poly_as_health_meter.lua.html[/url] Try to simplify what you're trying to do and make helper-functions.
[QUOTE=Hoffa1337;47124819]is there any way to make constraint.Axis behave more linear? Right now it's flimsy as fuck and bends in different directions if you apply some force and I just want the axis to rotate around its set axis without bending :pwn: Increasing the weight is a really bad solution as its for my airplanes. more weight = i need more lift to take off = weirder physics.. My "flight model" is not designed to accommodate wheels that are as heavy as the plane......[/QUOTE] Increasing the physics iterations will make your constraints more stable, but the current vphysics model has always been more or less elastic. In sandbox I always solved this issue by creating the wheels at a LOWER state than where they would be when they were under pressure, so when the vehicle came bearing down on them they would move to their real position.
[QUOTE=bobbleheadbob;47126049]Increasing the physics iterations will make your constraints more stable, but the current vphysics model has always been more or less elastic. In sandbox I always solved this issue by creating the wheels at a LOWER state than where they would be when they were under pressure, so when the vehicle came bearing down on them they would move to their real position.[/QUOTE] Kinda what happens right now, my main problem is the camber. This is pretty much what working with constraint.Axis in Gmod is like: [t]http://i1102.photobucket.com/albums/g456/fixbroke/2012-06%20Camber%20slotting%20struts/camber.jpg[/t]
What's the most efficient way of using Entity:WaterLevel() to check if a player is underwater, there's got to be a better way than throwing it in a timer and checking it for every player every few seconds.
[QUOTE=Aethi;47125212][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/IsKeyDown]input.IsKeyDown[/url][/QUOTE] Thanks you.
How would I disable the player from being able to +attack and +attack2 (or just not be able to click) I cannot use :Freeze() cause I need the player to be able to be shot etc. (this is for clientside btw)
[QUOTE=Computer600;47127722]How would I disable the player from being able to +attack and +attack2 (or just not be able to click) I cannot use :Freeze() cause I need the player to be able to be shot etc. (this is for clientside btw)[/QUOTE] Hook it with PlayerBindPress and return true to stop it.
How do you set the render order for effects/clientside models? [img]http://puu.sh/fPsqB/8b699d5865.jpg[/img] I want the rings to be going around the arrow, but I can't find anything on how to adjust this.
[QUOTE=Feihc;47127931]How do you set the render order for effects/clientside models? [img]http://puu.sh/fPsqB/8b699d5865.jpg[/img] I want the rings to be going around the arrow, but I can't find anything on how to adjust this.[/QUOTE] I actually don't know a whole lot about this, but from what I do know: viewmodels are rendered ignoring the z buffer, so getting anything (barring HUD) to render in front of them is tricky. Try using this hook: [url]http://wiki.garrysmod.com/page/GM/PostDrawViewModel[/url]
[QUOTE=Neat-Nit;47127968]I actually don't know a whole lot about this, but from what I do know: viewmodels are rendered ignoring the z buffer, so getting anything (barring HUD) to render in front of them is tricky. Try using this hook: [url]http://wiki.garrysmod.com/page/GM/PostDrawViewModel[/url][/QUOTE] Yeah that's what I'm noticing, too. I've tried putting the effect into that hook, but it still draws underneath. I think any models drawn in any ViewModel hook ignore Z order no matter what. Even if I call the draw on the clientsidemodel (the arrow itself) before the effect, it still draws on top.
[QUOTE=Feihc;47127984]Yeah that's what I'm noticing, too. I've tried putting the effect into that hook, but it still draws underneath. I think any models drawn in any ViewModel hook ignore Z order no matter what. Even if I call the draw on the clientsidemodel (the arrow itself) before the effect, it still draws on top.[/QUOTE] Your effect needs to also ignore z. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cam/IgnoreZ]cam.IgnoreZ[/url]
So I'm making this Jump Boost thingy for my gamemode, but it runs the code so many times when i press the key. I would like to only make it run once when i press the key. Here's my code: [QUOTE] function KeyPressed (P) if P:KeyPressed(IN_RELOAD) then net.Start( "JumpBuff" ) net.SendToServer() end end hook.Add( "KeyPress", "KeyPressedHook", KeyPressed ) [/QUOTE] I've been trying to many different things, but nothing seems to work. I highly appericiate all your help.
[QUOTE=bobbleheadbob;47128106]Your effect needs to also ignore z. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cam/IgnoreZ]cam.IgnoreZ[/url][/QUOTE] Surrounding my effect with ignorez makes the clientside model flicker in really weird ways - not entirely sure why? Doesn't make sense to me *shrug*
Anyone willing to help me with getting my SWEP to fire the default crossbow bolts? Not really sure how this should be done.
[QUOTE=VIoxtar;47128499]Anyone willing to help me with getting my SWEP to fire the default crossbow bolts? Not really sure how this should be done.[/QUOTE] ents.Create a "crossbow_bolt" set its angles, position and velocity. Make sure to call Wake() on the entities physobject EDIT: you might also need Spawn() and Activate() on the entity
Reposting problem again but in better detail and code [code] local Yaw = (LocalPlayer():EyeAngles().y + 45)/90 --Desired Size of the Material local CurrentSizeX = 152 local CurrentSizeY = 64 --Original Size of the Material local OriginalSizeX = 640 local OriginalSizeY = 64 --U and V local UStart = (CurrentSizeX / OriginalSizeX)*Yaw local VStart = 0 local UEnd = ( CurrentSizeX / OriginalSizeX ) + ((CurrentSizeX / OriginalSizeX)*Yaw) local VEnd = 1 surface.SetMaterial(CompassCord) surface.DrawTexturedRectUV(356,ScrH() - 64, CurrentSizeX, CurrentSizeY, UStart, VStart, UEnd, VEnd ) [/code] It's a moving compass that scrolls based on the yaw angle of the player. There is a stupid jarring transition around the W section of the texture when looking around. I just want to know what I'm doing wrong. This jump is caused by the transition to angle -180 to angle 180 I believe or 359 to 0
[QUOTE=Pandaman09;47128542]ents.Create a "crossbow_bolt" set its angles, position and velocity. Make sure to call Wake() on the entities physobject EDIT: you might also need Spawn() and Activate() on the entity[/QUOTE] Thanks. That's exactly what I had done before minus the wake. That did the trick. <3
Is there a way to add a time to the close button so people are forced to see the popup for say 5 seconds? Also, less important, but is there a way to center the title? Thanks [CODE] ---------------------------------Open rule on player-------------------------------------- function ulx.rule( calling_ply, target_plys, rulenum ) local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] ULib.clientRPC( v, "ulx.showRuleMenu", v:SteamID(), rulenum ) table.insert( affected_plys, v ) end if rulenum == 0 then ulx.fancyLogAdmin( calling_ply, "#A opened the rules on #T ", affected_plys ) else ulx.fancyLogAdmin( calling_ply, "#A opened rule #i on #T ", rulenum, affected_plys ) end end local rule = ulx.command( CATEGORY_NAME, "ulx rule", ulx.rule, "!rule" ) rule:addParam{ type=ULib.cmds.PlayersArg } rule:addParam{ type=ULib.cmds.NumArg, min=0, max=20, default=0, hint="rule #", ULib.cmds.optional, ULib.cmds.round } rule:defaultAccess( ULib.ACCESS_ADMIN ) rule:help( "Open a specific rule on a player." ) function ulx.showRuleMenu( steamid, rulenum ) local window = vgui.Create( "DFrame" ) local url = "http://www.vdempire.ca/rules.html?rule=" .. rulenum if ScrW() > 640 then -- Make it larger if we can. window:SetSize( ScrW()*0.9, ScrH()*0.9 ) else window:SetSize( 640, 480 ) end window:Center() window:SetTitle( "Vader's Rule Box" ) window:SetVisible( true ) window:MakePopup() local html = vgui.Create( "HTML", window ) local button = vgui.Create( "DButton", window ) button:SetText( "Close" ) button.DoClick = function() window:Close() end button:SetSize( 100, 40 ) button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 ) html:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 ) html:SetPos( 10, 30 ) html:OpenURL( url ) end [/CODE]
[QUOTE=Neat-Nit;47124953]Last time I checked, poster is a console command in vanilla gmod. :smile: [editline]12th February 2015[/editline] Just have it run the console command on the client![/QUOTE] That's cool, but I want local versions on the server, and if the client wants to save the photo they could do so after it's taken. [QUOTE=Monoleg;47125167]How do I bind a button to my menu, it an addon.[/QUOTE] Idk if I'm late, but you can make console commands "+mymenu" and "-mymenu", +mymenu spawns the menu, -mymenu closes the menu. The menu would then act like the Q menu, except typing in a text field won't keep it open. Otherwise just make a command named "mymenu" and write it so it toggles said menu. Of course, you can elaborate based on these ideas to do whatever you want, but at this point you would want to bind the command to a key. In-game this would be done by typing into the console "bind [KEY] mymenu" (or of course, I believe you can just send that command to the client's console from LUA)
Why wont my timer get destroy ? [CODE]function ENT:AfterHigh(activator, caller) timer.Create( "RegenTimer"..activator:Nick(), 0.6, 0, function() local HP = activator:Health() if HP < 100 then activator:SetHealth( HP + 1) end end) end local function ResetRegen() for id,pl in pairs( player.GetAll() )do if( pl:GetNetworkedFloat("durgz_regen_high_end") - 0.5 < CurTime() && pl:GetNetworkedFloat("durgz_regen_high_end") > CurTime() )then pl:SetNWBool("Regened", false) timer.Destroy( "RegenTimer"..pl:Nick() ) end end end hook.Add("Think", "durgz_regen_resetregen", ResetRegen)[/CODE]
[QUOTE=WalkingZombie;47129873]That's cool, but I want local versions on the server, and if the client wants to save the photo they could do so after it's taken. Idk if I'm late, but you can make console commands "+mymenu" and "-mymenu", +mymenu spawns the menu, -mymenu closes the menu. The menu would then act like the Q menu, except typing in a text field won't keep it open. Otherwise just make a command named "mymenu" and write it so it toggles said menu. Of course, you can elaborate based on these ideas to do whatever you want, but at this point you would want to bind the command to a key. In-game this would be done by typing into the console "bind [KEY] mymenu" (or of course, I believe you can just send that command to the client's console from LUA)[/QUOTE] Dumb why? Is it not possible to save HUGE local snapshots in server memory? Is it not possible to THEN send them to the client upon demand, to save them as an image? I have reasons why I would want to do that. [editline]13th February 2015[/editline] I suppose the higher image resolution would just be a caviar... so if that's forgotten about, it is then possible to take a snapshot of normal resolution, save that to the server memory, but let the player request it and print it to a file on their own system? [editline]13th February 2015[/editline] [QUOTE=Monoleg;47130071]Why wont my timer get destroy ? [CODE]function ENT:AfterHigh(activator, caller) timer.Create( "RegenTimer"..activator:Nick(), 0.6, 0, function() local HP = activator:Health() if HP < 100 then activator:SetHealth( HP + 1) end end) end local function ResetRegen() for id,pl in pairs( player.GetAll() )do if( pl:GetNetworkedFloat("durgz_regen_high_end") - 0.5 < CurTime() && pl:GetNetworkedFloat("durgz_regen_high_end") > CurTime() )then pl:SetNWBool("Regened", false) timer.Destroy( "RegenTimer"..pl:Nick() ) end end end hook.Add("Think", "durgz_regen_resetregen", ResetRegen)[/CODE][/QUOTE] Debug with some print() functions in each function, for, and if statement. Print the variable too, make sure that whatever you're doing is actually working. Maybe this will help you solve the problem.
Is there a way of setting an outline for a DImage? Or will I have to create custom images with it already there? Also how are you meant to have outlined text with antialiasing in a DLabel? The font outlines don't appear to be smoothed with the rest of the text.
[QUOTE=isnipeu;47131521]Is there a way of setting an outline for a DImage? Or will I have to create custom images with it already there? Also how are you meant to have outlined text with antialiasing in a DLabel? The font outlines don't appear to be smoothed with the rest of the text.[/QUOTE] For the first question, you could just make a DPanel, and draw the image with Mat = Material("img.png") then surface.SetMaterial(Mat) and surface.DrawTexturedRect, then draw the outline on top of that. (The Paint function)
[T]http://puu.sh/fRiwJ.jpg[/T] [CODE] surface.CreateFont("MyFont", { font = "ArchitectsDaughter", size = 30, weight = 500, antialias = true }) surface.SetFont("MyFont") surface.SetTextColor(Color(255, 255, 255)) surface.SetTextPos(5, 0) surface.DrawText("Announcement") [/CODE] [T]http://puu.sh/fRiNb.png[/T] [I]addon/resource/fonts/ArchitectsDaughter.ttf[/I] The font isn't right :( [B]Why?[/B]
[QUOTE=_FR_Starfox64;47131981] [CODE] surface.CreateFont("MyFont", { font = "ArchitectsDaughter", size = 30, weight = 500, antialias = true }) surface.SetFont("MyFont") surface.SetTextColor(Color(255, 255, 255)) surface.SetTextPos(5, 0) surface.DrawText("Announcement") [/CODE] [T]http://puu.sh/fRiNb.png[/T] [I]addon/resource/fonts/ArchitectsDaughter.ttf[/I] The font isn't right :( [B]Why?[/B][/QUOTE] Need exact font name that Windows provides, but you are not showing the full font view window so I cannot personally tell you.
Sorry, you need to Log In to post a reply to this thread.