[QUOTE=code_gs;52670596][IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/CUserCmd/SetViewAngles"]CUserCmd:SetViewAngles[/URL]
[editline]11th September 2017[/editline]
You're correct, that does actually work a lot better -- I didn't know space between brushes was empty. Make sure to use ents.GetAll for the filter so you don't run into anything while working with the world.[/QUOTE]
Setting the view angles of the player doesn't help unfortunately. I need to update the angles of the VEHICLE (helicopter) based on the players mouse movements.
Which brings me back to my previous question, is sending that many net messages every tick going to have a noticeable effect on server performance?
[QUOTE=-Raven-;52670604]Setting the view angles of the player doesn't help unfortunately. I need to update the angles of the VEHICLE (helicopter) based on the players mouse movements.
Which brings me back to my previous question, is sending that many net messages every tick going to have a noticeable effect on server performance?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/StartCommand]GM:StartCommand[/url]
Usercmds are already networked to the server
[QUOTE=code_gs;52670672][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/StartCommand]GM:StartCommand[/url]
Usercmds are already networked to the server[/QUOTE]
Oh didn't know that. Thank you so much. :)
How can I get rid of the top and bottom buttons on the scrollbar for the scroll panel?
[QUOTE=PigeonTroll;52672470]How can I get rid of the top and bottom buttons on the scrollbar for the scroll panel?[/QUOTE]
[CODE]
scroll.VBar:SetHideButtons( true )
[/CODE]
[URL="https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/vgui/dvscrollbar.lua"]Source[/URL]
I seem to be having issues attaching a PAC3 item to a DModelPanel, it was reported as an issue before but I don't understand what he means in this response:
[url]https://github.com/CapsAdmin/pac3/issues/6[/url]
[CODE]
PAC3ItemData = {}
PAC3ItemData["basic_kevlar"] = {
[1] = {
["children"] = {
[1] = {
["children"] = {
},
["self"] = {
["ClassName"] = "model",
["Position"] = Vector(0.0198974609375, 0.015625, -15.36474609375),
["Bone"] = "chest",
["Model"] = "models/combine_vests/bluevest.mdl",
["UniqueID"] = "3032641524",
},
},
},
["self"] = {
["Name"] = "my outfit",
["ClassName"] = "group",
["UniqueID"] = "2421938550",
["EditorExpand"] = true,
},
},
}
self.PModel = vgui.Create( "DModelPanel", self.Background )
self.PModel:SetSize( 600, 600 )
self.PModel:SetPos((scrw/2)-300, (scrh/2)-300)
self.PModel:SetModel( LocalPlayer():GetModel() )
local eyepos = self.PModel.Entity:GetBonePosition( self.PModel.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 0, 0, -30 ) )
self.PModel:SetLookAt( eyepos )
self.PModel:SetCamPos( eyepos-Vector( -60, 0, 0 ) )
self.PModel:SetCursor("arrow")
function self.PModel:LayoutEntity( Entity )
return
end
pac.SetupENT(self.PModel.Entity)
self.PModel.Entity:AttachPACPart(PAC3ItemData["basic_kevlar"])
[/CODE]
That is my DModelPanel and PAC3 outfit together, could someone shed some light on how I can get this to render? It would be very appreciated!
[QUOTE=DahDestroyer;52676038]
That is my DModelPanel and PAC3 outfit together, could someone shed some light on how I can get this to render? It would be very appreciated![/QUOTE]
If I had to take a wild guess, he wants you to do that stuff in the Paint function (maybe even try in LayoutEntity if that doesn't work) of your "self.PModel" element.
Here's the way the dev uses it (Though, in his case it's used as part of the HUD):
[code]hook.Add("HUDPaint","1",function()
local ent = LocalPlayer()
ent:SetAngles(Angle(0,0,0))
local cam_ang = ent:EyeAngles() + Angle(0,180,0)
cam_ang.p = 0
local cam_pos = ent:LocalToWorld(ent:OBBCenter()) - cam_ang:Forward() * ent:BoundingRadius() * 95
local w,h = 512,512
surface.SetDrawColor(0,0,0,255)
surface.DrawRect(0,0,w,h)
pac.DrawEntity2D(ent, 0, 0, w, h, cam_pos, cam_ang, 1.5, 3000)
end)[/code]
[QUOTE=kpjVideo;52676163]If I had to take a wild guess, he wants you to do that stuff in the Paint function (maybe even try in LayoutEntity if that doesn't work) of your "self.PModel" element.
Here's the way the dev uses it (Though, in his case it's used as part of the HUD):
[code]hook.Add("HUDPaint","1",function()
local ent = LocalPlayer()
ent:SetAngles(Angle(0,0,0))
local cam_ang = ent:EyeAngles() + Angle(0,180,0)
cam_ang.p = 0
local cam_pos = ent:LocalToWorld(ent:OBBCenter()) - cam_ang:Forward() * ent:BoundingRadius() * 95
local w,h = 512,512
surface.SetDrawColor(0,0,0,255)
surface.DrawRect(0,0,w,h)
pac.DrawEntity2D(ent, 0, 0, w, h, cam_pos, cam_ang, 1.5, 3000)
end)[/code][/QUOTE]
Got it working with this! Thank you a lot!
Is there anyway I could also force an idle animation on the LocalPlayer() in the DModelPanel?
I tried using
[CODE]
ent:SetSequence(ent:LookupSequence( "idle" ))
[/CODE]
But that makes the player invisible..
[QUOTE=DahDestroyer;52676203]Got it working with this! Thank you a lot!
Is there anyway I could also force an idle animation on the LocalPlayer() in the DModelPanel? [/QUOTE]
Try doing that inside the LayoutEntity function.
[code]function self.PModel:LayoutEntity( Entity )
Entity:SetSequence( Entity:LookupSequence( "idle" ) )
return
end[/code]
[QUOTE=kpjVideo;52676261]Try doing that inside the LayoutEntity function.
[code]function self.PModel:LayoutEntity( Entity )
Entity:SetSequence( Entity:LookupSequence( "idle" ) )
return
end[/code][/QUOTE]
I thought about that, but the Entity in the DModelPanel isn't the one being drawn, it's the one inside of the paint hook.
[CODE]
self.PModel = vgui.Create( "DModelPanel", self.Background )
self.PModel:SetSize( 600, 600 )
self.PModel:SetPos((scrw/2)-300, (scrh/2)-300)
self.PModel:SetModel( LocalPlayer():GetModel() )
local eyepos = self.PModel.Entity:GetBonePosition( self.PModel.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 0, 0, -30 ) )
self.PModel:SetLookAt( eyepos )
self.PModel:SetCamPos( eyepos-Vector( -60, 0, 0 ) )
self.PModel:SetCursor("arrow")
function self.PModel:LayoutEntity( Entity )
return
end
pac.SetupENT(LocalPlayer())
LocalPlayer():AttachPACPart(PAC3ItemData["basic_kevlar"])
local oldPaint = self.PModel.Paint
self.PModel.Paint = function(self,w,h)
local ent = LocalPlayer()
--ent:SetSequence( ent:LookupSequence( "idle" ) ) -- Makes the rendered entity invisible, attachment still visible but moves as normal
ent:SetAngles(Angle(0,0,0))
local cam_ang = ent:EyeAngles() + Angle(0,180,0)
cam_ang.p = 0
local cam_pos = ent:LocalToWorld(ent:OBBCenter()) - cam_ang:Forward() * ent:BoundingRadius() * 95
local w,h = scrw, scrh
pac.DrawEntity2D(ent, 0, 0, w, h, cam_pos, cam_ang, 3, 3000)
end
[/CODE]
The issue is that every movement the player makes is translated onto that DModelPanel, which I don't want, I'd rather it just be static and not move :)
Is there a way to remove a single constraint from an entity? I know about [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/RemoveAll]constraint.RemoveAll[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/RemoveConstraints]constraint.RemoveConstraints[/url], but these remove all the constraints.
Nevermind, constraints return entities for the constraint and rope when created, for example with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/Slider]constraint.Slider[/url]
[QUOTE=MPan1;52676809]Is there a way to remove a single constraint from an entity? I know about [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/RemoveAll]constraint.RemoveAll[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/constraint/RemoveConstraints]constraint.RemoveConstraints[/url], but these remove all the constraints.[/QUOTE]
Delete the constraint entity with ent:Remove()
Automerge fail sorry
[editline]13th September 2017[/editline]
Automerge fail again
Seems like I'm always breaking something..
render.RenderView seems to be causing some skybox issues,
[CODE]
cam.Start2D()
local pos = LocalPlayer():GetPos() + Vector( 0, 0, 500 )
local ang = Angle( 90, 90, 0 )
render.RenderView {
origin = pos,
angles = ang,
x = ScrW()-225,
y = ScrH()-225,
w = 200,
h = 200,
ortho = true,
ortholeft = -800,
orthoright = 800,
orthotop = -800,
orthobottom = 800
}
cam.End2D()
[/CODE]
is causing my skybox to look like this:
[IMG]https://i.imgur.com/3zAYSQR.png[/IMG]
instead of this:
[IMG]https://i.imgur.com/KsER2tu.png[/IMG]
EDIT: Probably should've specified that this was for a minimap, could've easily told if you took a second to read the code but hey I guess some people need a little extra push :glare:
[QUOTE=DahDestroyer;52679680]Seems like I'm always breaking something..
render.RenderView seems to be causing some skybox issues,
[CODE]
cam.Start2D()
local pos = LocalPlayer():GetPos() + Vector( 0, 0, 500 )
local ang = Angle( 90, 90, 0 )
render.RenderView {
origin = pos,
angles = ang,
x = ScrW()-225,
y = ScrH()-225,
w = 200,
h = 200,
ortho = true,
ortholeft = -800,
orthoright = 800,
orthotop = -800,
orthobottom = 800
}
cam.End2D()
[/CODE][/QUOTE]
Why are you even using render.RenderView for thirdperson? Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CalcView]GM:CalcView[/url] instead.
Anyone have a helper function for RoundedBox with faded edges? Something like this:
[IMG]https://i.imgur.com/GppH7xd.png[/IMG]
Been trying to replicate it for a few hours now without any progress.
[QUOTE=txike;52680002]Why are you even using render.RenderView for thirdperson? Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CalcView]GM:CalcView[/url] instead.[/QUOTE]
I'm not.
[QUOTE=DahDestroyer;52681399]I'm not.[/QUOTE]
Yeah, renderview does that type of weird things in GMOD. From making areas flash the skybox for some reason (something about it not liking fog I think which helps fps or doors which prevent rendering of the map to increase fps, idk) to water showing something else.
The thing I do notice is that this happens more in newer maps than older maps. For example, rp_downtown_v2 does not cause this thing to happen (I called it a thing because I am not sure what to class it as) but rp_downtown_2017 does.
[QUOTE=ExodusTheFirs;52680147]Anyone have a helper function for RoundedBox with faded edges? Something like this:
[IMG]https://i.imgur.com/GppH7xd.png[/IMG]
Been trying to replicate it for a few hours now without any progress.[/QUOTE]
[lua]
function draw.RoundedBlur(z,x,y,w,h,blursize, c)
for k=0, blursize do
draw.RoundedBox(z,x-k,y-k,w+k*2,h+k*2,blursize, Color(c.r,c.g,c.b,c.a-(k/blursize)*255))
end
end
[/lua]
No idea if that works, but you should razonate it like that
[QUOTE=gonzalolog;52681872][lua]
function draw.RoundedBlur(z,x,y,w,h,blursize, c)
for k=0, blursize do
draw.RoundedBox(z,x-k,y-k,w+k*2,h+k*2,blursize, Color(c.r,c.g,c.b,c.a-(k/blursize)*255))
end
end
[/lua]
No idea if that works, but you should razonate it like that[/QUOTE]
I'll try it, thanks. Disseminate recommends using a texture with certain flags, but I'll try both.
I managed to get old ZMod version, so far I removed the backdoor. But zombies are neutral, I'm not coder. I can slightly modify lua, make SWePs with bases and that's all. I just need simple function that will make zombies hostile towards players.
Here's the code for slow_zombies
[url]https://pastebin.com/pHacAfKL[/url]
Any help is appreciated.
[QUOTE=Chucko Kokos;52684430]I managed to get old ZMod version, so far I removed the backdoor. But zombies are neutral, I'm not coder. I can slightly modify lua, make SWePs with bases and that's all. I just need simple function that will make zombies hostile towards players.
Here's the code for slow_zombies
[url]https://pastebin.com/pHacAfKL[/url]
Any help is appreciated.[/QUOTE]
[url]https://facepunch.com/showthread.php?t=1183071[/url]
[QUOTE=FireWolf2525;52684442][url]https://facepunch.com/showthread.php?t=1183071[/url][/QUOTE]
It won't work, from what I understand ZMod zombies are just neutral/friendly. They will just wander around, but thanks.
I hope someone will give help in this thread. So if you can, please.
OK, so, I have two codes for this thing, I have a clean code for opening the combine doors on maps like rp_city17 and other HL2RP maps. It's working. But I need to restrict this, so only special teams like TEAM_HELIX(MPF HELIX) can open this doors. Guys tried to help me, but their code is not helped me. And they are forget about it. So, if someone can see a problem with this codes, and repair it, I love you.
Code #1:
[CODE]local jobs = { TEAM_WFYUED,
TEAM_GYUIO };
function KeyPressedUse (ply, key)
if key == IN_USE then
if( !table.HasValue( jobs, ply:Team() ) ) then
ply:ChatPrint( "Incorrect job" );
return;
end
local t = {}
t.start = ply:GetPos()
t.endpos = ply:GetShootPos() + ply:GetAimVector() * 100
t.filter = ply
local trace = util.TraceLine(t)
if trace.Entity and trace.Entity:IsValid() and (trace.Entity:GetClass() == "func_door" or trace.Entity:GetClass() == "prop_door_rotating" or trace.Entity:GetClass() == "prop_dynamic") then
trace.Entity:Fire("Open")
end
end
end
hook.Add( "KeyPress", "KeyPressedUse", KeyPressedUse ) [/CODE]
Yes, in this code please also delete INCORRECT TEAM printing. It's works badly.
Code #2:
[CODE]local tbl = {
jobs = {},
doors = {
["func_door"] = true,
["prop_door_rotating"] = true,
["prop_dynamic"] = true
}
}
-- Jobs does not exist until the gamemode has loaded, so we're gonna do it in here.
hook.Add("InitPostEntity", "insertJobs", function()
local jobs = {
[TEAM_POLICE] = true,
}
table.Merge(tbl.jobs, jobs);
end);
hook.Add("PlayerUse", "openDoors", function(ply, ent)
if (not IsValid(ply) or not IsValid(ent)) then return; end
local tr = util.TraceLine({
start = ply:GetPos(),
endpos = ply:GetShootPos() + ply:GetAimVector() * 100,
filter = ply
});
if (IsValid(tr.Entity) and tbl.doors[tr.Entity:GetClass()]) then
if (tbl.jobs[ply:Team()]) then
-- If the door is locked then it won't open, uncomment this to make the doors unlock and open
-- tr.Entity:Fire("unlock");
tr.Entity:Fire("open", "", .5);
end
end
end);
[/CODE]
And yes, for example use team_helix please.
Help me please.
And, yes, if it's may cause some error's. I done a file combinedoors.lua in my server directory: garrysmod/lua/autorun/server. Maybe it's a wrong way?
Also, a clean working function without team restricting, if this needed:
[CODE]function KeyPressedUse (ply, key)
if key == IN_USE then
local t = {}
t.start = ply:GetPos()
t.endpos = ply:GetShootPos() + ply:GetAimVector() * 100
t.filter = ply
local trace = util.TraceLine(t)
if trace.Entity and trace.Entity:IsValid() and (trace.Entity:GetClass() == "func_door" or trace.Entity:GetClass() == "prop_door_rotating" or trace.Entity:GetClass() == "prop_dynamic") then
trace.Entity:Fire("Open")
end
end
end
hook.Add( "KeyPress", "KeyPressedUse", KeyPressedUse )
[/CODE]
So,PLEEEASE, help me.
It's because teams aren't loaded by the time you declare the table. Try updating the table in a timer.
Why do server and client files have different CRC? I'd assume they'd be the same?
Also is there any way to compare functions to the real file such as(As you can tell this is a file which has its sourced faked to a real file)
currentline = 1838
func = function: 0x4caee048
isvararg = false
lastlinedefined = 1923
linedefined = 1833
name = AimbotCore
namewhat = field
nparams = 1
nups = 3
short_src = lua/vgui/spawnicon.lua
source = @lua/vgui/spawnicon.lua
what = Lua
I'd hoped I could debug info with the function but it appears to not work
[QUOTE=blackwidowman;52685074]Why do server and client files have different CRC? I'd assume they'd be the same?
Also is there any way to compare functions to the real file such as(As you can tell this is a file which has its sourced faked to a real file)
currentline = 1838
func = function: 0x4caee048
isvararg = false
lastlinedefined = 1923
linedefined = 1833
name = AimbotCore
namewhat = field
nparams = 1
nups = 3
short_src = lua/vgui/spawnicon.lua
source = @lua/vgui/spawnicon.lua
what = Lua
I'd hoped I could debug info with the function but it appears to not work[/QUOTE]
You could compare their bytecodes, but you would need to have the original bytecode already available before any overrides happen.
How would I pass the function to stringdump? I can't pass it 0x4caee048
[QUOTE=blackwidowman;52685129]How would I pass the function to stringdump? I can't pass it 0x4caee048[/QUOTE]
You have to pass the function object
Sorry, you need to Log In to post a reply to this thread.