• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=Deathbypwnage;47779774]Does anyone know of an easy way to check if there is a lockdown in DarkRP? I have this code in lua/autorun/server but it causes this error: [code]Disconnect: Client 0 overflowed reliable channel..[/code] Code: [code] local function funcCallback(CVar, PreviousValue, NewValue) print(CVar.." changed from "..PreviousValue.." to "..NewValue.."!") end cvars.AddChangeCallback("DarkRP_Lockdown", funcCallback) [/code] Any help would be much appreciated! =)[/QUOTE] GetGlobalBool("DarkRP_LockDown")
[QUOTE=meharryp;47779789]GetGlobalBool("DarkRP_LockDown")[/QUOTE] I seem to be getting the same error with this code: [code]if GetGlobalBool("DarkRP_LockDown") == 1 then print("There is a lockdown") end [/code]
[QUOTE=Cushie;47771419]having an annoying problem when testing some of my old hatshop code from late 2012. when the client receives a list of hats, it creates a table of clientside models similar to PS, then in PostPlayerDraw it checks if the player is alive among other stuff and returns if not, or continues to draw hats if everything checks out. the problem is something i dont understand, if i do for example [B]hat:SetNoDraw(true)[/B] when creating the model, there's a weird issue where hats will randomly change/flash all kinds of different colours depending on the distance from them. if i set [B]hat:SetNoDraw(false)[/B], hats will be perfectly coloured but they get frozen in the same position/angles they were the second the player dies. this code used to work fine back in the day, is there some weird hack that needs to be done to get the colours to behave correctly? i'm not really doing anything different in rendering them from how PS does it.[/QUOTE] bump on this, i have looked over and over the code, tweaked it, and compared it relentlessly with PointShop's render code and they are pretty much identical in the way of doing things. a had a few people come in and test it, and the colourful hats were all the same between us and changed colours at the same distances from the player. we couldnt seem to find any specific trigger for it either, as they were coloured fine at the start of the map but seemed to break a round or two in. i dont have anything else running that messes with entity colours so not sure how it could be a conflict. this same code used to work a year or two ago flawlessly, and i cant find any changes/bugs in clientsidemodel that have been reported. [code]function DrawHat(hat, ply) local name = hat[1] local model = hat[2] if model:GetModel() == 'models/error.mdl' then return; end local bonePos, boneAng = ply:GetBonePosition(ply:LookupBone(hatList[name]["Bone"])) local forward, right, up = boneAng:Forward(), boneAng:Right(), boneAng:Up() local offset = hatList[name]["Offset"] local angle = hatList[name]["Ang"] local position, angles = LocalToWorld( offset, angle, bonePos, boneAng ) boneAng:RotateAroundAxis(right, -90) boneAng:RotateAroundAxis(up, 90) boneAng:RotateAroundAxis(forward, hatList[name]["Ang"].y) boneAng:RotateAroundAxis(right, hatList[name]["Ang"].r) boneAng:RotateAroundAxis(up, hatList[name]["Ang"].p) local mat = Matrix() mat:Scale( hatList[name]["Scale"] ) model:EnableMatrix( "RenderMultiply", mat ) model:SetPos(bonePos + offset.x * right + offset.y * up + offset.z * forward) model:SetAngles(boneAng) model:SetRenderOrigin(bonePos + offset.x * right + offset.y * up + offset.z * forward) model:SetRenderAngles(boneAng) model:SetupBones() model:DrawModel() model:SetRenderOrigin() model:SetRenderAngles() end hook.Add("PostPlayerDraw", "DrawHats", function(ply) if ply == LocalPlayer() or !IsValid(ply) or ply:GetNWBool("disguised") or !ply:Alive() then return; end for k, v in pairs(playerHats[ply:SteamID()]["Equipped"]) do DrawHat(k, v) end end)[/code] draw code, only thing passed in is a table with the hat name and the clientsidemodel. example hat from the lookup table: [code]hatList[ 'hook' ] = { Name = 'Hook', Description = '', Model = 'models/props_junk/meathook001a.mdl', Offset = Vector( -8.5, 0, 6 ), Ang = Angle( 29.1, 0, 180 ), Scale = Vector( 0.5, 0.5, 0.5 ), Bone = 'ValveBiped.Bip01_Head1', Part = 'Head', OnEquip = function() end, OnRemove = function() end, Game = "Base" }[/code]
[QUOTE=Deathbypwnage;47780076]I seem to be getting the same error with this code: [code]if GetGlobalBool("DarkRP_LockDown") == 1 then print("There is a lockdown") end [/code][/QUOTE] That snippet won't cause the error you posted.
[QUOTE=ms333;47780472]That snippet won't cause the error you posted.[/QUOTE] It seems to, as when I remove the code the error doesn't happen anymore. Unless there is something I dont know about that causes this?
[QUOTE=Luni;47776952][lua]local mask = bit.bor(CONTENTS_SLIME, CONTENTS_WATER)[/lua] [url]http://wiki.garrysmod.com/page/Enums/CONTENTS[/url][/QUOTE] Hmm, well, for whatever reason it's still not working. I'm testing on [B]gm_city25_beta1[/B]. on [B]gm_construct[/B] when I enter water, it works perfectly, exactly how I want it to, but if I enter the sludge on [B]gm_city25_beta1[/B] I get this error: [code][ERROR] lua/autorun/myscript.lua:38: attempt to perform arithmetic on field 'PlayersDepth' (a nil value) 1. v - lua/autorun/myscript.lua:38 2. unknown - lua/includes/modules/hook.lua:84[/code] ("myscript" is not the actual file name... and 'PlayersDepth' is not the actual VAR name, but it states the purpose none the less)
Why is CUserCmd a nil value if it's supposed too work with the CreateMove hook? [code] hook.Add("CreateMove", "NewControlls", function () if ply:KeyDown( IN_MOVERIGHT ) then CUserCmd:ClearMovement() ply:SetEyeAngles(anr) ply:SetAngles(anr) elseif ply:KeyDown( IN_MOVELEFT ) then CUserCmd:ClearMovement() ply:SetEyeAngles(anl) ply:SetAngles(anl) end end) [/code]
[QUOTE=BlackMadd;47782614]Why is CUserCmd a nil value if it's supposed too work with the CreateMove hook? [code] hook.Add("CreateMove", "NewControlls", function () if ply:KeyDown( IN_MOVERIGHT ) then CUserCmd:ClearMovement() ply:SetEyeAngles(anr) ply:SetAngles(anr) elseif ply:KeyDown( IN_MOVELEFT ) then CUserCmd:ClearMovement() ply:SetEyeAngles(anl) ply:SetAngles(anl) end end) [/code][/QUOTE] The command is passed as an argument to your function. [code] hook.Add("CreateMove", "NewControlls", function ( CUserCmd ) ... [/code] Your variable can be named whatever you want.
<snip> fixed it, but I don't understand why it still worked with water before
How would one go about blurring a texture?
[QUOTE=wauterboi;47782849]How would one go about blurring a texture?[/QUOTE] Are you trying to blur your own material or get a version of an existing material blurred? Either way this code might help: [url]https://github.com/garrynewman/garrysmod/blob/4eb9bb19dcfac06007691376ecaf2dbc56efa6b2/garrysmod/lua/includes/extensions/client/render.lua#L115-L138[/url].
Alright, I'll look into that! I'm looking to blur a texture that I'm rendering on the screen. It's my own material, and however I can blur it would be great. [img]https://dl.dropboxusercontent.com/u/965202/ShareX/2015/05/Garry%27s_Mod_2015-05-22_17-07-33.png[/img] I'm also trying to refract an RT but it isn't working. Any way to apply a refract effect to an RT? (I adapted some of your code Willox) [url]http://pastebin.com/Ycz05SSu[/url] (posting the Pastebin because Cloudflare is flipping out at me posting code)
[t]http://rp.braxnet.org/scr/2015-05-23_02-15-00_60.png[/t] i gotta optimize this shit.. how do i find the underlying cause the easiest way?
What causes a DHTML panel to freeze your game for a split second upon loading? It's not the time it takes to load the page as a big image will still only freeze your game for a split second, it's only when it's initializing etc. I'm guessing it's something to-do with creating a material from the dhtml panel?
[QUOTE=Giraffen93;47783035][t]http://rp.braxnet.org/scr/2015-05-23_02-15-00_60.png[/t] i gotta optimize this shit.. how do i find the underlying cause the easiest way?[/QUOTE] [t]https://dl.dropboxusercontent.com/u/17839069/C_181.png[/t] Back when mip-maps were an issue. The map I'm creating is so large, it breaks textures :D [t]https://dl.dropboxusercontent.com/u/17839069/C_299.png[/t] Next step: Stop making my maps look like minecraft D:< Here's Progress: [t]https://dl.dropboxusercontent.com/u/17839069/C_285.png[/t] College is lame. It steals my time D:
[QUOTE=wauterboi;47783001]I'm also trying to refract an RT but it isn't working. Any way to apply a refract effect to an RT? (I adapted some of your code Willox)[/QUOTE] Solution: Render the view with post processing, add the refract, and then switch to the old RT. [code] ... render.SetRenderTarget( rt ) render.SetViewPort( 0, 0, ScrW( ), ScrH( ) ) local ScopeData = {} ScopeData.angles = LocalPlayer( ):EyeAngles( ) ScopeData.origin = LocalPlayer( ):EyePos( ) ScopeData.x = 0 ScopeData.y = 0 ScopeData.w = ScrW( ) ScopeData.h = ScrH( ) ScopeData.fov = self.Primary.Scope.FOV ScopeData.drawhud = false ScopeData.drawviewmodel = true ScopeData.viewmodelfov = 0 ScopeData.dopostprocess = true render.RenderView( ScopeData ) render.SetMaterial( tex_scope_refract ) render.DrawScreenQuadEx( ScrW( ) / 2 - ( ScrH( ) / 2 ), 0, ScrH( ), ScrH( ) ); render.SetRenderTarget( oldRT ) render.SetViewPort( 0, 0, ScrW( ), ScrH( ) ) ... [/code]
Hey guys, I started learning Lua a couple of weeks ago. Can someone explain why returning true will suppress chat messages? I actually took a guess at using return true, just to see what happened (as it was mentioned in the wiki), but don't understand the concept of why that works. Is it because returning true would exit out the function before having a chance to print the text? [code] local function deathChat( ply, txt, teamChat, isDead) if ply:IsPlayer() and isDead == true then return true end end hook.Add ("OnPlayerChat", "jameZtheDeadCantTalk", deathChat) [/code]
[QUOTE=Dead Remains;47785448]Hey guys, I started learning Lua a couple of weeks ago. Can someone explain why returning true will suppress chat messages? I actually took a guess at using return true, just to see what happened (as it was mentioned in the wiki), but don't understand the concept of why that works. Is it because returning true would exit out the function before having a chance to print the text? [code] local function deathChat( ply, txt, teamChat, isDead) if ply:IsPlayer() and isDead == true then return true end end hook.Add ("OnPlayerChat", "jameZtheDeadCantTalk", deathChat) [/code][/QUOTE] Because that's the way garry made it work. There's nothing special about it, the game just checks the return value of the hook.
[QUOTE=Dead Remains;47785448]Hey guys, I started learning Lua a couple of weeks ago. Can someone explain why returning true will suppress chat messages? I actually took a guess at using return true, just to see what happened (as it was mentioned in the wiki), but don't understand the concept of why that works. Is it because returning true would exit out the function before having a chance to print the text? [code] local function deathChat( ply, txt, teamChat, isDead) if ply:IsPlayer() and isDead == true then return true end end hook.Add ("OnPlayerChat", "jameZtheDeadCantTalk", deathChat) [/code][/QUOTE] When you return true, the gamemode's OnPlayerChat method won't be called: [url]https://github.com/garrynewman/garrysmod/blob/e77f8048ba9f3674e9643f009432e1deac90a20c/garrysmod/gamemodes/base/gamemode/cl_init.lua#L139-L172[/url]. [url]http://wiki.garrysmod.com/page/Hook_Library_Usage[/url]
Thanks, that was really bugging me not knowing WHY.
So you can do more stuff
Does anyone know of a good way to check if a function is being called? I've heard that I could use prints( and I know what print() is, it's the simplest function probably), but I don't know what whoever said that means by saying "prints" to check if a function has been called. This is what I THOUGHT he meant: [code]print("itstime") if print() == "itstime" then HasCalledFunc = true end [/code] Though, that didn't work. If anyone knows a better way or knows what that guy meant, please let me know... This could all be a misunderstanding.
[lua] local function CalcAwesomesPerSecond( int ) print("calc started") int = int / 2 * 1337 / 60 print("calculated: " .. int) return int end [/lua]
[QUOTE=Cushie;47780102]bump on this, i have looked over and over the code, tweaked it, and compared it relentlessly with PointShop's render code and they are pretty much identical in the way of doing things. a had a few people come in and test it, and the colourful hats were all the same between us and changed colours at the same distances from the player. we couldnt seem to find any specific trigger for it either, as they were coloured fine at the start of the map but seemed to break a round or two in. i dont have anything else running that messes with entity colours so not sure how it could be a conflict. this same code used to work a year or two ago flawlessly, and i cant find any changes/bugs in clientsidemodel that have been reported. [code]snip[/code] draw code, only thing passed in is a table with the hat name and the clientsidemodel. example hat from the lookup table: [code]snip [/code][/QUOTE] in-case anyone in future comes across this post, the solution was as simple and frustrating as 'ttt_playercolor_mode 0'
[QUOTE=A Fghtr Pilot;47785753]Does anyone know of a good way to check if a function is being called? I've heard that I could use prints( and I know what print() is, it's the simplest function probably), but I don't know what whoever said that means by saying "prints" to check if a function has been called. This is what I THOUGHT he meant: [code]print("itstime") if print() == "itstime" then HasCalledFunc = true end [/code] Though, that didn't work. If anyone knows a better way or knows what that guy meant, please let me know... This could all be a misunderstanding.[/QUOTE] the actual idea is just to put a print inside a function and then look at the console and see if the print showed up. [code] function thisIsSomeFunc(whatever) print("someFunc was Called") end [/code] then in the console if the function is called you will see it print: someFunc was Called If you don't see it then put a print in the function that is calling that function and so on until it prints something, then you'll have a place to start debugging from.
[QUOTE=EthanTheGreat;47784642][t]https://dl.dropboxusercontent.com/u/17839069/C_181.png[/t] Back when mip-maps were an issue. The map I'm creating is so large, it breaks textures :D Next step: Stop making my maps look like minecraft D:< Here's Progress: College is lame. It steals my time D:[/QUOTE] Well, mine isn't a map issue, it's pretty solid throughout if you play it in singleplayer, it's when i add my server stuff onto it it slows down.
Is there any way to deal with this warning: [code] [HTML] Unsafe JavaScript attempt to access frame with URL http://wiki.darkrp.com/index.php/Main_Page from frame with URL http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5606524894067150&format=160x600&output=html&h=600&slotname=2922845129&adk=579779506&w=160&lmt=1431535146&flash=17.0.0&url=http%3A%2F%2Fwiki.darkrp.com%2Findex.php%2FMain_Page&dt=1432353954809&bpp=2156&shv=r20150519&cbv=r20150521&saldr=aa&prev_fmts=728x90%2C728x90&correlator=8565071423489&frm=20&ga_vid=132019990.1432353957&ga_sid=1432353957&ga_hid=73803169&ga_fc=0&u_tz=-300&u_his=2&u_java=0&u_h=960&u_w=1280&u_ah=930&u_aw=1280&u_cd=32&u_nplug=15&u_nmime=71&dff=sans-serif&dfs=16&adx=0&ady=727&biw=496&bih=534&eid=575144603%2C317150304&oid=3&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C1280%2C0%2C0%2C0%2C513%2C551&vis=1&rsz=o%7C%7Ca%7C&abl=NA&ppjl=t&fu=1024&bc=1&ifi=3&xpc=xGl9p9vqCh&p=http%3A//wiki.darkrp.com&dtd=3435. Domains, protocols and ports must match. [/code] without editing the site that I'm opening in the HTML element?
You can override the ConsoleMessage function. [url]https://github.com/wyozi/gmod-medialib/blob/master/lua/medialib/service_html.lua#L84[/url]
[QUOTE=Fantym420;47786949]the actual idea is just to put a print inside a function and then look at the console and see if the print showed up. [code] function thisIsSomeFunc(whatever) print("someFunc was Called") end [/code] then in the console if the function is called you will see it print: someFunc was Called If you don't see it then put a print in the function that is calling that function and so on until it prints something, then you'll have a place to start debugging from.[/QUOTE] Oh. I know about doing what you said, I guess it was a misunderstanding XD. Well, it was a misunderstanding on both sides, the guy who told me this thought I was trying to check in the console when the function was called, though really I was trying to do something else XD
[QUOTE=Wyozi;47787497]You can override the ConsoleMessage function. [url]https://github.com/wyozi/gmod-medialib/blob/master/lua/medialib/service_html.lua#L84[/url][/QUOTE] Huh, that was easy. Thanks!
Sorry, you need to Log In to post a reply to this thread.