• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
Hey, i'm struggling with net.WriteInt and net.ReadInt. I need to share a number from the server to the client. but i don't understand at all this method net.WriteInt(500, [I]~the F is a bit?~[/I]) ------------------------------ net.ReadInt([I]~Wat??~[/I])
[QUOTE=alex223;49346034]Hey, i'm struggling with net.WriteInt and net.ReadInt. I need to share a number from the server to the client. but i don't understand at all this method net.WriteInt(500, [I]~the F is a bit?~[/I]) ------------------------------ net.ReadInt([I]~Wat??~[/I])[/QUOTE] Those arguments are the ammount of bits the number occupies. The maximum number to enter there would be 2^bits - 1
[QUOTE=alex223;49346034]Hey, i'm struggling with net.WriteInt and net.ReadInt. I need to share a number from the server to the client. but i don't understand at all this method net.WriteInt(500, [I]~the F is a bit?~[/I]) ------------------------------ net.ReadInt([I]~Wat??~[/I])[/QUOTE] Memory and what not is a pretty important part of programming, (well, depending on what language you use. Those functions were made in C++, where it is pretty important) I'd suggest searching it up.
Have any recent updates changed how ShouldCollide works? Has anyone had issues with ShouldCollide/Collision problems?
Does anyone know the best way to refresh derma? Or more preferably, DLabels. I tried to re-run label:SetText in another function, but that didn't work.
[QUOTE=McSniper12;49347331]Does anyone know the best way to refresh derma? Or more preferably, DLabels. I tried to re-run label:SetText in another function, but that didn't work.[/QUOTE] is label local and you're trying to change it from a location where label is nil? I've had derma stuff change other elements and it worked fine
How do I paint DPropertySheet tabs? So they arent gray like on this pic [t]http://images.akamai.steamusercontent.com/ugc/389923815247892186/1F65BAF881434B020FBE5C68587EB3CA4D2F0B14/[/t]
-snip, asked in a thread-
Would it be work/be a good idea to have multiple servers using the same legacy addon by having them all use a symbolic link or junction to one main folder on Windows?
How do i properly use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/Slider]constraint.Slider[/url]? On the initialize of the entity i use this method: [CODE]local slider, slider2 = constraint.Slider(self, self.dummy, 0, 0, Vector(0, 0, 62.5), Vector(0, 0, 62.5), 5, "cable/cable")[/CODE] but it completely ignores it and continues to move freely. Does anybody know what im doing wrong?
Anybody have a working example of a basic anim entity that can play/change sequences? I'm having some issues and can't find any documentation/examples that have helped.
[QUOTE=Saana;49355039]Anybody have a working example of a basic anim entity that can play/change sequences? I'm having some issues and can't find any documentation/examples that have helped.[/QUOTE] My entity works (and I think these lines are why): [CODE] ENT.Type = 'anim' -- Might be needed ENT.Base = 'base_gmodentity' --Put other entity variables here function ENT:Think() self:NextThink( CurTime() ) -- Meant to stop choppy animations or something return true end function ENT:Initialize() --Put your code here for setting the model/physics/etc. self:ResetSequence( self:LookupSequence( 'SEQ_NAME' ) ) self:SetPlaybackRate( 1 ) self.AutomaticFrameAdvance = true end [/CODE]
[QUOTE=MPan1;49357362]My entity works (and I think these lines are why):[/QUOTE] Didn't quite work when it came to changing the sequence to a walking/running one, just played the first frame and got stuck in that position.
[QUOTE=Saana;49358001]Didn't quite work when it came to changing the sequence to a walking/running one, just played the first frame and got stuck in that position.[/QUOTE] Maybe try doing ResetSequence when changing it (or just SetSequence for both)?
[QUOTE=MPan1;49358524]Maybe try doing ResetSequence when changing it (or just SetSequence for both)?[/QUOTE] I did, tried pretty much everything i could with the functions ive found. Didn't think it would be so hard to make a model that walks/runs when it is moved.
I'm having some problems with DListView Columns. I want to resize the columns, but the only way I've found that works is using SetFixedSize. SetWidth and SetWide don't seem to be doing anything unless I put them on a timer, and even then, the sizes are never correct. Unless there's a better way of resizing a column other than SetFixedSize, how do I "unfix" a column so that players can still drag to resize columns?
[QUOTE=BillyOnWiiU;49361874]I'm having some problems with DListView Columns. I want to resize the columns, but the only way I've found that works is using SetFixedSize. SetWidth and SetWide don't seem to be doing anything unless I put them on a timer, and even then, the sizes are never correct. Unless there's a better way of resizing a column other than SetFixedSize, how do I "unfix" a column so that players can still drag to resize columns?[/QUOTE] [CODE]COLUMN:SetWidth(widehere) PANEL:FixColumnsLayout()[/CODE]
Hello, trying to make something like a music system and it is working so far, but it is printing (like 10 times a second) this into console: [CODE] [HTML] Unsafe JavaScript attempt to access frame with URL data:text/html;charset=utf-8,%09%09%3Cdiv%20id%3D%27player%27%3E%3C%2Fdiv%3E%3Cscript%3E%20%0A%09%09var%20tag%3Ddocument.createElement%28%27script%27%29%3B%20%0A%09%09tag.src%3D%27https%3A%2F%2Fwww.youtube.com%2Fiframe_api%27%3B%20%0A%09%09var%20firstScriptTag%3Ddocument.getElementsByTagName%28%27script%27%29%5B0%5D%3B%20%0A%09%09firstScriptTag.parentNode.insertBefore%28tag%2CfirstScriptTag%29%3B%20%0A%09%09var%20player%3B%20%0A%09%09function%20onYouTubeIframeAPIReady%28%29%20%7B%20%20%20%0A%09%09%09player%3Dnew%20YT.Player%28%27player%27%2C%7Bheight%3A%20%270%27%2Cwidth%3A%20%270%27%2CvideoId%3A%20%27ykwqXuMPsoc%27%2Cevents%3A%20%7B%27onReady%27%3A%20onPlayerReady%7D%7D%29%3B%0A%09%09%7D%20%0A%09%09function%20onPlayerReady%28event%29%20%7B%0A%09%09%09event.target.playVideo%28%29%3B%0A%09%09%09event.target.setVolume%2820%29%3B%0A%09%09%7D%20%20%20%20%0A%09%09%3C%2Fscript%3E%0A%09 from frame with URL https://www.youtube.com/embed/ykwqXuMPsoc?enablejsapi=1. Domains, protocols and ports must match. [/CODE] Here's the code: [CODE] function swrp_musicpanel_play(videoid) swrp_musicpanel_stop() swrp_musicpanel = vgui.Create("DHTML") swrp_musicpanel:SetPos(0, 0) swrp_musicpanel:SetSize(0, 0) --Source: https://developers.google.com/youtube/iframe_api_reference?hl=de swrp_musicpanel:SetHTML([[ <div id='player'></div><script> var tag=document.createElement('script'); tag.src='https://www.youtube.com/iframe_api'; var firstScriptTag=document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag,firstScriptTag); var player; function onYouTubeIframeAPIReady() { player=new YT.Player('player',{height: '0',width: '0',videoId: ']]..videoid..[[',events: {'onReady': onPlayerReady}}); } function onPlayerReady(event) { event.target.playVideo(); event.target.setVolume(]]..GetConVar("swrp_musicpanel_volume"):GetString()..[[); } </script> ]]) end [/CODE] Any idea, what I can do to prevent this error?
Would it be possible to spawn entities, scattered around the map?
[QUOTE=Leyserr;49364401]Would it be possible to spawn entities, scattered around the map?[/QUOTE] Absolutely, but you would have to add all sorts of checks and such to make sure the entity spawned in an area a player is able to get to. I suppose there might also be a way to tap into a map's navmesh and spawn an entity only in walkable space, though I don't know how to do that.
-snip-
[QUOTE=Leyserr;49364401]Would it be possible to spawn entities, scattered around the map?[/QUOTE] It's far better to write a script which allows you to place different, and adequate, positions around the map then randomly select from that (large) pool of positions. By randomly generating positions (ie. random Vector between two bounds) the entities are going to be in positions you probably don't want them in. I don't know the context of what you're trying to do, but I am about 90% sure truly random positions isn't what you want.
Is there a gLua/Lua math function that exists (by default) that you can use to check the difference between two numbers, e.g. the difference between -5 and 5 would be 10? I submitted a pull request that adds a function that does this and I'm not sure whether or not to remove it. Probably shouldn't be posting in this thread, but should be a simple enough question Edit: wow I'm very retarded indeed
[QUOTE=MPan1;49366264]Is there a gLua/Lua math function that exists (by default) that you can use to check the difference between two numbers, e.g. the difference between -5 and 5 would be 10? I submitted a pull request that adds a function that does this and I'm not sure whether or not to remove it. Probably shouldn't be posting in this thread, but should be a simple enough question[/QUOTE] math.abs( x - y )
how does one remove the "weapon category/slots"? or just disable it
Im confused, im trying to do some stuff with custom npc shops, but if i use the anim type the legs freak the fuck out and twitch, and if i use anim, it doesnt recieve any clientside events waht so ever...is there a work around for that?
[QUOTE=MPan1;49366264]Is there a gLua/Lua math function that exists (by default) that you can use to check the difference between two numbers, e.g. the difference between -5 and 5 would be 10? I submitted a pull request that adds a function that does this and I'm not sure whether or not to remove it. Probably shouldn't be posting in this thread, but should be a simple enough question[/QUOTE] [IMG]http://i.imgur.com/de0qafR.png[/IMG]
[QUOTE=zerf;49369783]u wot[/QUOTE] Removed it from the request. Don't worry though, there was a few more basic things for dumb people like me in the request apart from just that function-which is [URL="https://github.com/garrynewman/garrysmod/pull/1005/files#diff-d692d52f8be7c61a6b2790385021a5ee"]here[/URL] btw if you want to gag laughing
[QUOTE=DamienTehDemo;49369203]Im confused, im trying to do some stuff with custom npc shops, but if i use the anim type the legs freak the fuck out and twitch, and if i use anim, it doesnt recieve any clientside events waht so ever...is there a work around for that?[/QUOTE] [code]entity:SetIK( false )[/code] ?
Having serious problems with PhysicsSimulate. It neither seems to work, nor does it get called on the client- yet it's a shared function, so says the gmod wiki! How else are you supposed to do reliable physics prediction?! Here's the code I'm using [url]http://pastebin.com/YmEEKd6F[/url] I would really appreciate some sanity here, this thing's been driving me bloody nuts
Sorry, you need to Log In to post a reply to this thread.