• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=MPan1;52872331]* With brackets at the end because it's a function [CODE] dModelPanel:GetModel():GetRenderBounds() [/CODE][/QUOTE] [CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index global 'dModelPanel' (a nil value) 1. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 2. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 3. GenerateJobsTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:636 4. Init - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:30 5. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37 6. Call - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:802 7. unknown - addons/darkrpmodification-master/lua/darkrp_modules/base/cl_gamemode_functions.lua:46[/CODE] tried self.dModelPanel:GetModel():GetRenderBounds() aswell and [CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index a string value with bad key ('GetRenderBounds' is not part of the string library) 1. error - [C]:-1 2. __index - lua/includes/extensions/string.lua:297 3. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 4. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 5. GenerateJobsTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:636 6. Init - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:30 7. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37 8. Call - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:802 9. unknown - addons/darkrpmodification-master/lua/darkrp_modules/base/cl_gamemode_functions.lua:46[/CODE]
[QUOTE=lubatron;52872336]errors[/QUOTE] Those are weird errors. It now says dModelPanel is nil, but the last error said GetModel was a function, so dModelPanel can't be nil or that function wouldn't even exist. I don't know anything about DarkRP so I probably shouldn't have commented in the first place
[QUOTE=MPan1;52872347]Those are weird errors. It now says dModelPanel is nil, but the last error said GetModel was a function, so dModelPanel can't be nil or that function wouldn't even exist. I don't know anything about DarkRP so I probably shouldn't have commented in the first place[/QUOTE] I set it back to the original code and whenever other players press f4 they get this: [CODE][ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:138: bad argument #1 to 'GetBonePosition' (number expected, got no value) 1. GetBonePosition - [C]:-1 2. LookAtBone - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:138 3. GenerateJobsTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:690 4. Init - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:30 5. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37 6. Call - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:802 7. unknown - addons/darkrpmodification-master/lua/darkrp_modules/base/cl_gamemode_functions.lua:46[/CODE] if you still no idea then that's fine, it probably mostly has to do more with this script alone than darkrp so its all good. LeafLicker: I only get stuck in it when I press f4 twice lubatron ~ CJA: weird LeafLicker: Its because when I press f4 again it opens another instead of closing it LeafLicker: So I have to press f3 and close them [CODE]function PANEL:LookAtBone( bone, fallBackX, fallBackY, fallBackZ ) local fBackX, fBackY, fBackZ = fallBackX or 30, fallBackY or 10, fallBackZ or 75 local bonePos = self.dModelPanel.Entity:GetBonePosition( self.dModelPanel.Entity:LookupBone( bone ) ) if ( bonePos ) then self.dModelPanel:SetLookAt( bonePos ) else self.dModelPanel:SetCamPos( Vector( fBackX, fBackY, fBackZ ) ) end end [/CODE]
In a panel I'm trying to get the text value of self.text but in the self.send.DoClick function it returns: [CODE] [ERROR] gamemodes/thing/plugins/discord/derma/cl_discordmenu.lua:24: attempt to index field 'text' (a nil value) 1. DoClick - gamemodes/legionroleplay/plugins/discord/derma/cl_mfactionmenu.lua:24 2. unknown - lua/vgui/dlabel.lua:232 [/CODE] Here's the code, I'm pretty sure it's a simple solution and people have done this all the time, I'm just not sure what it is though: [CODE] self.text = self:Add("DTextEntry") self.text:Dock(BOTTOM) self.text:SetSize(0,15) self.send = self:Add("DButton") self.send:Dock(BOTTOM) self.send:SetSize(0,15) self.send:SetText("Send") self.send.DoClick = function(self) net.Start("nut_discordsay") words = self.text:GetValue() --This doesn't work net.WriteString(words) net.SendToServer() end [/CODE]
[QUOTE=pilot;52875839]blah blah[/QUOTE] [code]self.text = self:Add( "DTextEntry" ) self.text:Dock( BOTTOM ) self.text:SetSize( 0, 15 ) self.send = self:Add( "DButton" ) self.send:Dock( BOTTOM ) self.send:SetSize( 0, 15 ) self.send:SetText( "Send" ) function self.send:DoClick() net.Start("nut_discordsay") -- local words = self.text:GetValue() won't work, since self.send.text doesn't exist. local words = self.text:GetParent().text:GetValue() -- Kind of a shit workaround but w/e net.WriteString( words ) net.SendToServer() end [/code]
[QUOTE=Koolaidmini;52875903][code]self.text = self:Add( "DTextEntry" ) self.text:Dock( BOTTOM ) self.text:SetSize( 0, 15 ) self.send = self:Add( "DButton" ) self.send:Dock( BOTTOM ) self.send:SetSize( 0, 15 ) self.send:SetText( "Send" ) function self.send:DoClick() net.Start("nut_discordsay") -- local words = self.text:GetValue() won't work, since self.send.text doesn't exist. local words = self.text:GetParent().text:GetValue() -- Kind of a shit workaround but w/e net.WriteString( words ) net.SendToServer() end [/code][/QUOTE] Or just don't mask the 'self' parameter [lua] self.text = self:Add("DTextEntry") self.text:Dock(BOTTOM) self.text:SetSize(0,15) self.send = self:Add("DButton") self.send:Dock(BOTTOM) self.send:SetSize(0,15) self.send:SetText("Send") self.send.DoClick = function(this) net.Start("nut_discordsay") net.WriteString(self.text:GetValue()) net.SendToServer() end [/lua]
[IMG]https://i.imgur.com/Ey8KR1J.png[/IMG] How exactly do I make a bad key apart of the string library, it's not associated with any current string i know of but, am i supposed to create a string for it? [CODE]local function ClientRequestSkillTables( len, ply ) if ( ply.receivedSkillTables ) then return end ply.receivedSkillTables = true ply:RetrieveSkill( NOOB_SKILL_MINING, "MiningXP" ) ply:RetrieveSkill( NOOB_SKILL_COP, "PoliceXP" ) ply:RetrieveSkill( NOOB_SKILL_RUNNING, "RunningXP" ) ply:RetrieveSkill( NOOB_SKILL_CRIMINAL, "CriminalXP" ) ply:RetrieveSkill( NOOB_SKILL_PRINTING, "PrintingXP" ) ply:RetrieveSkill( NOOB_SKILL_ENDURANCE, "EnduranceXP", function( ) if not ( ply.retrievedBonusHealth ) then timer.Simple( 1, function( ) ply:ApplyBonusHealth( 100 ) ply.retrievedBonusHealth = true end ) end end ) end net.Receive( "N00BRP_PlayerSkill_Net", ClientRequestSkillTables )[/CODE]
[QUOTE=lubatron;52876433]:snip:[/QUOTE] First of, which line is 28 in sv_skillhooks? Now, the error its giving out is that for some reason it's trying to index a string value with retrievedBonusHealth, resulting in something like this: [CODE]"hello".retrievedBonusHealth[/CODE] so it's thinking that you're trying to call a function from the String library, as string:sub or others like that. Now, the problem in here is that for some reason, something seems like it's changing the ply variable for a string. It seems odd tho, I see no code in there that modifies the ply variable.
[QUOTE=geferon;52876528]First of, which line is 28 in sv_skillhooks? Now, the error its giving out is that for some reason it's trying to index a string value with retrievedBonusHealth, resulting in something like this: [CODE]"hello".retrievedBonusHealth[/CODE] so it's thinking that you're trying to call a function from the String library, as string:sub or others like that. Now, the problem in here is that for some reason, something seems like it's changing the ply variable for a string. It seems odd tho, I see no code in there that modifies the ply variable.[/QUOTE] From the error message: [url]https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/modules/concommand.lua#L54[/url] He's adding ClientRequestSkillTables() as a concommand, somewhere.
-snip-
[QUOTE=lubatron;52872336][CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index global 'dModelPanel' (a nil value) 1. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 2. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 3. GenerateJobsTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:636 4. Init - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:30 5. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37 6. Call - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:802 7. unknown - addons/darkrpmodification-master/lua/darkrp_modules/base/cl_gamemode_functions.lua:46[/CODE] tried self.dModelPanel:GetModel():GetRenderBounds() aswell and [CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index a string value with bad key ('GetRenderBounds' is not part of the string library) 1. error - [C]:-1 2. __index - lua/includes/extensions/string.lua:297 3. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 4. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 5. GenerateJobsTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:636 6. Init - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:30 7. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37 8. Call - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:802 9. unknown - addons/darkrpmodification-master/lua/darkrp_modules/base/cl_gamemode_functions.lua:46[/CODE][/QUOTE] Try [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DModelPanel/GetEntity]DModelPanel:GetEntity[/url]: [lua]self.dModelPanel:GetEntity():GetRenderBounds()[/lua]
[QUOTE=Luni;52877019]From the error message: [url]https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/modules/concommand.lua#L54[/url] He's adding ClientRequestSkillTables() as a concommand, somewhere.[/QUOTE] Yeah I had to add a concommand a few other things because originally, the skillmenu wouldn't pop up or give me any error when I did type the actual command for it. [CODE]concommand.Add( "noob_toggleskillsmenu", ClientRequestSkillTables ) local function OpenSkillMenu( ply, args ) ply:ConCommand( "noob_toggleskillsmenu" ) end DarkRP.defineChatCommand( "skillmenu", OpenSkillMenu )[/CODE] I might have did it wrong. [editline]11th November 2017[/editline] [QUOTE=NeatNit;52878168]Try [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DModelPanel/GetEntity]DModelPanel:GetEntity[/url]: [lua]self.dModelPanel:GetEntity():GetRenderBounds()[/lua][/QUOTE] The f4menu works but whenever I turn gun dealer and view the entities tab I get this: [CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index a nil value 1. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 2. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 3. GenerateEntityAndMiscTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:586 4. unknown - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:68 [PAC3] Requesting outfits... [/CODE] [CODE]function PANEL:CalculateModelView( x, y, z, div ) local xMult, yMult, zMult = x or 0.75, y or 0.75, z or 0.5 local boundsDiv = div or 2 local renderMins, renderMaxs = self.dModelPanel:GetEntity():GetRenderBounds( ) self.dModelPanel:SetCamPos( renderMins:Distance( renderMaxs ) * Vector( xMult, yMult, zMult ) ) self.dModelPanel:SetLookAt( ( renderMaxs + renderMins ) / boundsDiv ) end[/CODE]
[QUOTE=lubatron;52878223]Yeah I had to add a concommand a few other things because originally, the skillmenu wouldn't pop up or give me any error when I did type the actual command for it. [CODE]concommand.Add( "noob_toggleskillsmenu", ClientRequestSkillTables ) local function OpenSkillMenu( ply, args ) ply:ConCommand( "noob_toggleskillsmenu" ) end DarkRP.defineChatCommand( "skillmenu", OpenSkillMenu )[/CODE] I might have did it wrong.[/quote]A concommand function has different parameters from net.Receive. You can't just add the same function to both. [QUOTE=lubatron;52878223]The f4menu works but whenever I turn gun dealer and view the entities tab I get this: [CODE] [ERROR] addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131: attempt to index a nil value 1. CalculateModelView - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:131 2. LoadModel - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_modelpanelplus.lua:85 3. GenerateEntityAndMiscTab - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:586 4. unknown - addons/darkrpmodification-master/lua/darkrp_modules/noobvgui/cl_customf4menu.lua:68 [PAC3] Requesting outfits... [/CODE] [CODE]function PANEL:CalculateModelView( x, y, z, div ) local xMult, yMult, zMult = x or 0.75, y or 0.75, z or 0.5 local boundsDiv = div or 2 local renderMins, renderMaxs = self.dModelPanel:GetEntity():GetRenderBounds( ) self.dModelPanel:SetCamPos( renderMins:Distance( renderMaxs ) * Vector( xMult, yMult, zMult ) ) self.dModelPanel:SetLookAt( ( renderMaxs + renderMins ) / boundsDiv ) end[/CODE][/QUOTE] Which line is 131?
[QUOTE=NeatNit;52878868]A concommand function has different parameters from net.Receive. You can't just add the same function to both. Which line is 131?[/QUOTE] Oh sorry, it's the same line. [CODE]local renderMins, renderMaxs = self.dModelPanel:GetEntity():GetRenderBounds( )[/CODE]
how i could play music to all players on concommand i already know how to make command
[QUOTE=RasmusG5;52879197]how i could play music to all players on concommand i already know how to make command[/QUOTE] sound.PlayURL or sound.PlayFile
Is there a set viewmodel FOV function? I'm pretty certain there is but I can't find it. I know there's a CVAR for it but I was pretty sure sweps could have their own unique viewmodel fov as well edit: Nevermind it was a swep variable called SWEP.ViewModelFOV
[url]https://steamuserimages-a.akamaihd.net/ugc/853857709348254863/60CD2276190F48BFB23012BE78EE04CD721EFE6B/[/url] Im making an infinite terrain addon but for some reason this odd texture shows up around the 0,0,0 chunk, no clue why. Anybody know what it is?
[QUOTE=TNT3530;52881881][url]https://steamuserimages-a.akamaihd.net/ugc/853857709348254863/60CD2276190F48BFB23012BE78EE04CD721EFE6B/[/url] Im making an infinite terrain addon but for some reason this odd texture shows up around the 0,0,0 chunk, no clue why. Anybody know what it is?[/QUOTE] Not exactly sure what the entity is but I can tell you that it looks an awful lot like a stretched out version of the skybox texture.
[QUOTE=YourStalker;52881890]Not exactly sure what the entity is but I can tell you that it looks an awful lot like a stretched out version of the skybox texture.[/QUOTE] Is there any way to disable the skybox completely? The texture isnt solid or anything either, its just around the what would be end of the map
[QUOTE=TNT3530;52881898]Is there any way to disable the skybox completely? The texture isnt solid or anything either, its just around the what would be end of the map[/QUOTE] Maybe return something in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PreDrawSkyBox]GM:PreDrawSkyBox[/url]?
[QUOTE=MPan1;52881951]Maybe return something in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PreDrawSkyBox]GM:PreDrawSkyBox[/url]?[/QUOTE] returning false in that hook didnt fix it
[QUOTE=TNT3530;52881881][url]https://steamuserimages-a.akamaihd.net/ugc/853857709348254863/60CD2276190F48BFB23012BE78EE04CD721EFE6B/[/url] Im making an infinite terrain addon but for some reason this odd texture shows up around the 0,0,0 chunk, no clue why. Anybody know what it is?[/QUOTE] I've been working on something similar, I've seen that when i've re-rendered the world entity. The way i've gotten around it is to use an entity with a mesh for the ground and make sure not to draw the world, also I disabled collisions with the world for everything. I'm currently stuck on getting an entity to collide properly in the next cell when it's half in and half out of a cell. Good luck with your's, if anyone get's this working good it'll be cool.
[QUOTE=TNT3530;52881959]returning false in that hook didnt fix it[/QUOTE] Returning true should. However, you should use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/Clear]render.Clear[/url] before doing so, otherwise those pixels will retain whatever color they had in the previous frame. No harm in trying without it to see what I mean.
Anyone experienced in rendering things outside the skybox with stencils? Im trying to have the player spawn outside the map and be surrounded by "walls". But whenever I draw a quad its clipped halfway im not sure what the problem is this is my first try at using stencils. I took out the code drawing the floors of the room as that worked. [code] --CREDIT to MDave function render.SetStencilOperator(compare, pass, fail, zfail) render.SetStencilCompareFunction(compare) render.SetStencilPassOperation(pass or STENCIL_KEEP) render.SetStencilFailOperation(fail or STENCIL_KEEP) render.SetStencilZFailOperation(zfail or fail or STENCIL_KEEP) end hook.Add("PreDrawOpaqueRenderables", "roomCreation", function() local pos = LocalPlayer():GetPos() render.SetStencilEnable(true) render.ClearStencil() render.SetStencilTestMask(255) render.SetStencilWriteMask(255) render.SetStencilReferenceValue(1) render.SetStencilOperator(STENCIL_ALWAYS, STENCIL_REPLACE) local ext = Vector(1000, 1000, 0.1) --Draw a big ass box to render the "room" ? render.DrawBox(pos, Angle(0,0,0), -ext, ext, Color(0, 255, 0), true) render.SetStencilReferenceValue(1) render.SetStencilOperator(STENCIL_EQUAL) render.SuppressEngineLighting(true) render.SetMaterial(PLASTIC2) local num = 64 pos = LocalPlayer():GetPos() + Vector(0,(64*2) * 2,num/2) render.DrawQuad(pos + Vector(-num, 0, num), pos + Vector(num, 0, num), pos + Vector(num, 0, -num), pos + Vector(-num, 0, -num)) pos = LocalPlayer():GetPos() + Vector(0,(64*2) * 2,num*2) render.DrawQuad(pos + Vector(-num, 0, num), pos + Vector(num, 0, num), pos + Vector(num, 0, -num), pos + Vector(-num, 0, -num)) render.SuppressEngineLighting(false) render.ClearStencil() render.SetStencilEnable(false) end) [/code]
I'm trying to make a swep capable of reloading even if it has a full magazine already. (If someone knows how to force a reload even with a full mag, please let me know because it will make all my problems go away) I'm doing this by doing self:SendWeaponAnim( ACT_VM_RELOAD ) which works very well about 50% of the time. The other 50% the animation plays for like 4 frames of animation before toggling to idle abruptly. I've tried doing things like sending ACT_VM_IDLE just before reloading, as well as waiting in a timer for a very small time after sending idle before reloading and neither seemed to work. If anyone has any ideas I would love to hear them. [code]function SWEP:Reload() if not IsFirstTimePredicted() then return end //Prevents reloading while reloading if self.reloadLock then return end if( self:Clip1() >= self:GetMaxClip1() or self:Clip1() == 0 ) then self.reloadLock = true local seq = self:LookupSequence( "reload" ) local dur = self:SequenceDuration( seq ) self:SetNextPrimaryFire( CurTime() + dur ) timer.Simple( dur, function() if not IsValid( self ) then return end self.reloadLock = nil //Interface with renegade hud to show ammo count timerLen = 5 timer.Create( "RenHUDAmmoSideTimer", timerLen, 1, function() end) end ) if CLIENT then self:SendWeaponAnim( ACT_VM_RELOAD ) end else self:DefaultReload( ACT_VM_RELOAD ) end self:EmitSound( "rifl/rifle_reload.wav", _, _, _, CHAN_WEAPON ) end[/code]
Anyone know how to add attachments to a DModelPanel? I'm trying to do it by doing ents.Create("prop_dynamic") and attaching it to the DModelPanel entity, but ents.Create doesn't seem to be something that works in DModelPanel
[QUOTE=NeatNit;52878868]A concommand function has different parameters from net.Receive. You can't just add the same function to both. [/QUOTE] So it does seem a concommand exists(i think) does ply:ConCommand create a new concommand or does it link to concommand.Add? typing noob_toggleskillsmenu in console leads to nothing opening, I feel like the openskillmenu function might be missing something, either that or noob_toggleskillsmenu needs to link to something. [CODE]util.AddNetworkString( "N00BRP_PlayerSkill_Net" ) -- Important Enums NOOB_SKILL_MINING = "darkrp_miningxp" NOOB_SKILL_COP = "darkrp_policexp" NOOB_SKILL_RUNNING = "darkrp_runningxp" NOOB_SKILL_CRIMINAL = "darkrp_criminalxp" NOOB_SKILL_PRINTING = "darkrp_printingxp" NOOB_SKILL_ENDURANCE = "darkrp_endurancexp" NOOB_SKILLFUNCTIONS = NOOB_SKILLFUNCTIONS or { } NOOB_SKILLFUNCTIONS[NOOB_SKILL_MINING] = NOOBRP_SkillAlgorithms.CalculateMining NOOB_SKILLFUNCTIONS[NOOB_SKILL_COP] = NOOBRP_SkillAlgorithms.CalculatePolice NOOB_SKILLFUNCTIONS[NOOB_SKILL_RUNNING] = NOOBRP_SkillAlgorithms.CalculateRunning NOOB_SKILLFUNCTIONS[NOOB_SKILL_CRIMINAL] = NOOBRP_SkillAlgorithms.CalculateCriminal NOOB_SKILLFUNCTIONS[NOOB_SKILL_PRINTING] = NOOBRP_SkillAlgorithms.CalculatePrinting NOOB_SKILLFUNCTIONS[NOOB_SKILL_ENDURANCE] = NOOBRP_SkillAlgorithms.CalculateEndurance NOOB_SKILLCAPES = NOOB_SKILLCAPES or { } NOOB_SKILLCAPES[NOOB_SKILL_MINING] = "mining_skill_cape" NOOB_SKILLCAPES[NOOB_SKILL_COP] = "police_skill_cape" NOOB_SKILLCAPES[NOOB_SKILL_RUNNING] = "running_skill_cape" NOOB_SKILLCAPES[NOOB_SKILL_CRIMINAL] = "criminal_skill_cape" NOOB_SKILLCAPES[NOOB_SKILL_PRINTING] = "printing_skill_cape" local enduranceBoost = 5 local function ClientRequestSkillTables( len, ply ) if ( ply.receivedSkillTables ) then return end ply.receivedSkillTables = true ply:RetrieveSkill( NOOB_SKILL_MINING, "MiningXP" ) ply:RetrieveSkill( NOOB_SKILL_COP, "PoliceXP" ) ply:RetrieveSkill( NOOB_SKILL_RUNNING, "RunningXP" ) ply:RetrieveSkill( NOOB_SKILL_CRIMINAL, "CriminalXP" ) ply:RetrieveSkill( NOOB_SKILL_PRINTING, "PrintingXP" ) ply:RetrieveSkill( NOOB_SKILL_ENDURANCE, "EnduranceXP", function( ) if not ( ply.retrievedBonusHealth ) then timer.Simple( 1, function( ) ply:ApplyBonusHealth( 100 ) ply.retrievedBonusHealth = true end ) end end ) end net.Receive( "N00BRP_PlayerSkill_Net", ClientRequestSkillTables ) local function TriggerRunningXPGain( ply, keyCode ) if ( keyCode == IN_FORWARD and !ply:InVehicle( ) and ply:GetObserverMode( ) == OBS_MODE_NONE ) then ply.runningStartTime = ply.runningStartTime or 0 if ( ply.runningStartTime == 0 ) then ply.runningStartTime = CurTime( ) end end end hook.Add( "KeyPress", "N00BRP_TriggerRunningXPGain_KeyPress", TriggerRunningXPGain ) local function GiveRunningXPGain( ply, keyCode ) if ( keyCode == IN_FORWARD ) then //if ( ply:getDarkRPVar( "IsGhost" ) ) then if ( ply:IsGhost( ) ) then ply.runningStartTime = 0 return end if ( ply.runningStartTime and ply.runningStartTime ~= 0 and !ply.IsInVehicle ) then local xpGain = math.Round( ( CurTime( ) - ply.runningStartTime ) * 4 ) ply.runningStartTime = 0 ply:RewardXP( xpGain, NOOB_SKILL_RUNNING, "RunningXP", "Running", false ) end end end hook.Add( "KeyRelease", "N00BRP_TriggerRunningXPGain_KeyReleased", GiveRunningXPGain ) local function BeginEnduranceTimer( ply ) if ( ply:IsBot( ) ) then return end local entIndex = ply:EntIndex( ) timer.Create( entIndex .. ":EnduranceGainTimer", 60, 0, function( ) if not ( IsValid( ply ) ) then timer.Destroy( entIndex .. ":EnduranceGainTimer" ) return end if not ( ply:getDarkRPVar( "EnduranceXP" ) ) then return end ply:RewardXP( 1, NOOB_SKILL_ENDURANCE, "EnduranceXP", "Endurance", false ) end ) local itemDropInterval = SVNOOB_VARS:Get( "ItemDropInterval", true, "number", 300 ) timer.Create( entIndex .. ":ItemDropTimer", itemDropInterval, 0, function( ) if not ( IsValid( ply ) ) then timer.Destroy( entIndex .. ":ItemDropTimer" ) return end ply:RollForItemDrop( ) end ) end hook.Add( "NOOBRP_OnRequestData", "N00BRP_BeginEnduranceTimer_OnRequestData", BeginEnduranceTimer ) local function OpenSkillMenu( ply, args ) ply:ConCommand( "noob_toggleskillsmenu" ) end DarkRP.defineChatCommand( "skillmenu", OpenSkillMenu )[/CODE]
So I am making a smart munition that detects targets in front of it using a cone but I am having a problem fine tweaking it because I can't visually see the cone. Does anyone have a debug function to draw a cone over FindInCone?
[QUOTE=residualgrub;52889917]So I am making a smart munition that detects targets in front of it using a cone but I am having a problem fine tweaking it because I can't visually see the cone. Does anyone have a debug function to draw a cone over FindInCone?[/QUOTE] The [url=http://wiki.garrysmod.com/page/Category:debugoverlay]debugoverlay[/url] library can be used to draw stuff like this on the screen without having to fuck around with render hooks. It has no built-in cone shape, but you can approximate it with the existing shapes (box/triangles).
Sorry, you need to Log In to post a reply to this thread.