• What do you need help with V4
    639 replies, posted
[QUOTE=Johnny Guitar;35396440]This is what I am using Should this not be correct?[/QUOTE] "root\garrysmodbeta\materials\icon16\heart.png"
[QUOTE=pennerlord;35396468]"root\garrysmodbeta\materials\icon16\heart.png"[/QUOTE] Thank you.
Any snippet to get ID of player who is firing with specifically weapon?
I'm trying to get an entity to aim at a direction, but instead of it being instant it turn at a set rate What I have works fine except at a certain angle the entity does a full rotation in the other direction. [lua] if IsValid(mdl) then mdl:Remove() end mdl=ents.Create("prop_physics") mdl:SetModel("models/props_combine/headcrabcannister01a.mdl") mdl:SetAngles(Angle(0,180,0)) timer.Create("wdf",0.0000001,0,function() local owner=player.GetByID(1) if !IsValid(mdl) then return end if !IsValid(owner) then return end local ang=mdl:GetAngles() local targetangle=owner:EyeAngles() local speed=250*FrameTime() ang.y=math.Approach(ang.y,targetangle.y,speed) ang.p=math.Approach(ang.p,targetangle.p,speed) ang.r=0 mdl:SetAngles(ang) end) [/lua] What's the proper way to do this? [img]http://dl.dropbox.com/u/44439392/Other/hl2%202012-04-02%2022-58-56-625.gif[/img]
I'm not sure if this is the best place to ask this, but I'll give it a go anyway. I have a hook on the context menu mouse click, and I'm trying to get the point in the world where the mouse is being clicked as a map coordinate on the server. Does anyone know if this is possible and how I might go about doing it?
[lua] util.PlayerTrace(LocalPlayer(),gui.ScreenToVector(gui.MousePos())).HitPos [/lua]
Wouldn't that only work client side? I need the server to know where that position would be so I can create an entity.
objPl:GetEyeTrace( ).HitPos ? well that would only work if you make the player's eyes follow the mouse, never mind
I had tried that but yea, the server only gets the position from the centre of the screen, rather than the mouse.
The server doesn't know the mouse position so you might as well do what I posted and then send the result to the server.
Alrighty, well, I guess I should ask this too. What would be the best way to send data to the server from a client?
[QUOTE=fishcake;35410185]Alrighty, well, I guess I should ask this too. What would be the best way to send data to the server from a client?[/QUOTE] [del][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd325.html?title=User_Messages[/url][/del] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index43df.html?title=ConCommands[/url]
[QUOTE=Drakehawke;35410217][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd325.html?title=User_Messages[/url][/QUOTE] he meant client -> server, he just worded it weird
[QUOTE=Drakehawke;35410217][del][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd325.html?title=User_Messages[/url][/del] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index43df.html?title=ConCommands[/url][/QUOTE] Sweet, I shall take a look at doing it with concommands this evening. Thanks for your help guys.
[QUOTE=fishcake;35410404]Sweet, I shall take a look at doing it with concommands this evening. Thanks for your help guys.[/QUOTE] Instead of using console commands you should use datastream. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6e5f.html?title=Datastream[/url]
Isn't that being removed in the Garry's Mod 13 update? I'd rather use code that will be usable when that update goes live, unless concommand stuff is changing too?
[QUOTE=ollie;35411567]Instead of using console commands you should use datastream. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6e5f.html?title=Datastream[/url][/QUOTE] no offense, do you know what you're talking about
[QUOTE=Banana Lord.;35411824]no offense, do you know what you're talking about[/QUOTE] I would like to see you transfer lets say.. a table with consolecommands.
He isn't sending a table. You should never send a table.
[QUOTE=ralle105;35411947]He isn't sending a table. You should never send a table.[/QUOTE] What would be the best way to transfer a table from client to server?
[QUOTE=ollie;35411905]I would like to see you transfer lets say.. a table with consolecommands.[/QUOTE] Table -> Glon encode -> concommand -> Glon decode -> Table :eng101:
-snip-
[QUOTE=pennerlord;35412204]Table -> Glon encode -> concommand -> Glon decode -> Table :eng101:[/QUOTE] That's exactly whata datastream does.
[QUOTE=ralle105;35412443]That's exactly whata datastream does.[/QUOTE] So why do everyone think that datastream is shit?
[QUOTE=ollie;35412002]What would be the best way to transfer a table from client to server?[/QUOTE] My point is that if you know what you're doing you should never have to send a table. But you don't really know what you're doing, do you? [editline]3rd April 2012[/editline] [QUOTE=ollie;35412470]So why do everyone think that datastream is shit?[/QUOTE] Because sending a table, with datastream or without, creates a (potentially) large amount of unnecessary data being sent.
Hey dudes, I'm trying to make a SWEP flashlight but I'm hung up on trying to figure out how to actually draw the light. Is it possible to draw a clientside light who's position is an attachment on a viewmodel? I'm pretty sure it's possible, but I can't find the right hooks to use. The method I've tried is: [lua] local dynamicLight = DynamicLight if (dynamicLight) then dynamicLight.Brightness = 3; dynamicLight.DieTime = CurTime() + 0.1; dynamicLight.Decay = 384; dynamicLight.Size = 384; dynamicLight.Pos = self.Owner:GetAimVector(); -- replace me w/ model attachment stuff dynamicLight.r = 255; dynamicLight.g = 255; dynamicLight.b = 255; [/lua] In shared.lua under SWEP:Think(). But of course this didn't work and I suck. Any ideas?
The DynamicLight function is clientside only and afaik some swep functions don't get called clientside on singleplayer.
[QUOTE=BoInker;35413622]Hey dudes, I'm trying to make a SWEP flashlight but I'm hung up on trying to figure out how to actually draw the light. Is it possible to draw a clientside light who's position is an attachment on a viewmodel? I'm pretty sure it's possible, but I can't find the right hooks to use. The method I've tried is: [lua] local dynamicLight = DynamicLight() if (dynamicLight) then dynamicLight.Brightness = 3; dynamicLight.DieTime = CurTime() + 0.1; dynamicLight.Decay = 384; dynamicLight.Size = 384; dynamicLight.Pos = self.Owner:GetAimVector(); -- replace me w/ model attachment stuff dynamicLight.r = 255; dynamicLight.g = 255; dynamicLight.b = 255; [/lua] In shared.lua under SWEP:Think(). But of course this didn't work and I suck. Any ideas?[/QUOTE] [lua] function SWEP:Think() if CLIENT then local dynamicLight = DynamicLight if (dynamicLight) then dynamicLight.Brightness = 3; dynamicLight.DieTime = CurTime() + 0.1; dynamicLight.Decay = 384; dynamicLight.Size = 384; dynamicLight.Pos = self.Owner:GetPos() + self.Owner:GetAimVector()*5; -- replace me w/ model attachment stuff dynamicLight.r = 255; dynamicLight.g = 255; dynamicLight.b = 255; end end end [/lua] Should do the job.
Aha! That definitely got the light to draw, but the light's origin is at the player's feet. Can the light be turned into a directional spotlight?
[QUOTE=BoInker;35414208]Aha! That definitely got the light to draw, but the light's origin is at the player's feet. Can the light be turned into a directional spotlight?[/QUOTE] [lua] function SWEP:Think() if CLIENT then local dynamicLight = DynamicLight() if (dynamicLight) then dynamicLight.Brightness = 3; dynamicLight.DieTime = CurTime() + 0.1; dynamicLight.Decay = 384; dynamicLight.Size = 384; dynamicLight.Pos = self.Owner:GetShootPos(); dynamicLight.r = 255; dynamicLight.g = 255; dynamicLight.b = 255; end end end [/lua] This makes the position on your head, not sure if you even can make it spotlight.
Sorry, you need to Log In to post a reply to this thread.