[QUOTE=GGG KILLER;49406037]Dumb question but after reading Lua docs I still don't understand entirely...
Why on most public codes I see (for example Pointshop) they set a table.__index to the table itself if in the lua docs it says that it should be a function or another table (most commonly it's own metatable)?
Example:
[lua]
--[[
pointshop/sh_init.lua
first file included on both states.
]]--
PS = {}
PS.__index = PS
[/lua]
Source: [URL="https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/sh_init.lua#L7"]https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/sh_init.lua#L7[/URL]
Lua docs on __index: [URL="http://www.lua.org/manual/5.1/manual.html#2.8"]http://www.lua.org/manual/5.1/manual.html#2.8[/URL][/QUOTE]
Uh yeah that's super weird that they're setting that, it would only really make sense if PS was a metatable for some object, but it isn't.
[QUOTE=zerf;49406197]Uh yeah that's super weird that they're setting that, it would only really make sense if PS was a metatable for some object, but it isn't.[/QUOTE]
So I can safely assume that this is meaningless?
Where should I start for trying to narrow down FPS drops?
Everything is usually fine with just me, but when 3 or 4 more people join, FPS seems to drop quite a bit.
I'm setting an entity's position to be a player's in its think function but when they move, the entity kinda lags a few steps behind
Is there anything I can do about this?
[QUOTE=NiandraLades;49409065]I'm setting an entity's position to be a player's in its think function but when they move, the entity kinda lags a few steps behind
Is there anything I can do about this?[/QUOTE]
Use [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Entity/NextThink"]Entity:NextThink[/URL], and for the value, use CurTime().
Then, return true in your think function.
[del]How can I use CreateConVar to create a convar that is only changeable by the server, yet the client can access the value?
I tried flagging it as FCVAR_REPLICATED, but that didn't seem to do anything at all.[/del]
Nevermind, got it.
How does one draw a line in 3D space?
So say I want a line from Vec(100,100,100) to Vec(200,200,200)
I know this is probably REALLY nooby but how do I disable innocents from using teamchat in TTT?
[QUOTE=Voluptious;49415614]How does one draw a line in 3D space?
So say I want a line from Vec(100,100,100) to Vec(200,200,200)[/QUOTE]
You could try using this [url]http://wiki.garrysmod.com/page/render/DrawBeam[/url]
[QUOTE=Ciank33;49415658]I know this is probably REALLY nooby but how do I disable innocents from using teamchat in TTT?[/QUOTE]
Use the hook PlayerSay, check whether the team variable is true, check if ply:GetRole() equals ROLE_INNOCENT, return ""
[QUOTE=BillyOnWiiU;49415912]Use the hook PlayerSay, check whether the team variable is true, check if ply:GetRole() equals ROLE_INNOCENT, return ""[/QUOTE]
I'm a noob at lua and unsure if pm went through
so I would put this at addons/teamchat/lua/autorun/teamchat.lua
function PlayerSay
if ply:GetRole() equals ROLE_INNOCENT,
return ""
end
Is that it?
Returning false in CanPlayerEnterVehicle snaps the player's angles to (0,90,0). This does not happen in Sandbox, only my gamemode. I don't have any code that sets angles like that, and after much searching I haven't the slightest idea why this happens.
[CODE]
function GM:CanPlayerEnterVehicle(ply, vehicle)
return false
-- View snaps to (0, 90, 0)
end
[/CODE]
Has anyone seen this before? What happens after CanPlayerEnterVehicle that might cause this?
hey guys I'm trying to make a 3 round burst pistol and i cant figure out or find a code to make the pistol 3 round burst also i want to make it selective firemode so if you guys could help me that would be great
I know this was asked a long time ago and was probably answered, but how do you remove certain tabs from the spawn menu?
[QUOTE=GGG KILLER;49417347]I know this was asked a long time ago and was probably answered, but how do you remove certain tabs from the spawn menu?[/QUOTE]
[url]https://facepunch.com/showthread.php?t=1483637[/url]
[QUOTE=GGG KILLER;49417347]I know this was asked a long time ago and was probably answered, but how do you remove certain tabs from the spawn menu?[/QUOTE]
do you know where i could find it?
[editline]30th December 2015[/editline]
[editline]30th December 2015[/editline]
I just need a three round burst code please.
Is there a way to flip a render target's viewport? So things on the left are actually on the right?
My rendertarget is backwards...
Hello There! Quick question. How can i force change a ClientConvar on join
[QUOTE=Cheese_3;49423896]Hello There! Quick question. How can i force change a ClientConvar on join[/QUOTE]
[lua]
hook.Add("PlayerInitialSpawn", "setcvar", function(ply) ply:ConCommand("k v") end)
[/LuA]
[editline]a[/editline]
@Velkon why is this dumb? The only way to set convars programmatically currently is through RunConsoleCommand("k v") or whatever. I haven't tested ply:ConCommand working this way so it might not work, but this is the correct concept.
How do I add a DCheckBoxLabel to a DCategoryList's category, I have the following code but it doesn't works:
[lua]
local Categories = vgui.Create('DCategoryList', MainWindow)
Categories:Dock( FILL )
local Categories_General = Categories:Add'General'
local CheckBox = vgui.Create'DCheckBoxLabel'
CheckBox:SetText'Enable Something'
function CheckBox:OnChange( checked )
print(checked and 'You Enabled Something! :D' or 'You Disabled Something! D:')
end
Categories_General:Add(CheckBox)
[/lua]
but it just errors, and if I do [lua]Categories:AddItem(CheckBox)[/lua] it won't add the CheckBox to that category...
Also, One of my addons are spamming [NetLog] Wrote To Table: {Table Args}
Is there a way to stop it ? I asked the addon creator and he said he doesn't have anything to do with it.
[QUOTE=Cheese_3;49425210]Also, One of my addons are spamming [NetLog] Wrote To Table: {Table Args}
Is there a way to stop it ? I asked the addon creator and he said he doesn't have anything to do with it.[/QUOTE]
Well, it has to be his addon, there's no way another addon would be faking messages, search for the code and see where that message is sent and try to comment it out.
[QUOTE=GGG KILLER;49425215]Well, it has to be his addon, there's no way another addon would be faking messages, search for the code and see where that message is sent and try to comment it out.[/QUOTE]
I can't seem to be able to find this, Im using LimbHUD Lite off Script Fodder and it is spamming in console the armour values.
[QUOTE=Cheese_3;49425720]I can't seem to be able to find this, Im using LimbHUD Lite off Script Fodder and it is spamming in console the armour values.[/QUOTE]
try to find some line that has something like this:
[lua]
print(ply:GetArmor())
-- or
MsgN(ply:GetArmor())
[/lua]
How do I set a website as background in a html?
Would it be possible to use stencils to create a gradient mask?
Example,
[t]http://puu.sh/mf5m1.png[/t]
I'm hoping to hide part of an image using a gradient fade, so you can see what's behind it.
[QUOTE=Z0mb1n3;49428118]Would it be possible to use stencils to create a gradient mask?
Example,
[t]http://puu.sh/mf5m1.png[/t]
I'm hoping to hide part of an image using a gradient fade, so you can see what's behind it.[/QUOTE]
Do you really have to do it realtime?
One thing I am thinking is have two images, one part of the gradient and the reverse of it, and use the second one with alpha to fade in/fade out the gradient at will.
Just wondering if there's any way to get the material of a brush without tracing to it. I'm replicating footstep sounds for NextBots but I don't want to have to trace every time they need to make the sound.
[QUOTE=Robotboy655;49431102]Do you really have to do it realtime?
One thing I am thinking is have two images, one part of the gradient and the reverse of it, and use the second one with alpha to fade in/fade out the gradient at will.[/QUOTE]
Well I wanted to re-create the star wars screen wipes, so yeah, real-time would be best.
Sorry, you need to Log In to post a reply to this thread.