• What do you need help with? V3
    6,419 replies, posted
[QUOTE=Nexus435;36408246]Does anybody know what happened to string.dump?[/QUOTE] It got removed in the Beta I think, no idea why though.
[QUOTE=James xX;36409585]It got removed in the Beta I think, no idea why though.[/QUOTE] It disappeared from GM12 too.
Hey! I would like to set an required amount of time, before you can be a job in Dark RP. I have tried plenty of stuff, but can't seem to get it working. [QUOTE]EAM_POLICE = AddExtraTeam("Civil Protection", Color(0, 0, 255, 255), "models/player/police.mdl", [[Description.]], {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker"}, "cp", 4, 65, 0, true, true) [/QUOTE] Don't know if this is the right place to post this, i hope it is. :) Thanks in advance.
Revenger, This thread is for actual coders. You are supposed to post this in the request section. Tip : It's the last argument.
I can't get SWEP:FreezeMovement() to work at all. I've tried just returning false in that function, which I assumed would freeze me when I deploy the weapon, but it doesn't do anything. There really isn't any code I can post since I'd just post the function with return false in it. Any ideas?
The text in my menu is overlapping when it shouldn't be. I have no clue whats wrong [LUA] for k, v in pairs(LocalPlayer():GetWeapons() ) do local WeaponLoadOut = vgui.Create("DLabel", InventoryForeGroundMenu ) WeaponLoadOut:SetPos( 330, 50 ) WeaponLoadOut:SetFont("Trebuchet24" ) WeaponLoadOut:SetText( v:GetPrintName().. "\n" ) WeaponLoadOut:SizeToContents() end [/LUA] [IMG]http://gyazo.com/1e9832dda305d94e47ca12309155319a.png?1340237380[/IMG]
try setting the size before the position
[QUOTE=Banana Lord.;36417885]try setting the size before the position[/QUOTE] Still getting the same result.
[QUOTE=I Fail At Lua;36417932]Still getting the same result.[/QUOTE] You're setting the position of the labels the same for every one.
[QUOTE=skullorz;36418452]You're setting the position of the labels the same for every one.[/QUOTE] How would I go about setting it so the y values are 20 apart for each, so they don't overlap?
[QUOTE=I Fail At Lua;36418894]How would I go about setting it so the y values are 20 apart for each, so they don't overlap?[/QUOTE] [lua] WeaponLoadOut:SetPos( 330, 30+(20*k) ) //30 now because 50 was default. [/lua]
What is the best way to do volumetric fog, i.e. l localized fog in a cube, at runtime. I've been trying particles but they are a bit fps intense at the scale I'm using them. Any help is always appreciated.
Is there a way where I can call something like "Remove()" on an Entity to remove it from the world, without it being completely deleted? (Like I would want to call "Spawn()" on it later)
[QUOTE=ief014;36421772]Is there a way where I can call something like "Remove()" on an Entity to remove it from the world, without it being completely deleted? (Like I would want to call "Spawn()" on it later)[/QUOTE] * Make a invisible ghostcopy before deleting it? * Run another script where you can spawn your ent again. * Stop all actions like (de)activating [lua] function ENT:Think() if (self.STOP == 1) then return end -- in every darn function. -- content end function ENT:CostumRemovel(arg) if (arg == 1) then self.STOP = 1 ent:SetColor(255,255,255,0) elseif (arg == 0) then self.STOP = 0 ent:SetColor(255,255,255,255) end end self:CostumRemovel(1) -- (de)activating [/lua] Or in the ENT:Remove function, so you can use ent:Remove() as ON/OFF switch. [lua] function ENT:Remove() if (!self.STOP or self.STOP == 0) then self.STOP = 1 ent:SetColor(255,255,255,0) -- stuff elseif (self.STOP == 1) then self.STOP = 0 ent:SetColor(255,255,255,255) -- stuff end return false -- ent doesn't gets removed. end -- ent:Remove() and it's deactivated. ent:Remove() again and it's activated. -- You can use ent:KillSilent() or ent:Kill() to remove it. -- Or ent:Fire("Kill","",0) or ent:Fire("KillSilent","",0) [/lua]
okay so I'm a little confused how ENT.*value* stutf works. so heres a spawn hook [code]function GM:PlayerSpawn(ply) ply.timeAlive = 0 end[/code] and if I do [code]function GM:Think() for _,ply in pairs(player.GetAll()) do if ply:Alive() then ply.timeAlive++ end end [/code] will it work? but im having doubts with networking. Does only the server side sees that value and do I have to network it for client? Yes I know networking something every think is dumb. I'm basically asking if others had this situation.
Sorry wrong rating, was next to reply. But you can't do <variable>++ in Lua, you have to manually do variable=variable + 1 And yes that would work and it's only for the Lua state it's used on
[QUOTE=TheTrueAndy;36422773]* Make a invisible ghostcopy before deleting it? * Run another script where you can spawn your ent again. * Stop all actions like (de)activating [lua] function ENT:Think() if (self.STOP == 1) then return end -- in every darn function. -- content end function ENT:CostumRemovel(arg) if (arg == 1) then self.STOP = 1 ent:SetColor(255,255,255,0) elseif (arg == 0) then self.STOP = 0 ent:SetColor(255,255,255,255) end end self:CostumRemovel(1) -- (de)activating [/lua] Or in the ENT:Remove function, so you can use ent:Remove() as ON/OFF switch. [lua] function ENT:Remove() if (!self.STOP or self.STOP == 0) then self.STOP = 1 ent:SetColor(255,255,255,0) -- stuff elseif (self.STOP == 1) then self.STOP = 0 ent:SetColor(255,255,255,255) -- stuff end return false -- ent doesn't gets removed. end -- ent:Remove() and it's deactivated. ent:Remove() again and it's activated. -- You can use ent:KillSilent() or ent:Kill() to remove it. -- Or ent:Fire("Kill","",0) or ent:Fire("KillSilent","",0) [/lua][/QUOTE] I found another work-around to my problem by going in another direction, but I appreciate the help!
[QUOTE=aurum481;36428884]okay so I'm a little confused how ENT.*value* stutf works. so heres a spawn hook [code]function GM:PlayerSpawn(ply) ply.timeAlive = 0 end[/code] and if I do [code]function GM:Think() for _,ply in pairs(player.GetAll()) do if ply:Alive() then ply.timeAlive++ end end [/code] will it work? but im having doubts with networking. Does only the server side sees that value and do I have to network it for client? Yes I know networking something every think is dumb. I'm basically asking if others had this situation.[/QUOTE] I would do it like this: [lua] timer.Simple(1,function() for _,ply in pairs(player.GetAll()) do if ply.timealive == nil then ply.timealive = 0 end if ply:Alive() then ply.alive = ply.alive + 1 end if ply.timealive % 60 == 0 and ply.timealive % 10 == 0 then ply:SetNWInt("timealive",ply.timealive/60) end end end) [/lua] That increases player's alivetime every second by one. And if the timealive is divisible by 60 (one minute in seconds) it adds the timealive in minutes to player's networked integer. Then you could do this clientside: print(LocalPlayer():GetNWInt("timealive")) and it would give you the time alive in minutes. But you couldn't do print(LocalPlayer().timealive) clientside, since the value was set serverside. Hope it helped.
[QUOTE=ollie;36429911]I would do it like this: timer.Simple(1,function()for _,ply in pairs(player.GetAll()) doif ply.timealive == nil then ply.timealive = 0 endif ply:Alive() thenply.alive = ply.alive + 1endif ply.timealive % 60 == 0 and ply.timealive % 10 == 0 thenply:SetNWInt("timealive",ply.timealive/60)endendend) That increases player's alivetime every second by one. And if the timealive is divisible by 60 (one minute in seconds) it adds the timealive in minutes to player's networked integer. Then you could do this clientside: print(LocalPlayer():GetNWInt("timealive")) and it would give you the time alive in minutes. But you couldn't do print(LocalPlayer().timealive) clientside, since the value was set serverside. Hope it helped.[/QUOTE] That would just run it once one second after the file was loaded, you need to use timer.Create and do it properly. timer.Create( "TimeAliveCounter", 1, 0, function() stuff end ) It might be 0, 1 instead of 1, 0 - I can never remember.
Does any one know if it's more efficient to use lua particles or to just draw sprites, I keep ending up needing about 1100 particles the way I'm doing my gas clouds. It's really murdering my frame rate.
[QUOTE=Drakehawke;36431824]That would just run it once one second after the file was loaded, you need to use timer.Create and do it properly. timer.Create( "TimeAliveCounter", 1, 0, function() stuff end ) It might be 0, 1 instead of 1, 0 - I can never remember.[/QUOTE] Oh true, did not think of that.
What's the file.Find syntax in the gmod beta?
How can I get all the files from a folder? I tried doing: [lua] local cmdsfiles = file.FindInLua("../../commands" .. "*.lua") [/lua] but I'm not sure if it is right because the table returns empty... the folder structures are this: The init.lua folder: \addons\MyAddon\lua\autorun\server\ The folder I want to get the files from: \addons\MyAddon\lua\commands am I doing it wrong?
[QUOTE=Chessnut;36399239][lua] SWEP.ReloadSound = "none" [/lua] That's line 21.[/QUOTE] And??? Where should it be?
[QUOTE=elitefroggy;36462442]And??? Where should it be?[/QUOTE] Not where should it be, but rather, what it should be. it was meant to be something, but as it is "none", it won't play anything. Do you have a file for the reload sound somewhere?
[QUOTE=Stillnex;36462230]How can I get all the files from a folder? I tried doing: [lua] local cmdsfiles = file.FindInLua("../../commands" .. "*.lua") [/lua] but I'm not sure if it is right because the table returns empty... the folder structures are this: The init.lua folder: \addons\MyAddon\lua\autorun\server\ The folder I want to get the files from: \addons\MyAddon\lua\commands am I doing it wrong?[/QUOTE] Removed ../../ and put a ,true before the )
[QUOTE=skullorz;36462994]Removed ../../ and put a ,true before the )[/QUOTE] file.FindInLua does not take a second argument for a boolean to use the base folder. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index3c4e.html[/url]
[QUOTE=Stillnex;36462230]How can I get all the files from a folder? I tried doing: [lua] local cmdsfiles = file.FindInLua("../../commands" .. "*.lua") [/lua] but I'm not sure if it is right because the table returns empty... the folder structures are this: The init.lua folder: \addons\MyAddon\lua\autorun\server\ The folder I want to get the files from: \addons\MyAddon\lua\commands am I doing it wrong?[/QUOTE] "commands/*.lua"
-snip I'm stupid and don't check pages.-
When blurring a render target using pp/blurx and pp/blury (the g_blurx and g_blury shaders), I'm getting bits of image from the bottom of the RT blurred into the top. [url=http://postimage.org/image/t0bg6tef1/][img]http://s14.postimage.org/t0bg6tef1/eq2.jpg[/img][/url] This is probably because texture coordinates are set to wrap and not clamp, but wrap/clamp is a image flag and not a shader parameter (god damn valve) - is there any way to change the image flag of a RT, or otherwise force the engine to clamp instead of wrap texture coordinates?
Sorry, you need to Log In to post a reply to this thread.