• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=blackwidowman;52772596]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[/QUOTE] [URL="https://github.com/Facepunch/garrysmod-issues/issues/1797"]Might be a false alarm[/URL]
How do i store a swep function as a non-local variable to use part of the OG code on a replacement? I need to add a function to TakePrimaryAmmo which makes it not consume ammo if an weapon ent suffices certain requirements WHILE keeping its original functionality, calling the original function incase the weapon doesn't have the specific modifier is the best solution, but i've been trying for like 5 hours or so and couldn't get too far. Any light on that? I've even tried to replicate the function's original behaviour but it didn't work well on one specific base.
I am trying to modify a DComboBox, but I cant figure out how I can remove the default text: [IMG]https://i.gyazo.com/34cb2f4fe52b911e0054934fdd8c3f4d.png[/IMG] I am overwriting the Paint function of the DComboBox but thats not removing the text.
[QUOTE=Matsilagi;52773635]How do i store a swep function as a non-local variable to use part of the OG code on a replacement? I need to add a function to TakePrimaryAmmo which makes it not consume ammo if an weapon ent suffices certain requirements WHILE keeping its original functionality, calling the original function incase the weapon doesn't have the specific modifier is the best solution, but i've been trying for like 5 hours or so and couldn't get too far. Any light on that? I've even tried to replicate the function's original behaviour but it didn't work well on one specific base.[/QUOTE] It would be better to modify WEAPON.SetClip* and PLAYER.RemoveAmmo directly (which is what TakePrimaryAmmo uses internally). [code]local tInfinite = {} function InfiniteAmmo(pEntity, bInfinite) if (pEntity:IsPlayer() or pEntity:IsNPC()) then tInfinite[pPlayer] = bInfinite and true or nil end end function HasInfiniteAmmo(pPlayer) return tInfinite[pPlayer] == true end hook.Add("EntityRemoved", "InfiniteAmmo", function(pEntity) if (pEntity:IsPlayer() or pEntity:IsNPC()) then tInfinite[pEntity] = nil -- Memory cleanup end end) local WEAPON = FindMetaTable("Weapon") local fSetClip1 = WEAPON.SetClip1 function WEAPON:SetClip1(...) if (not HasInfiniteAmmo(self:GetOwner())) then fSetClip1(self, ...) end end local fSetClip2 = WEAPON.SetClip2 function WEAPON:SetClip2(...) if (not HasInfiniteAmmo(self:GetOwner())) then fSetClip2(self, ...) end end local PLAYER = FindMetaTable("Player") local fRemoveAmmo = PLAYER.RemoveAmmo function PLAYER:RemoveAmmo(...) if (not HasInfiniteAmmo(self)) then fRemoveAmmo(self, ...) end end[/code] Of course, you'll need to add some additional code to give the player ammo while infinite ammo is activated if they are empty, but this gives you a general idea.
[QUOTE=Benn20002;52773918]I am trying to modify a DComboBox, but I cant figure out how I can remove the default text: [IMG]https://i.gyazo.com/34cb2f4fe52b911e0054934fdd8c3f4d.png[/IMG] I am overwriting the Paint function of the DComboBox but thats not removing the text.[/QUOTE] Take a look at child elements and/read the source code of it, take a look if there's a combobox.DLabel inside of it
Is it possible for Gmod to access custom DLL's and such? I'd be surprised if it did since that has massive security implications, but I was wondering if I could hook my computer's AlienFX to the game's Physgun color (since I have a multicolor Physgun). Would be really neat but I doubt I can do that.
[QUOTE=buu342;52774302]Is it possible for Gmod to access custom DLL's and such? I'd be surprised if it did since that has massive security implications, but I was wondering if I could hook my computer's AlienFX to the game's Physgun color (since I have a multicolor Physgun). Would be really neat but I doubt I can do that.[/QUOTE] You can from a GMod module, but not directly from the Lua state.
[QUOTE=gonzalolog;52774166]Take a look at child elements and/read the source code of it, take a look if there's a combobox.DLabel inside of it[/QUOTE] I already tried using PrintTable(dcbox:GetChildren()), but there's only one DPanel: 1 = Panel: [name:DPanel][class:Panel][0,0,64,24] I also tried looking up the [URL="https://github.com/Facepunch/garrysmod/blob/c3ea573be9aae395cec85688fc50a3ade67fac95/garrysmod/lua/vgui/dcombobox.lua"]source code[/URL], but I couldnt find anything except that its base is a DButton (But I also couldnt figure out how I can access the DButton Panel if there even is one..).
[QUOTE=Benn20002;52774596]I already tried using PrintTable(dcbox:GetChildren()), but there's only one DPanel: 1 = Panel: [name:DPanel][class:Panel][0,0,64,24] I also tried looking up the [URL="https://github.com/Facepunch/garrysmod/blob/c3ea573be9aae395cec85688fc50a3ade67fac95/garrysmod/lua/vgui/dcombobox.lua"]source code[/URL], but I couldnt find anything except that its base is a DButton (But I also couldnt figure out how I can access the DButton Panel if there even is one..).[/QUOTE] DComboBox' base is DButton, whose base is DLabel, whose base is Label. It doesn't have a button or a label as a child, it inherits all of that functionality directly. I don't think there's a way you can stop a label's painting, but you can always just set the text to an empty string.
[QUOTE=Benn20002;52774596]I already tried using PrintTable(dcbox:GetChildren()), but there's only one DPanel: 1 = Panel: [name:DPanel][class:Panel][0,0,64,24] I also tried looking up the [URL="https://github.com/Facepunch/garrysmod/blob/c3ea573be9aae395cec85688fc50a3ade67fac95/garrysmod/lua/vgui/dcombobox.lua"]source code[/URL], but I couldnt find anything except that its base is a DButton (But I also couldnt figure out how I can access the DButton Panel if there even is one..).[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DComboBox/SetValue]DComboBox:SetValue[/url]?
Trying to play a avi video with sound from a url on a Panel. What's the best way to go about that? I tried vgui.Create("HTML") but that just returns a grey screen when I do OpenURL("videolink")
[QUOTE=pilot;52775386]Trying to play a avi video with sound from a url on a Panel. What's the best way to go about that? I tried vgui.Create("HTML") but that just returns a grey screen when I do OpenURL("videolink")[/QUOTE] You can't play .avi files using web. (Even the newest Chrome or whatever)
[QUOTE=Robotboy655;52775788]You can't play .avi files using web. (Even the newest Chrome or whatever)[/QUOTE] Is there a video file type you recommend?
webm? mp4?
Is there a way to create physically simulated sprites? ex: Sparks with different sprites. I don't want to create and use orange box particle systems if I don't have to.
[QUOTE=gonzalolog;52777084]webm? mp4?[/QUOTE] Neither worked. Gif's are the only way. Nevertheless I have one more question. How would I go about shaking a Derma panel indefinitely? I think I need to do something fancy with Derma_Anim although I'm not that good with math to figure out some kind of function that will get something to rotate or even shake.
my entity makes this error when spawned on my custom gamemode but not it sandbox [lua]ERROR: Trying to derive entity loot_barrel from non existant entity base_gmodentity! ERROR: Trying to derive entity loot_barrel from non existant entity base_gmodentity! ERROR: Trying to derive entity loot_barrel from non existant entity base_gmodentity! [/lua] i got no other errors
Yeah you are trying to use a sandbox-only entity as base in a non sandbox derived gamemode.
[QUOTE=Robotboy655;52779605]Yeah you are trying to use a sandbox-only entity as base in a non sandbox derived gamemode.[/QUOTE] do i need to make my own entity base to my gamemode or can i just copy sandbox one?
[QUOTE=Robotboy655;52779605]Yeah you are trying to use a sandbox-only entity as base in a non sandbox derived gamemode.[/QUOTE] Why is it Sandbox only? I don't see any functions/hooks inside of the base that would make it justified as being so.
[QUOTE=code_gs;52779615]Why is it Sandbox only? I don't see any functions/hooks inside of the base that would make it justified as being so.[/QUOTE] Because it was created to be used in Sandbox as a base for all tools?
so what i should do?
[QUOTE=Robotboy655;52779621]Because it was created to be used in Sandbox as a base for all tools?[/QUOTE] I think what code_gs is saying is that it should be made gamemode-independent. To which I say: [url=https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/base_gmodentity.lua]Make a pull request?[/url]
[QUOTE=NeatNit;52779810]I think what code_gs is saying is that it should be made gamemode-independent. To which I say: [url=https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/base_gmodentity.lua]Make a pull request?[/url][/QUOTE] There are a lot of entities defined in the base/sandbox gamemodes that aren't gamemode dependent, so I would rather like to figure out why they were placed there in the first place before even considering moving them all.
[QUOTE=code_gs;52779821]There are a lot of entities defined in the base/sandbox gamemodes that aren't gamemode dependent, so I would rather like to figure out why they were placed there in the first place before even considering moving them all.[/QUOTE] Shoot first and ask questions later. :P
[QUOTE=RasmusG5;52779684]so what i should do?[/QUOTE] Copy it, I guess.
I'm having a problem where whenever I die, my camera doesn't get reset after death. So the player spawns but I'm stuck looking at my old dead body. [IMG]https://steamuserimages-a.akamaihd.net/ugc/879750610979152841/EB7A41AD88D93D37F031BB0AAFE07F664EF7C995/[/IMG] just letting you know now the code was not written by me, it was written by someone who didn't speak english as their first language, so things will probably be misspelled. [CODE] function GM:PlayerDeath( pl, weapon, killer ) local teams = team.NumPlayers( 4 ) + team.NumPlayers( 1 ) //if his team is 4 ( Team human ) then reset his frags ( kills ) to 0 and set his team to 2. ( zombie spectator ) // we also give him a respawn delay, so he has to wait a little before he can respawn. if ( pl:Team() == 4 ) then if ( HumanClasses[ pl:GetHumanClass() ].deathFunc ) then HumanClasses[ pl:GetHumanClass() ].deathFunc( pl ) end ZOMBIE_PLAYERS[ pl:SteamID() ] = true pl:SetTeam( 2 ) pl:SetFrags( 0 ) pl.nextspawn = deathTimeTable[ pl:GetZombieClass() ].waitTime GAMEMODE:setDeathTime( pl.nextspawn, pl ) pl.CanRespawn = false end if ( pl:Team() == 3 ) then if ( ZombieClasses[ pl:GetZombieClass() ].deathFunc ) then ZombieClasses[ pl:GetZombieClass() ].deathFunc( pl, weapon, killer ) end pl:SetTeam( 2 ) pl.nextspawn = deathTimeTable[ pl:GetZombieClass() ].waitTime GAMEMODE:setDeathTime( pl.nextspawn, pl ) pl.CanRespawn = false end if pl ~= killer && killer:IsPlayer() then killer:AddFrags( 1 ) end if ( killer:IsPlayer() && killer:Team() == 4 && RewardsTable[ killer:GetHumanClass() ][ killer:Frags() ] ) then rewardWeapon( killer ) end if ( !HALF_LIFE && GetInfliction() > 48 && !ENDING_ACTIVE && !LASTHUMAN ) then HALF_LIFE = true; GAMEMODE.musicTime = 0; end if ( team.NumPlayers( 4 ) == 0 && !ENDING_ACTIVE ) then GAMEMODE.gameState = 6; GAMEMODE.gameTime = 0; end if ( teams == 1 ) then GAMEMODE:LastHuman() end print( pl.nextspawn, CurTime(),deathTimeTable[ pl:GetZombieClass() ].waitTime ) end //Respawn delay get's handled here, after the timer eaches 0 we set his respawn value to true so he can respawn. function GM:PlayerDeathThink( pl ) if ( !pl.nextspawn ) then pl.nextspawn = CurTime() + 3 end if ( CurTime() >= pl.nextspawn ) then if ( pl:Team() == 2 ) then pl.CanRespawn = true end deathTimeTable[ pl:GetZombieClass() ].waitTime = CurTime() + deathTimeTable[ pl:GetZombieClass() ].nextSpawn end if ( pl:Team() == 2 && pl.CanRespawn && pl:KeyDown( IN_ATTACK ) ) then pl:SetTeam( 3 ) pl:Spawn() end end [/CODE]
What's the difference between calling [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/PhysicsInit]Entity:PhysicsInit[/url] with SOLID_BBOX compared to SOLID_OBB? I know the wiki says that SOLID_BBOX is meant to "use the entity's axis-aligned bounding box for collisions", and SOLID_OBB is meant to "use the entity's object-aligned bounding box for collisions", but this doesn't really make any sense to me, or explain why this would make a difference whatsoever. For an entity with physics created through [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetCollisionBounds]Entity:SetCollisionBounds[/url], does it matter which one I use?
BBOX is aligned with the world, OBB is aligned with rotation. SetCollisionBounds applies to both iirc
[QUOTE=code_gs;52780907]BBOX is aligned with the world, OBB is aligned with rotation. SetCollisionBounds applies to both iirc[/QUOTE] Doesn't that mean OBB is always going to be better and more accurate for every map?
Sorry, you need to Log In to post a reply to this thread.