[QUOTE=residualgrub;52765126]So I am trying to get the material type of the ground the player is standing on using something to the affect of this ply:GetGroundEntity():GetMaterialType() This works well on everything but the world. The world always returns 48 no matter what. How do I get the material type of the portion of the world the player is currently standing on? I can't even find what 48 represents when it comes to the MAT Enumerations its not listed.[/QUOTE]
48 doesn't represent anything because GetGroundEntity() will return the entity you are standing on, the world isn't an entity. What you can use is a tracer looking down to the player, in the traceresult table you can find the material.
EDIT: Something like this
[CODE]tr = LocalPlayer():GetEyeTrace()
print(tr.MatType)[/CODE]
will return the mat type of what the player is looking at
uh apparently malwarebytes detected that garrysmod.exe is sending outbound to catbox.moe and I'm wondering how on earth I'm supposed to figure out which addon is doing this without disabling each one
like they must be using a code scrambler and I'm wondering what I should be mass CTRL+Fing to find scrambled code.
[QUOTE=ROFLBURGER;52765476]uh apparently malwarebytes detected that garrysmod is uploading files to catbox.moe and I'm wondering how on earth I'm supposed to figure out which addon is doing this without disabling each one
like they must be using a code scrambler and I'm wondering what I should be mass CTRL+Fing to find scrambled code.[/QUOTE]
I'm going to guess that they're using http.Post so you could just detour that or HTTP and check if the URL is catbox.moe then print debug.getinfo(2), should tell you what file it is and what line it's on (source & currentline).
[editline]10th October 2017[/editline]
Untested but I'm pretty certain it'll work.
[code]local oHTTP = HTTP
function HTTP(params)
if (params.url:find("catbox.moe") and params.method == "POST") then
local info = debug.getinfo(2)
print(info.short_src, info.currentline)
end
return oHTTP(params)
end[/code]
[QUOTE=txike;52765487]I'm going to guess that they're using http.Post so you could just detour that and check if the URL is catbox.moe then print debug.getinfo(2), should tell you what file it is and what line it's on (source & currentline).[/QUOTE]
I found only 1 addon using http.post however it's not a catbox link and the code shouldn't run since I'm playing on a non-dedicated server.
[lua]
if SERVER then
// TRACKER, for all of my addons ###########################################################################
local name = "Nombat"
slaugh7ersAddons = (slaugh7ersAddons or {})
if !table.HasValue(slaugh7ersAddons,name) then table.insert(slaugh7ersAddons,name) end
timer.Create( "slaugh7erAddonsReport",10,1,function()
if !game:IsDedicated() or game.SinglePlayer() then return end
local port = string.Explode(":",game.GetIPAddress())[2]
local addons = string.Implode( "<br>", slaugh7ersAddons )
local URL = "http://slaugh7er-zombierp.nn.pe/gmodtracker/index.php/?port=" .. port .. "&data=" .. addons
http.Post( URL, {} )
end )
// TRACKER, for all of my addons ###########################################################################
end
[/lua]
I still don't quite get what ENT.Type and ENT.Base and all those ENT variables actually do.
Is there a list of them somewhere?
If im making an entity and then setting a SetNWString ie set to "Yo"
and then I create another entity and set a SetNWString to "NoYo"
It seems to set all the entities to the latest NW string. If i'm spawning the same entity and setting different network vars is this a bad idea? The only thing I could think of is making a new variable name each time maybe by incrementing but I don't think it's possible
local thevar(increment this somehow?) = ents.Create( "entity" )
[QUOTE=Shendow;52765608]Are you actually sure you are changing the NWString of [B]different [/B]entities? Before setting the NWString, print the entity and see if the entity index matches with any other printed entity.[/QUOTE]
Well no, but i'm unsure how to create "NEW" entities in a new variable because you can't concat variables
Ie same function will loop spawning a new entity every 60 seconds with different nwstrings. I'm probably explaining it horribly
Actually they have different entIndex
[QUOTE=blackwidowman;52765614]Well no, but i'm unsure how to create "NEW" entities in a new variable because you can't concat variables
Ie same function will loop spawning a new entity every 60 seconds with different nwstrings. I'm probably explaining it horribly[/QUOTE]
Why do you need that many variables? Sorry, just want to know
[QUOTE=MPan1;52765628]Why do you need that many variables? Sorry, just want to know[/QUOTE]
I don't I just want to spawn an entity and set a network variable ie 5 times with different network vars. But because its in the same variable it sets them all to the same variable I think?
How do I stop clients joining my server and throwing errors about other server's addons/code? I have sv_allowcslua set to 0 and sv_cheats set 0. Yet specific few players manage to "execute" clientsided code that is not on my server. It is quite fucking annoying when they're spamming my clientside_errors.txt with useless shit.
[code][ERROR] lua/weapons/animagus_cat2/shared.lua:179: Tried to use a NULL entity!
1. GetModel - [C]:-1
2. MorphToHuman - lua/weapons/animagus_cat2/shared.lua:179
3. RemoveSelf - lua/weapons/animagus_cat2/shared.lua:94
4. unknown - lua/weapons/animagus_cat2/shared.lua:82
[ERROR] lua/weapons/eoti_werewolf_swep/shared.lua:245: Tried to use a NULL entity!
1. GetModel - [C]:-1
2. MorphToHuman - lua/weapons/eoti_werewolf_swep/shared.lua:245
3. RemoveSelf - lua/weapons/eoti_werewolf_swep/shared.lua:145
4. unknown - lua/weapons/eoti_werewolf_swep/shared.lua:133
[/code]
Also why are some clients missing fonts
[code]SetFontInternal: font doesn't exist (TargetIDSmall)
SetFontInternal: font doesn't exist (DefaultFixedDropShadow)
SetFontInternal: font doesn't exist (DefaultFixed)
SetFontInternal: font doesn't exist (TargetIDSmall)
SetFontInternal: font doesn't exist (DefaultFixedDropShadow)[/code]
Sorry. So basically this below will run 5 times and create 5 entities.
But I want the network string to be specific to the entity just create but it seems to overwrite them all
[CODE]
local chairstatus = ents.Create( "chairstatus" )
chairstatus:SetPos(randomlocation)
chairstatus:SetNWString("YoStatus", randomString)
chairstatuse:Spawn()
[/CODE]
I have datatables setup already
[QUOTE=Moat;52765683]You're not using them correctly then. [URL="http://wiki.garrysmod.com/page/Networking_Entities"]Here's a tutorial.[/URL][/QUOTE]
I feel like a idiot for mixing that up with NW strings. Thank you! But it still has the same problem :(. It still seems to overlap other entities values
[CODE]
local chairstatus = ents.Create( "chairstatus" )
chairstatus:SetPos(randomlocation)
chairstatus:SetYo(randomValue)
chairstatuse:Spawn()
[/CODE]
After creating a few entities I then try retrieve the value from the entity itself. Note that it gives me the last value set in the datatable and not the value set on the entity when this entity was created
[CODE]
print(self:GetYo())
[/CODE]
[QUOTE=Moat;52765762]Is "randomValue" ever changed?[/QUOTE]
Yes which is why I cant have every entity with the same value. Any ideas?
I've tested having it print the randomValue each time the entity spawns
You've misspelt your "chairstatuse" variable on your [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Spawn]Entity:Spawn[/url] call, so you're probably erroring after the first spawn.
Post the [i]full[/i] code then. Include the loop and where you define the random variables and the printing etc
[QUOTE=Gfoose;52765655]How do I stop clients joining my server and throwing errors about other server's addons/code? I have sv_allowcslua set to 0 and sv_cheats set 0. Yet specific few players manage to "execute" clientsided code that is not on my server. It is quite fucking annoying when they're spamming my clientside_errors.txt with useless shit.
[code][ERROR] lua/weapons/animagus_cat2/shared.lua:179: Tried to use a NULL entity!
1. GetModel - [C]:-1
2. MorphToHuman - lua/weapons/animagus_cat2/shared.lua:179
3. RemoveSelf - lua/weapons/animagus_cat2/shared.lua:94
4. unknown - lua/weapons/animagus_cat2/shared.lua:82
[ERROR] lua/weapons/eoti_werewolf_swep/shared.lua:245: Tried to use a NULL entity!
1. GetModel - [C]:-1
2. MorphToHuman - lua/weapons/eoti_werewolf_swep/shared.lua:245
3. RemoveSelf - lua/weapons/eoti_werewolf_swep/shared.lua:145
4. unknown - lua/weapons/eoti_werewolf_swep/shared.lua:133
[/code]
Also why are some clients missing fonts
[code]SetFontInternal: font doesn't exist (TargetIDSmall)
SetFontInternal: font doesn't exist (DefaultFixedDropShadow)
SetFontInternal: font doesn't exist (DefaultFixed)
SetFontInternal: font doesn't exist (TargetIDSmall)
SetFontInternal: font doesn't exist (DefaultFixedDropShadow)[/code][/QUOTE]
I think some latest Windows 10 update (or something) make some fonts deleted or something, I have seen a whole bunch of tickets with fonts missing. (Tahoma and Helvetica mostly)
Solved it. I stored the getYo in a variable on the entity and was using that before but getting the value directly instead of the variable and now it works great
Thank you everyone who helped
[QUOTE=MPan1;52765519]I still don't quite get what ENT.Type and ENT.Base and all those ENT variables actually do.
Is there a list of them somewhere?[/QUOTE]
Just want to note that ENT.Base is for inheritance purposes in Lua, and ENT.Type is for the engine to set the entity class internally.
How does one properly use the "HL1GaussBeam" effect?
[QUOTE=DarkDragonLov;52767665]How does one properly use the "HL1GaussBeam" effect?[/QUOTE]
[url]https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/hl1/hl1_fx_gauss.cpp#L35-L114[/url]
Looks like it uses a hack to encode the entity index and attachment in one.
[QUOTE=code_gs;52767686][url]https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/hl1/hl1_fx_gauss.cpp#L35-L114[/url]
Looks like it uses a hack to encode the entity index and attachment in one.[/QUOTE]
Helpful I guess, but I still don't know or understand how to use it through Lua in Garry's Mod.
There's this, or what's the effect name for the cannon on the buggy?
[QUOTE=DarkDragonLov;52767737]Helpful I guess, but I still don't know or understand how to use it through Lua in Garry's Mod.
There's this, or what's the effect name for the cannon on the buggy?[/QUOTE]
[url]https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/shared/hl1/hl1mp_weapon_gauss.cpp#L448-L456[/url]
The variables for the data here correspond to [URL="https://wiki.garrysmod.com/page/Category:CEffectData"]EffectData[/URL] functions. With that, your Lua code will look like:
[code]local data = EffectData()
data:SetOrigin(end_position_of_beam)
if (CLIENT) then
data:SetEntity(Player)
else
data:SetEntIndex(pPlayer:EntIndex())
end
--data:SetFlags(1) -- Enable for secondary fire beam
util.Effect("HL1GaussBeam", data)[/code]
So I am trying to use EmitSound to play sounds in rapid succession but each time it plays a sound it cuts off the previous sound early. Why is this and is there a way to get it to stop cutting off the previous sound? If not is there another sound function that will not cut the previous sound off? Note that I have a table of sounds I am choosing files from at random in the EmitSound function.
[QUOTE=residualgrub;52767808]So I am trying to use EmitSound to play sounds in rapid succession but each time it plays a sound it cuts off the previous sound early. Why is this and is there a way to get it to stop cutting off the previous sound? If not is there another sound function that will not cut the previous sound off? Note that I have a table of sounds I am choosing files from at random in the EmitSound function.[/QUOTE]
It's probably your channel option in EmitSound -- iirc it can only play one sound per channel. If you want to play the sound in the world, EmitSound is your best option. If you just want to play it to the client with no regard to world position, you can use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/PlaySound]surface.PlaySound[/url].
[QUOTE=code_gs;52767831]It's probably your channel option in EmitSound -- iirc it can only play one sound per channel. If you want to play the sound in the world, EmitSound is your best option. If you just want to play it to the client with no regard to world position, you can use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/PlaySound]surface.PlaySound[/url].[/QUOTE]
Ya I have to play it in the world. So essentially the source engine has no set system for this in regards to playing sounds in the world?
[QUOTE=code_gs;52767801][url]https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/shared/hl1/hl1mp_weapon_gauss.cpp#L448-L456[/url]
The variables for the data here correspond to [URL="https://wiki.garrysmod.com/page/Category:CEffectData"]EffectData[/URL] functions. With that, your Lua code will look like:
[code]local data = EffectData()
data:SetOrigin(end_position_of_beam)
if (CLIENT) then
data:SetEntity(Player)
else
data:SetEntIndex(pPlayer:EntIndex())
end
--data:SetFlags(1) -- Enable for secondary fire beam
util.Effect("HL1GaussBeam", data)[/code][/QUOTE]
Thank you! I see nothing though
[code] local effectdata = EffectData()
effectdata:SetOrigin(ply:GetEyeTrace().HitPos)
if CLIENT then
effectdata:SetEntity(ply)
else
effectdata:SetEntIndex(ply:EntIndex())
end
util.Effect( "HL1GaussBeam", effectdata )[/code]
[QUOTE=residualgrub;52767918]Ya I have to play it in the world. So essentially the source engine has no set system for this in regards to playing sounds in the world?[/QUOTE]
It's system is EmitSound, which has multiple channels.
I'm failing terribly at modifying the draw.TextRotated function to work inside a panel.
I've tried dozens of combinations, but my math is failing me.
Has anyone else done this already?
For reference, the function is on this page [URL]http://wiki.garrysmod.com/page/cam/PushModelMatrix[/URL]
EDIT:
Solved it, here's the code in case anyone else has the problem.
[code]function PANEL:DrawRotatedText(text, x, y, color, font, ang) render.PushFilterMag(TEXFILTER.ANISOTROPIC)
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
local cx, cy = self:LocalToScreen(0, 0)
surface.SetFont(font)
local textWidth, textHeight = surface.GetTextSize(text)
surface.SetTextColor(color)
surface.SetTextPos(-textWidth / 2, -textHeight / 2)
local m = Matrix()
-- Negate the panel's translatiob
m:Translate(Vector(cx + y, cy + x, 0))
m:SetAngles(Angle(0, ang, 0))
m:Translate(Vector(-cx, -cy, 0))
cam.PushModelMatrix(m)
surface.DrawText(text)
cam.PopModelMatrix()
render.PopFilterMag()
render.PopFilterMin()
end[/code]
I remember a while ago there was a post about addons causing servers to crash becaue hackers could spam net messages.
How would someone secure the server against that? Or is it not possible
Sorry, you need to Log In to post a reply to this thread.