[QUOTE=Ott;45555914]How can I tell when a ragdoll collides with an object?[/QUOTE]
Try [URL="http://wiki.garrysmod.com/page/Entity/AddCallback"]Entity:AddCallback[/URL] with PhysicsCollide.
[QUOTE=Robotboy655;45555788]Because you are sending a net message every frame, it is way too often. Why do you even network position? It is networked by default and your implementation opens up exploits.[/QUOTE]
This isn't my exact code;
[lua]
function ENT:Draw()
if ( self.CanPlace ) then
if ( input.IsKeyDown( KEY_R ) and input.IsMouseDown( MOUSE_LEFT ) ) then
self.CanPlace = false;
net.Start("UpdateSettings")
net.WriteEntity(self);
net.WriteVector(LocalPlayer():GetEyeTraceNoCursor().HitPos);
net.SendToServer()
end
end
end
[/lua]
I was just asking, it's not possible to WriteEntity(self) clientside, and get the entity via the server is it?
It is possible, do print( self ) on client and print( whatever var ) or server.
Make sure to [B]read stuff in the same order as you write it.[/B]
Also, you should use something like input.IsKeyPressed or something, you are still sending too much net messages. And still, why do you even network aim pos, you can and should get it on server, it is totally possible.
What would I need to use when I want to use water as an inflictor ??
[CODE]self:TakeDamage(10, self, --water ??)[/CODE]
[QUOTE=Robotboy655;45555981]It is possible, do print( self ) on client and print( whatever var ) or server.
Make sure to [B]read stuff in the same order as you write it.[/B]
Also, you should use something like input.IsKeyPressed or something, you are still sending too much net messages. And still, why do you even network aim pos, you can and should get it on server, it is totally possible.[/QUOTE]
You can't use the input library on the server. In my situation, I'm getting the frame that they press R + LMB, then making sure the next frame it won't register. The frame the press the two, it will send some message to the server telling the server to tell the specified entity to do a specified action.
[QUOTE=sm69baller;45556201]What would I need to use when I want to use water as an inflictor ??
[CODE]self:TakeDamage(10, self, --water ??)[/CODE][/QUOTE]
[url]http://wiki.garrysmod.com/page/Global/DamageInfo[/url]
[url]http://wiki.garrysmod.com/page/Entity/TakeDamageInfo[/url]
DMG_DROWN
[QUOTE=sackcreator54;45556239]You can't use the input library on the server. In my situation, I'm getting the frame that they press R + LMB, then making sure the next frame it won't register. The frame the press the two, it will send some message to the server telling the server to tell the specified entity to do a specified action.[/QUOTE]
Use Ply:KeyPressed( IN_RELOAD ) + the mouse function, I am sure you can find it on the wiki.
I'm trying to call a function whenever a player kills somebody, and I can't seem to find the correct hook for it. Can anyone help?
[QUOTE=Noric;45556778]I'm trying to call a function whenever a player kills somebody, and I can't seem to find the correct hook for it. Can anyone help?[/QUOTE]
Really? [url=http://wiki.garrysmod.com/page/GM/PlayerDeath]PlayerDeath[/url]. Check if the attacker is a player also with [url=http://wiki.garrysmod.com/page/Entity/IsPlayer]Entity:IsPlayer()[/url]
Is there a way to use self:SetSolid(SOLID_VPHYSICS) without doing it in ENT:Initialize()?
[QUOTE=sackcreator54;45556904]Is there a way to use self:SetSolid(SOLID_VPHYSICS) without doing it in ENT:Initialize()?[/QUOTE]
I believe so, in whatever function your running, with the entity, just do ent:SetSolid(SOLID_VPHYSICS) right?
[QUOTE=Robotboy655;45555933]Try [URL="http://wiki.garrysmod.com/page/Entity/AddCallback"]Entity:AddCallback[/URL] with PhysicsCollide.[/QUOTE]
How can I tell which hitbox has been hit?
[QUOTE=Internet1001;45556830]Really? [url=http://wiki.garrysmod.com/page/GM/PlayerDeath]PlayerDeath[/url]. Check if the attacker is a player also with [url=http://wiki.garrysmod.com/page/Entity/IsPlayer]Entity:IsPlayer()[/url][/QUOTE]
I'm stupid, thank you.
How would I get the angle of the terrain that the player is looking at?
[QUOTE=sackcreator54;45557278]How would I get the angle of the terrain that the player is looking at?[/QUOTE]
Do a trace and convert the [b][url=http://gmodwiki.net/Lua/Structures/TraceRes]Lua/Structures/TraceRes[img]http://gmodwiki.net/favicon.ico[/img][/url][/b] HitNormal to an angle.
[QUOTE=Ott;45556985]How can I tell which hitbox has been hit?[/QUOTE]
Try printing out the table. Try using tracers and the hitpos and hit normal.
[QUOTE=EvacX;45557294]Do a trace and convert the [b][url=http://gmodwiki.net/Lua/Structures/TraceRes]Lua/Structures/TraceRes[img]http://gmodwiki.net/favicon.ico[/img][/url][/b] HitNormal to an angle.[/QUOTE]
Here's a MSPaint demonstration:
[T]http://oi59.tinypic.com/2nid4c6.jpg[/T]
Assuming the player is looking at where the arrow is pointing, how can I get that value?
[QUOTE=sackcreator54;45557654]Here's a MSPaint demonstration:
[T]http://oi59.tinypic.com/2nid4c6.jpg[/T]
Assuming the player is looking at where the arrow is pointing, how can I get that value?[/QUOTE]
TraceRes.HitPos:Angle( )
[QUOTE=sackcreator54;45557654]Here's a MSPaint demonstration:
[T]http://oi59.tinypic.com/2nid4c6.jpg[/T]
Assuming the player is looking at where the arrow is pointing, how can I get that value?[/QUOTE]
But I literally just told you exactly how to do it?
[QUOTE=EvacX;45560944]But I literally just told you exactly how to do it?[/QUOTE]
How do I make it into an angle then?
Also, anyone know why my NutScript HUD only draws w/ toolgun out and in weapon switcher? been trying to figure it out for about a week now.
Which Image files can i move through FastDL?
I tried using .jpg, but it didn't work.
[QUOTE=tzahush;45563869]Which Image files can i move through FastDL?
I tried using .jpg, but it didn't work.[/QUOTE]
You have to resource.AddFile("path/to/your/image.jpg") in a server sided file.
I've been trying to get a lightning effect to work using this:
[CODE]--v is player
local vPoint = v:GetPos() + Vector(0,0,70)
local effectdata = EffectData()
effectdata:SetStart( vPoint )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 10 )
effectdata:SetMagnitude( 10 )
util.Effect( "teslazap", effectdata )[/CODE]
I've had no luck with it and google says that TeslaZap just doesn't work, so do you know any other ways I could achieve lightning?
[QUOTE=Cyberuben;45563890]You have to resource.AddFile("path/to/your/image.jpg") in a server sided file.[/QUOTE]
i know that, but JPG doesn't work for some reason.
I tried it around a month ago, and it didn't work.
I'll actully try it again :P
[QUOTE=tzahush;45563927]i know that, but JPG doesn't work for some reason.
I tried it around a month ago, and it didn't work.
I'll actully try it again :P[/QUOTE]
I'm not sure if it works if you .bz2 the file. I have a vague memory of .png and .jpg files not supporting .bz2, although, I do recall someone saying .png shouldn't be a problem.
[QUOTE=sackcreator54;45563109]How do I make it into an angle then?[/QUOTE]
[QUOTE=EvacX;45557294]Do a trace and convert the [b][url=http://gmodwiki.net/Lua/Structures/TraceRes]Lua/Structures/TraceRes[img]http://gmodwiki.net/favicon.ico[/img][/url][/b] HitNormal to an angle.[/QUOTE]
And if you just want the answer to EvacX's riddle:
[lua]
traceres.HitNormal:Angle()
[/lua]
[QUOTE=Cyberuben;45564280]I'm not sure if it works if you .bz2 the file. I have a vague memory of .png and .jpg files not supporting .bz2, although, I do recall someone saying .png shouldn't be a problem.[/QUOTE]
.png is fine, never tried jpg though. @tzahush, maybe just try converting it to png?
[QUOTE=sackcreator54;45563109]How do I make it into an angle then?[/QUOTE]
This is why we can't have nice things
I've never had a problem like this before, but I was writing net messages on a local server and they end up completely wrong when they are received, I'm just writing 11 bits, then reading 11 bits and printing out the results:
[lua] net.Start("TEST_NET")
for i = 1, 11 do
print(i, false and 1 or 0)
net.WriteBit(false and 1 or 0)
end
net.Send(ply)
net.Receive("TEST_NET", function()
for i = 1, 11 do
local bitt = net.ReadBit()
print(i, bitt, tobool(bitt))
end
end)[/lua]
[code]1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
1 1 true
2 1 true
3 1 true
4 1 true
5 1 true
6 1 true
7 1 true
8 1 true
9 1 true
10 1 true
11 1 true[/code]
[QUOTE=OzymandiasJ;45566502]I've never had a problem like this before, but I was writing net messages on a local server and they end up completely wrong when they are received, I'm just writing 11 bits, then reading 11 bits and printing out the results:
[lua] net.Start("TEST_NET")
for i = 1, 11 do
print(i, false and 1 or 0)
net.WriteBit(false and 1 or 0)
end
net.Send(ply)
net.Receive("TEST_NET", function()
for i = 1, 11 do
local bitt = net.ReadBit()
print(i, bitt, tobool(bitt))
end
end)[/lua]
[code]1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
1 1 true
2 1 true
3 1 true
4 1 true
5 1 true
6 1 true
7 1 true
8 1 true
9 1 true
10 1 true
11 1 true[/code][/QUOTE]
net.WriteBit takes a boolean, not a number. When giving it a number your input will be turned in to a boolean and will always be treated as true due to numbers being truthy in Lua.
Sorry, you need to Log In to post a reply to this thread.