• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=JasonMan34;52268469]TTT strips all of your weapons when a new round starts, then gives you the loadout weapons. Either they're loadout, or somewhere in the code there's a [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/Give]Player:Give[/url] that gives the weapon to the player[/QUOTE] I'll look around for it but the issue popped up just recently and I haven't touched the server files regarding anything remotely close to that recently, thank you though, looking now.
If I give a weapon to a player (with PLAYER:Give(class)) and the PlayerCanPickupWeapon returns false the weapon is still given. I know I just can run the hook manually and remove the weapon if it returns false but I dont think thats how its supposed to be. Am I doing anything wrong or is it just not working?
[QUOTE=Benn20002;52268638]If I give a weapon to a player (with PLAYER:Give(class)) and the PlayerCanPickupWeapon returns false the weapon is still given. I know I just can run the hook manually and remove the weapon if it returns false but I dont think thats how its supposed to be. Am I doing anything wrong or is it just not working?[/QUOTE] You're doing something wrong. If PlayerCanPickupWeapon returns false, the weapon is not given [editline]Question[/editline] Will [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/OBBMins]Entity:OBBMins[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/OBBMaxs]Entity:OBBMaxs[/url] always return the same values for a player?
[QUOTE=JasonMan34;52268649]You're doing something wrong. If PlayerCanPickupWeapon returns false, the weapon is not given [editline]Question[/editline] Will [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/OBBMins]Entity:OBBMins[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/OBBMaxs]Entity:OBBMaxs[/url] always return the same values for a player?[/QUOTE] No, they change based on if the player is standing or crouching. It works differently for other entities.
Is there a way I can compress large .txt files and write them to /data/ but still be able to read them properly?
[QUOTE=Sean Bean;52269215]Is there a way I can compress large .txt files and write them to /data/ but still be able to read them properly?[/QUOTE] [lua]file.Write("something.txt",util.Compress(stringvarhere)) stringvarhere = util.Decompress(file.Read("something.txt"))[/lua] This won't help with speed or anything though. Why are you trying to compress the file if you aren't networking or anything with it?
How do I make it so a function will run after clicking on a chat line?
snip
[QUOTE=Sean Bean;52269215]Is there a way I can compress large .txt files and write them to /data/ but still be able to read them properly?[/QUOTE] Revenge282's solution is your only way, but it's just going to be even slower if you are reading and writing to it all the time since it then has to spend time decompressing and recompressing. What kind of data are you storing?
Is there any way to make players not collide through each other but still make bullets shot from one player aimed at another still hit? Currently it seems this [code]hook.Add("ShouldCollide", "nocollideplayers", function(a, b) if a:IsPlayer() and b:IsPlayer() then return false end end)[/code] and SetCustomCollisionCheck works, but shooting players won't work.
[QUOTE=Tenrys;52271951]Is there any way to make players not collide through each other but still make bullets shot from one player aimed at another still hit? Currently it seems this [code]hook.Add("ShouldCollide", "nocollideplayers", function(a, b) if a:IsPlayer() and b:IsPlayer() then return false end end)[/code] and SetCustomCollisionCheck works, but shooting players won't work.[/QUOTE] That should work fine. Bullets are just traces internally -- if bullets weren't working because of that, all traces hitting the player wouldn't.
Is there a way to disable both crouching and jumping?
[QUOTE=Haina;52272115]Is there a way to disable both crouching and jumping?[/QUOTE] Remove the keys in CreateMove.
[QUOTE=Caaiin;52268476]I'll look around for it but the issue popped up just recently and I haven't touched the server files regarding anything remotely close to that recently, thank you though, looking now.[/QUOTE] Both item's ( when functioning in the second round ) are breaking the rules of item limitations/allowances. E.g Traitor team is the only one allowed to have martyrdom, however Innocents after their T round can still persist with the passive if they don't die with it on, same with Eshield being limited to detectives ONLY. Another note: Eshields client side effects ( outline on hands ) disappear, only having the effects and sounds of the Eshield. I've tried adding the following but nothings worked so far: [code] hook.Add( "TTTPrepareRound", "StripEnergyShield", function() for k,ply in pairs( player.GetAll() ) do if ply:HasEnergyShield() then ply:StripEnergyShield() end end end) if SERVER then hook.Add("TTTPrepareRound", "StripEnergyShield", function(ply, equip, is_item) if ply:HasEnergyShield() then ply:StripEnergyShield() end end) end if CLIENT then hook.Add("TTTPrepareRound", "StripEnergyShield", function(ply, equip, is_item) if ply:HasEnergyShield() then ply:StripEnergyShield() end end) end [/code]
[QUOTE=Moat;52272468]Remove the code underneath the first hook. Make sure it is being ran when preparing begins, and double check if the "HasEnergyShield" and "StripEnergyShield" are both shared. If they aren't shared, make sure you are calling them in the appropriate realm; I'd imagine you'd have to do some networking or something of the sort. TTTPrepareRound does not have a player argument, actually, no argument at all. You need to loop over each player and do your energy shield check in there. The bottom two hooks just replaced the code that could actually work (the first hook), given the identifiers for each hook are the same; it just replaced it.[/QUOTE] Alright well I've done what you've said and removed the first two and I'm left with just this. [code] hook.Add( "TTTPrepareRound", "StripEnergyShield", function() for k,ply in pairs( player.GetAll() ) do if ply:HasEnergyShield() then ply:StripEnergyShield() end end end) [/code] Is this right? It didn't work on the live lua update, but I haven't restarted server.
[QUOTE=Caaiin;52272522]Alright well I've done what you've said and removed the first two and I'm left with just this. [code] hook.Add( "TTTPrepareRound", "StripEnergyShield", function() for k,ply in pairs( player.GetAll() ) do if ply:HasEnergyShield() then ply:StripEnergyShield() end end end) [/code] Is this right? It didn't work on the live lua update, but I haven't restarted server.[/QUOTE] This will work if: 1) The code is being ran in a shared file 2) Player:HasEnergyShield is a valid function 3) Player:StripEnergyShield is a valid function
Hello, I am currently looking for the best way to do the following: Make it so when i got am using a specific weapon, i'll be able to use it to spawn a specific prop. - This part is obviously easy. What i need help is how can i show the player clientside where the prop will be placed, I obviously cant just create a clientside prop every frame the player moves. So is there a way to render a prop where the player is currently looking at? Thanks.
[URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/stools/emitter.lua#L152-L179"]You can make a ClientsideModel and move it like the emitter tool does[/URL] [editline]25th May 2017[/editline] You don't need to create it every frame the player moves, only once, then move it. It's not laggy, and it's used in the default tools so it's fine to do [editline]25th May 2017[/editline] I found the code the toolgun uses, you could adapt it to work without a toolgun pretty easily: [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua[/url]
[QUOTE=JasonMan34;52272648]This will work if: 1) The code is being ran in a shared file 2) Player:HasEnergyShield is a valid function 3) Player:StripEnergyShield is a valid function[/QUOTE] a) How do I know if it's in a shared file ( I'm new ) 2/3 ) The creator has told me that those functions are valid but I'm not 100% sure as I can't find where it's defined.
Has anyone ever tried using stencils to make a 'hole' in a wall in a map before? If not, how would you even draw what's on the other side of a wall using stencils?
so i have this npc zombie drop system but it wont work [lua] [ERROR] gamemodes/metro_online/gamemode/cl_init.lua:90: ')' expected (to close '(' at line 78) near '<eof>' 1. unknown - gamemodes/metro_online/gamemode/cl_init.lua:0 [lua] code:if CLIENT then return end local AmmoList = { "item_ammo_pistol", "item_ammo_smg1", "item_ammo_ar2", "item_ammo_357", "item_ammo_crossbow", "item_box_buckshot", "item_rpg_round" } local LowList = { "item_battery", "item_healthkit", "item_healthvial", "weapon_pistol", "weapon_smg1", "weapon_frag" } local MedList = { "weapon_ar2", "weapon_shotgun", "item_ammo_ar2_altfire", "item_ammo_smg1_grenade" } local HighList = { "weapon_357", "weapon_crossbow", "weapon_rpg", "weapon_physcannon" } hook.Add("OnNPCKilled", "DropWeaponOnNPCKilled", function(npc, killer) local rndweapon = nil chance = math.random(1,100) if chance < 50 then return end if chance > 51 && chance < 70 then rndweapon = table.Random(AmmoList) end if chance > 71 && chance < 85 then rndweapon = table.Random(LowList) end if chance > 86 && chance < 95 then rndweapon = table.Random(MedList) end if chance > 96 && chance < 100 then rndweapon = table.Random(HighList) end weapon = ents.Create(rndweapon) weapon:SetPos(npc:LocalToWorld(npc:OBBCenter())) weapon:Spawn() end
The error tells you what to do. You forgot a bracket at the end
[QUOTE=MPan1;52276894]The error tells you what to do. You forgot a bracket at the end[/QUOTE] english isnt my native langague can you show me?
[QUOTE=RasmusG5;52277052]english isnt my native langague can you show me?[/QUOTE] He already told you exactly what to do [B]:90: ')' expected[/B] Literally just put a bracket at the end of line 90
[QUOTE=RasmusG5;52276865]so i have this npc zombie drop system but it wont work [lua]hook.Add( -- <--------------- !!!!!!!!!!!!! "OnNPCKilled", "DropWeaponOnNPCKilled", function(npc, killer) local rndweapon = nil chance = math.random(1,100) if chance < 50 then return end if chance > 51 && chance < 70 then rndweapon = table.Random(AmmoList) end if chance > 71 && chance < 85 then rndweapon = table.Random(LowList) end if chance > 86 && chance < 95 then rndweapon = table.Random(MedList) end if chance > 96 && chance < 100 then rndweapon = table.Random(HighList) end weapon = ents.Create(rndweapon) weapon:SetPos(npc:LocalToWorld(npc:OBBCenter())) weapon:Spawn() end -- <----------- ????[/lua][/QUOTE] I can't make it clearer than that
How to trace to ground from outside of the map? [editline]27th May 2017[/editline] or how to get height of the skybox?
Get a valid point from inside of the world, example a player position, if he's not on the ground, just shoot a trace above and then check if you are hitting skybox (i would check hit result material)
It's important to note that the skybox height is never guaranteed to be the same throughout the map. And I don't really see a good way to trace from outside the map.
What's the best way to get the distance from the player to the ground beneath them?
[QUOTE=dannyf127;52280510]What's the best way to get the distance from the player to the ground beneath them?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/TraceEntity]util.TraceEntity[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/TraceLine]util.TraceLine[/url]. Depends what you wanna do
Sorry, you need to Log In to post a reply to this thread.