I've been getting this error for a long time and I'm wanting to put an end to it
[code]DataTable warning: env_fog_controller: Out-of-range value (16846164992.000000) in SendPropFloat 'm_vOrigin[2]', clamping.
DataTable warning: (class env_fog_controller): Out-of-range value (-77987815424.000000) in SendPropFloat 'm_vStart[0]', clamping.
[/code]
Pretty much spams it in console when I shoot my weapons
[QUOTE=ROFLBURGER;47003155]I've been getting this error for a long time and I'm wanting to put an end to it
[code]DataTable warning: env_fog_controller: Out-of-range value (16846164992.000000) in SendPropFloat 'm_vOrigin[2]', clamping.
DataTable warning: (class env_fog_controller): Out-of-range value (-77987815424.000000) in SendPropFloat 'm_vStart[0]', clamping.
[/code]
Pretty much spams it in console when I shoot my weapons[/QUOTE]
Looks like your entities are being teleported or something to ridiculous coordinates.
[QUOTE=Robotboy655;47003557]Looks like your entities are being teleported or something to ridiculous coordinates.[/QUOTE]
It's probably my bullet penetration then, it's really bad when it comes to world brushes.
[editline]24th January 2015[/editline]
hell it's really bad overall, theres so many exploits I find difficult to fix that I might have to make a post on when I'm ready to tackle it.
Was working earlier, now it doesnt for some reason.. please help?
[code]
sound.PlayURL("https://www.youtube.com/watch?v=a8c5wmeOL9o", "3d",function(Ebola)
if !(IsValid( station )) then
Ebola:SetPos( LocalPlayer():GetPos() )
Ebola:Play()
else
print("doesnt work!")
end
end)
[/code]
Ebola is a nil value..
Anyway to block entities from being removed in the context menu?
I'm trying to loop through a CSS map and replace all CSS weapons with weapon_crowbar on the map start, the weapons have other entities parenting them. Any idea on where to start? I am trying to avoid hex editing the maps to weapon_crowbar.
[QUOTE=Superbird;47005008]I'm trying to loop through a CSS map and replace all CSS weapons with weapon_crowbar on the map start, the weapons have other entities parenting them. Any idea on where to start? I am trying to avoid hex editing the maps to weapon_crowbar.[/QUOTE]
Maybe get its angles and position, do [URL="http://wiki.garrysmod.com/page/Entity/GetParent"]this[/URL], remove the original entity, create the new entity, set the new entity's position and angles to mimic the original weapon, then use [URL="http://wiki.garrysmod.com/page/Entity/SetParent"]this[/URL] to attach your new weapon to the original weapon's parent. Maybe that would work?
[editline]24th January 2015[/editline]
Oh, you also might want to use [URL="http://wiki.garrysmod.com/page/ents/FindByClass"]this[/URL] to find all of them in the first place.
[QUOTE=WalkingZombie;47005131]Maybe get its angles and position, do [URL="http://wiki.garrysmod.com/page/Entity/GetParent"]this[/URL], remove the original entity, create the new entity, set the new entity's position and angles to mimic the original weapon, then use [URL="http://wiki.garrysmod.com/page/Entity/SetParent"]this[/URL] to attach your new weapon to the original weapon's parent. Maybe that would work?
[editline]24th January 2015[/editline]
Oh, you also might want to use [URL="http://wiki.garrysmod.com/page/ents/FindByClass"]this[/URL] to find all of them in the first place.[/QUOTE]
That's what I was thinking of doing, but it would be convenient if I could just change the entity lumps weapon classnames....
[QUOTE=LegoGuy;47004860]Anyway to block entities from being removed in the context menu?[/QUOTE]
[URL="http://wiki.garrysmod.com/page/SANDBOX/CanProperty"]SANDBOX:CanProperty[/URL] has an example exactly for your issue. There is also [URL="http://wiki.garrysmod.com/page/ENTITY/CanProperty"]ENTITY:CanProperty[/URL], depending on your needs.
[editline]24th January 2015[/editline]
[QUOTE=Exploderguy;47004842]Was working earlier, now it doesnt for some reason.. please help?
[code]
sound.PlayURL("https://www.youtube.com/watch?v=a8c5wmeOL9o", "3d",function(Ebola)
if !(IsValid( station )) then
Ebola:SetPos( LocalPlayer():GetPos() )
Ebola:Play()
else
print("doesnt work!")
end
end)
[/code]
Ebola is a nil value..[/QUOTE]
Is 'station' meant to be Ebola, or are you declaring that elsewhere? Assuming the latter since your check is for if station [I]isn't[/I] valid, unless that's the problem itself.
How do I find/list props that were made by the breakage of another prop..
For example, there's a world prop that's a computer (prop_physics_multiplayer) and if you break it it creates a number of other props (prop_physics)..
How do I determine, with lua, that that prop was created from a broken prop?
I want to be able to clean up these stupid little pieces!
I have a gamemode on my server.
My friends have a copy of that gamemode, downloaded via the workshop.
Do the custom materials and models of that gamemode located in its content folder on the client get mounted on the client while playing that gamemode without downloading?
[QUOTE=bobbleheadbob;47005809]I have a gamemode on my server.
My friends have a copy of that gamemode, downloaded via the workshop.
Do the custom materials and models of that gamemode located in its content folder on the client get mounted on the client while playing that gamemode without downloading?[/QUOTE]
Provided the content is included with the workshop item.
EmitSound volume (and perhaps other arguments) doesn't seem to be working. Whenever setting for example, 0 in the volume argument (0 off, 1 max), the sound is still very much present and plays at full volume.
[url]http://wiki.garrysmod.com/page/Global/EmitSound[/url]
[QUOTE=Exploderguy;47004842]Was working earlier, now it doesnt for some reason.. please help?
[code]
sound.PlayURL("https://www.youtube.com/watch?v=a8c5wmeOL9o", "3d",function(Ebola)
if !(IsValid( station )) then
Ebola:SetPos( LocalPlayer():GetPos() )
Ebola:Play()
else
print("doesnt work!")
end
end)
[/code]
Ebola is a nil value..[/QUOTE]
You can't play YouTube [B]videos [/B]with BASS.DLL
[QUOTE=isjason;47005746]How do I find/list props that were made by the breakage of another prop..
For example, there's a world prop that's a computer (prop_physics_multiplayer) and if you break it it creates a number of other props (prop_physics)..
How do I determine, with lua, that that prop was created from a broken prop?
I want to be able to clean up these stupid little pieces![/QUOTE]
Might make more problems than it fixes, but you could always do:
[lua]
hook.Add("Think","NoDebris",function()
for k,v in pairs(ents.GetAll())do
if v:GetCollisionGroup() == COLLISION_GROUP_DEBRIS then
v:Remove()
end
end
end)
[/lua]
For some reason, no matter whether or not the player is near an entity called sent_dwater, it is always setting the NWInt to 1...
[lua]
ply:ChatPrint(ply:GetNWInt("SaltWater"))
for k, ply in pairs( player.GetAll() ) do
for k,v in pairs (ents.FindInSphere(ply:GetPos(), 2000)) do
if ( v:GetClass() == "sent_dwater" ) then
ply:SetNWInt( "SaltWater", 0 )
else
ply:SetNWInt( "SaltWater", 1 )
end
end
end
[/lua]
Okay, this might be a tad weird to explain. I've got an entity which is essentially just an ordinary brush with a number attach to it. I need to increase that number each time the entity is made, which I've simple enough. I have made a small map with this entity drawn 16 times. To help see what number each tile has been given, I am using math.fmod to colour them.
Even numbers are red, while odd is blue
[img]http://i.imgur.com/irdUwY7.png[/img]
So, it's like this:
0, 1, 2, 3
4, 5, 6, 7
When I need it to be:
0, 1, 2, 3
7, 6, 5, 4
so it looks like this instead:
[img]http://i.imgur.com/VXeVtCq.png[/img]
I am aware I can reset ent.Number back to 0 every four loops, however that's not what I want. What method should I go back this? My original intention was to do with this lua, however I am thinking maybe it'd be better to do Value = Number in Hammer instead and manually assign each one.
There's probably a better solution but this might help.
[LUA]
local grid = {}
local myNumber = 0
local ReverseOrder = false
local MAX_X = 3
local MAX_Y = 3
for RowX = 0, MAX_X do
for RowY = 0, MAX_Y do
myResolvedNumber = myNumber
if ( ReverseOrder == true ) then
myResolvedNumber = ( myNumber + ( MAX_Y - RowY ) ) - RowY
end
grid[RowX] = grid[RowX] or {}
grid[RowX][RowY] = myResolvedNumber
myNumber = myNumber + 1
if ( RowY == MAX_Y ) then
ReverseOrder = not ReverseOrder
end
end
end
[/LUA]
Should output this
0 1 2 3
7 6 5 4
8 9 10 11
15 14 13 12
Hey,
Just made a little model to go in the hands of characters in TTT (from the pointshop)
So it's a pirate hook, I've verified that it works in gmod, and also that it does work when using the pointshop just not with the hands.
[CODE]ITEM.Name = 'Hooks For Hands!(Right)'
ITEM.Price = 1
ITEM.Model = 'models/hook/hook.mdl'
ITEM.Attachment = 'ValveBiped.Bip01_R_Wrist'
function ITEM:OnEquip(ply, modifications)
ply:PS_AddClientsideModel(self.ID)
end
function ITEM:OnHolster(ply)
ply:PS_RemoveClientsideModel(self.ID)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(1, 0)
pos = pos --+ (ang:Right() * 5) + (ang:Up() * 6) + (ang:Forward() * 2)
return model, pos, ang
end[/CODE]
Also tried
[CODE]ITEM.Bone = 'ValveBiped.Bip01_R_Wrist'[/CODE]
for the attachment but neither works. If I put ITEM.Attachment = 'Eyes' it works and puts the model on my head which isn't quit what I want :P
Am I missing something to put it on their hands?
Nevermind...tried
ValveBiped.Bip01_R_Hand instead and that puts it in the right area...just the damn wrong rotation again...of course I figure it out right after I post..like literally after.
Okay, so I'm trying to make a hook that lets me know (on the server side) when a player has done an action that was added to the undo list. And, well, I did it!
[lua]local OUT = {} -- OUT = Old Undo Table; CUT = Current Undo Table
hook.Add( "Think", "Catch Undos", function()
local CUT = undo.GetTable()
for uid, undotable in pairs(CUT) do
for undokey, undodata in pairs(undotable) do
if !OUT[uid] or !table.HasValue(OUT[uid], undokey) then hook.Run( "UndoCaught", uid, undodata ) end
end
end
table.Empty(OUT)
for uid, undotable in pairs(CUT) do
OUT[uid] = table.GetKeys(undotable)
end
end )[/lua]
So, why am I sharing? Because it feels really, really stupid. Why isn't there a hook for it in the first place?
Now, one of the things I wanted to do with it is to remove an undo from the table without actually removing its entities (the goal is that a player will be able to undo their constraints, but not their spawns). Is there a way to do this?
BONUS TRACK! On one of my earlier attempts, I actually compared the entire undo table with an older copy of it made using table.Copy(), so I wrote this function to compare the tables:
[lua]local function AreTablesIdentical( a, b )
if !istable(a) and !istable(b) then return a == b -- if they're not tables just compare them - used for recursion
elseif !istable(a) or !istable(b) then return false -- if one is a table but the other isn't, they can't be identical
elseif table.Count(a) == 0 and table.Count(b) == 0 then return true -- both tables are empty and therefore identical
elseif table.Count(a) != table.Count(b) then return false -- tables are of different lengths, cannot be identical
else for k, v in pairs(a) do
//if !IsValid(b[k]) then return false -- this doesn't work for some reason, always returns false. doesn't seem to be necessary anyway
if !AreTablesIdentical( v, b[k] ) then return false end
end
end
return true
end[/lua]
(the hundreds of mistakes and errors made in the production of this code not shown)
This turned out to work pretty well, at least for the undo table, but I thought it wasn't working right so I made the newer version above. After the newer version was done, I skimmed the older code and figured out why it seemed like it wasn't working - my debugging code was in the wrong place. ><
I feel spammy. I'm sorry. :(
Just a tip, IsValid works like this: Is the object not null and not false? Does the object have an IsValid function? Does that function return true?
Does someone know how to get the angle of the [URL="http://www.mathopenref.com/ellipsetangent.html"]tangent line of an ellipse[/URL], given the point of contact acquired by:
[lua]
local ang = 43 --this is the variable which changes. It's converted to radians in my real code.
local offx,offy = 100,100 --this is the center of the ellipse.
local w,h = 500,200 --This is the width and height in total.
local touchx = offx + math.cos( ang ) * w
local touchy = offy + math.sin( ang ) * h
[/lua]
The point is generated fine. I just have no idea how to get the tangent line on that point.
Anyone know a thing or two about ellipses?
Do I need to be concerned with weak tables in GLua? I wouldn't think so as nobody else seems to care.
[QUOTE=bobbleheadbob;47010520]Does someone know how to get the angle of the [URL="http://www.mathopenref.com/ellipsetangent.html"]tangent line of an ellipse[/URL], given the point of contact acquired by:
[lua]
local ang = 43 --this is the variable which changes. It's converted to radians in my real code.
local offx,offy = 100,100 --this is the center of the ellipse.
local w,h = 500,200 --This is the width and height in total.
local touchx = offx + math.cos( ang ) * w
local touchy = offy + math.sin( ang ) * h
[/lua]
The point is generated fine. I just have no idea how to get the tangent line on that point.
Anyone know a thing or two about ellipses?[/QUOTE]
[code]touchx = offx + w * cos (ang)
touchy = offy + h * sin (ang)[/code]
Differentiate with respect to ang to get the rate that touchx and touchy vary with ang:[code]d touchx / d ang = -w * sin (ang)
d touchy / d ang = h * cos (ang)[/code]
This is the direction of the tangent line at a given value of ang in radians
(Crash course in differentiation:
da/dx = d/dx a
d/dx constant = 0
d/dx (a + b) = (d/dx a) + (d/dx b)
d/dx (a * b) = a (d/dx b) + (d/dx a) b
d/dx sin(x) = cos(x)
d/dx cos(x) = -sin(x)
)
[b]The tangent line is given by:[/b][code]linex = touchx + t * -w * sin (ang)
liney = touchy + t * h * cos (ang)[/code]
If you want to plot it dirtily you could draw a line segment from t = -big number to t = big number.
If you want to plot it cleanly you will have to intersect these lines with the screen boundaries (x = 0, x = ScrW (), y = 0, y = ScrH ()) to get the range of t for which the line is onscreen.
If you really want the angle of the tangent line, it's atan2 (d touchy / d ang, d touchx / d ang), which returns an angle in radians.
[QUOTE=!cake;47010700]
[b]The tangent line is given by:[/b][code]linex = touchx + t * -w * sin (ang)
liney = touchy + t * h * cos (ang)[/code]
If you want to plot it dirtily you could draw a line segment from t = -big number to t = big number.
If you want to plot it cleanly you will have to intersect these lines with the screen boundaries (x = 0, x = ScrW (), y = 0, y = ScrH ()) to get the range of t for which the line is onscreen.
If you really want the angle of the tangent line, it's atan2 (d touchy / d ang, d touchx / d ang), which returns an angle in radians.[/QUOTE]
Damn it, !cake. I wasn't expecting Calculus.
What exactly is [I]t[/I], and what kind of values do [I]linex [/I]and [I]liney [/I]return?
I'm guessing [I]t [/I]is a constant representing length, and [I]linex [/I]and [I]liney [/I]are the end points of the tangent at length [I]t[/I] away from the contact point.
Like this?
[t]http://s27.postimg.org/pqovg1ucz/tangent.png[/t]
[QUOTE=bobbleheadbob;47011380]Damn it, !cake. I wasn't expecting Calculus.[/QUOTE]
If you asked for a tangent and wasn't expecting calculus, then I don't know what Calculus is good for!
I got 2 questions:
1. Does someone know how to make a 3D2D clickable button?
2. Is the Initialize hook ran after the map is loaded and the map-based props are spawned?
Is there an alternative to ents.FindInCone when I want to check if another player can [B]see[/B] (doesn't have to be aiming) another player?
[QUOTE=ROFLBURGER;47011758]Is there an alternative to ents.FindInCone when I want to check if another player can [B]see[/B] (doesn't have to be aiming) another player?[/QUOTE]
You could probably use a combination of Vector.Dot and a trace.
[url]http://wiki.garrysmod.com/page/Vector/Dot[/url]
[QUOTE=ROFLBURGER;47011758]Is there an alternative to ents.FindInCone when I want to check if another player can [B]see[/B] (doesn't have to be aiming) another player?[/QUOTE]
Use a trace?
Sorry, you need to Log In to post a reply to this thread.