• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=Exho;46334285]Uhh someone more skilled in those needs to prove me wrong, but I believe it would be a bad approach. HTML panels are a tad slow because they connect to a webserver out of Gmod and probably wouldnt be the best canvas to create a hud on. Using DImages is cool though[/QUOTE] html panels should be fine for a hud if you know what you're doing the hardest part would be changing elements. What do you need to use HTML for, anyway?
When exactly does autorun code gets executed?
[QUOTE=rejax;46334387]html panels should be fine for a hud if you know what you're doing the hardest part would be changing elements. What do you need to use HTML for, anyway?[/QUOTE] Maybe he is using images for the HUD but doesnt want to resource em
Could I have a super quick example on using the net library, sending from client to server? Because I've fuckin nailed it the other way around, but I seem to be struggling here, even with the wiki's examples Basically I need to set a variable clientside, which I'm calling on PlayerSpawn
What do you mean? Do you want for the clientside variable to be networked to the server?
-snip still wrong gimme another second-
Basically, players are given a character name and when you hover over them, it'll say '????' instead of that name until you press E on them, which is basically HUDDrawTargetID() but modified slightly. I managed to do this simply via SetNWBool and it works fine, but then I was like 'oh wait this'll identify them to the whole server instead of the one person who presses E on them' I was talking with my friend, and we came to the conclusion that I should do IndentifiedPlayers = {} clientside, then table.insert(IndentifiedPlayers, ply) when you press E on them
I still don't understand what you mean. It sounds like you want server to client (player triggers identify on server which sends a message to client inputting the identified into a table, which is accessed in drawing) which would look like this: [lua] if CLIENT then local identifiedplayers = {} -- store players net.Receive("IdentifyPlayer", function() -- receive net message from server local ply = net.ReadEntity() identifiedplayers[ply] = true -- set player to identified end) --drawing: function drawname(ply) if identifiedplayers[ply] then -- if the player is set to identified ply.drawname = ply:Nick() -- do whatever with this else ply.drawname = "???" end end elseif SERVER then util.AddNetworkString("IdentifyPlayer") -- prepare net message --in the identify code function Identify(caller, entToIdentify) net.Start("IdentifyPlayer") net.WriteEntity(entToIdentify) net.Send(caller) -- send only to caller end end [/lua] But you say you want to send client -> server..
Like, I could well be wrong here since my head's a fuckin mess Here's a player before you press E on them: [IMG]http://i.imgur.com/Ab4QFrYl.png[/IMG] Here is a player after you press E on them: [IMG]http://i.imgur.com/sSj0Haxl.png[/IMG] I essentially want this change JUST for the player who pressed E, not everyone on the server
Alright, now this depends on if your pressing e code is serverside or clientside. If it's clientside, how are you telling the server?
Well, I'm using KeyPress atm, which is serverside although now that you mention it, handling that part clientside would probably make everything easier, right?
Put the player who pressed E for the first argument for net.Send, that way you can still handle it serverside and the name will only display for that player.
Yeah; my code is pretty much what you want.
-snip, solved-
-snip found workaround-
100 every time?
[QUOTE=NiandraLades;46337488]Like, I could well be wrong here since my head's a fuckin mess I essentially want this change JUST for the player who pressed E, not everyone on the server[/QUOTE] If you use PlayerBindPress and detect +use, with trace.Entity being IsValid and :IsPlayer( ), you'd do: -snip- Didn't realize how much I wrote... I've been needing to add more networking tutorials, so I hope this one is helpful. Here you go: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/networking/networking_player_identity_from_client_to_server_and_back.lua.html[/url] Remove .html to copy as html doesn't copy well with how NPPExport exports it. Basically all that is left is to change the local _name = _ent:Nick( ); to your RP Name function so the correct rp name gets bounced back to the client. Then you need to save the data in the clientside net.Receive ( If you set _ent/_target.__RPName = _name then only the LOCALPLAYER will know that data because it was set by the localplayer and not by the server+networked. You can set variables to entities all you want in client code, it'll only affect the client the code is executed on. No worries of it ever bleeding over... ).. And the HUDPaint hook, to draw the text but it seems you already have that part...
Been trying to get halo.Add() to work to add to a player if they have an item equipped in pointshop. [CODE]function ITEM:OnEquip(ply, modifications) for k, v in pairs(player.GetAll()) do if v:PS_HasItemEquipped("vampiricenchant") then ent = v tblSerf = {} table.insert(tblSerf, ent) hook.Add( "PreDrawHalos", "VampHalo", function() halo.Add( tblSerf, Color( 255, 0, 0 ), 5, 5, 2 ) end) end end end[/CODE] What am I doing wrong?
[QUOTE=rejax;46334387]html panels should be fine for a hud if you know what you're doing the hardest part would be changing elements. What do you need to use HTML for, anyway?[/QUOTE] I feel that it would be so much easier, powerful and convenient. That, however, may just be inexperience talking.
[code]PublishWorkshopFile failed! (16)[/code] broken for anyone else? been trying over and over with no success [editline]27th October 2014[/editline] and now it worked, alright
I'm sure I've seen a function before for it, but can't seem to find it. Can you think of a way for me to check if a players Steam Overlay is open/up?
[QUOTE=sacred1337;46345281]I'm sure I've seen a function before for it, but can't seem to find it. Can you think of a way for me to check if a players Steam Overlay is open/up?[/QUOTE] [url]http://wiki.garrysmod.com/page/gui/IsGameUIVisible[/url] There is none for the Steam Overlay.
Thanks, thats Somewhat helpful, is there any other way one could detect if its up or not?
Not really.
c_models flip my viewmodel and SWEP.ViewModelFlip does nothing. Anyone have a solution?
You are using SWEP.ViewModelFlip improperly. By default, all c_ models that are shipped with GMod are right handed, so you don't need to flip them.
Uh...I need some trigonometric help. I have two angles, their axis are 90° between, like pitch / yaw are. The difference between the abstracts and regular pitch/yaw/roll are abstract. I need to calculate how I could rotate around both of this abstract axis to simulate perfect up/down and left/right rotations. Does that make sense? In a sort of kind of visual representation, I need to simulate |_ using \/ [editline]27th October 2014[/editline] This is the right place to ask, correct? [editline]27th October 2014[/editline] Or...let me just straight say what's going on. I have an item rotated on Roll. This changes how pitch and yaw rotate said item. I want to calculate a way to use these abstracted directions so I can imitate perfect world-coordinate vertical pitch and horizontal yaw rotations.
I think you would need to look at local and world angles.
They are Ironsights. Would such functions work for Ironsights?
Oh, in that case you need RotateAroundAxis.
Sorry, you need to Log In to post a reply to this thread.