[QUOTE=jmazouri;38424976]Override the metamethods:
[/QUOTE]
Oh god why.
The only time you need to do this is if you're adding other access levels, e.g. ply:IsGod(), or checking by location or team or some shit like that instead (which is a horrible idea to begin with and anyone who does that [i]deserves[/i] to get permabanned from his own server) or if you really hate users.txt.
Should just be using ply:SetUserGroup() instead.
Got a few questions that I've been wondering about:
Is it possible to check if a client is subscribed to a workshop addon via lua and if so is there a certain function?
Is it possible to replace a SWEP's view and world model if said user is not subscribed to the addon?
Anyone have any examples on how to use DCategoryList and/or DListLayout?
[QUOTE=Luni;38425072]Oh god why.
The only time you need to do this is if you're adding other access levels, e.g. ply:IsGod(), or checking by location or team or some shit like that instead (which is a horrible idea to begin with and anyone who does that [i]deserves[/i] to get permabanned from his own server) or if you really hate users.txt.
Should just be using ply:SetUserGroup() instead.[/QUOTE]
Just telling him what he asked. I agree it's not ideal.
Attempting to get this :
[CODE]AddEntity("Emerald Printer", "emerald_money_printer", "models/props_c17/consolebox01a.mdl", 2500, 1, "/buyemerald", nil, function(ply) return ply:CheckGroup("donator") or ply:IsSuperAdmin() end)[/CODE]
To notify the player that he is not a donator, I attempted this:
[CODE]AddEntity("Emerald Printer", "emerald_money_printer", "models/props_c17/consolebox01a.mdl", 2500, 1, "/buyemerald", nil, function(ply) return ply:CheckGroup("donator") or ply:IsSuperAdmin() then Notify(self, 1, 4, string.format("That Printer is Donator only! Visit www.evoservers.net for more info!")) end)[/CODE]
Which did not work. How would I do this? Any method i've tried doesn't seem to work.
file.Find appears to be broken, am I just not using it right?
The example on the gmod wiki does not work either.
The following is some code I found in a thread that should work but doesn't.
[code]
local t_Filter = {
"db", "vvd", "phy", "vtx"
}
local function ProcessFolder( t_Location )
local t_Files, t_Directories = file.Find( t_Location .. "*", "GAME" )
for _, t_File in pairs( t_Files ) do
if ( !table.HasValue( t_Filter, string.GetExtensionFromFilename( t_File ) ) ) then
resource.AddFile( t_Location .. t_File );
end
end
for _, t_Directory in pairs( t_Directories ) do
ProcessFolder( t_Location .. t_Directory .. "/", t_Total )
end
end
[/code]
It seems to return t_Files as a table with nothing in it. This is extremely frustrating for server downloads. Can someone explain?
[QUOTE=Ylsid;38426100]file.Find appears to be broken, am I just not using it right?
The example on the gmod wiki does not work either.
The following is some code I found in a thread that should work but doesn't.
It seems to return t_Files as a table with nothing in it. This is extremely frustrating for server downloads. Can someone explain?[/QUOTE]
Where [i]exactly[/i] are the folders and files you're trying to load?
What are you passing ProcessFolder the first time you call it?
Is t_Directories an empty table as well?
How can I disable the creations tab in my server?
If anyone could help some more with my VGUI problem it'd be much appreciated :) Thanks!
[URL="http://facepunch.com/showthread.php?t=1225002"]http://facepunch.com/showthread.php?t=1225002[/URL]
I'm looking for the info on what needs to be changed to fix gamemodes in Gmod 13. I clicked the Porting from Gmod 12 link on the wiki, and it used to lead to a document, but now it (unfortunately) leads to a blank document in Google Docs. Does anyone know a place where I can find what needs to be changed?
I am trying to use dmginfo:IsDamageType and it gives me the error attempt to index local 'dmginfo' (a nil value)
if ent:IsPlayer() and ent:IsValid() and dmginfo:IsDamageType( DMG_BLAST ) then
So im not really sure whats going on. Has things been changed for dmginfo?
Post full code. I'm assuming this is an EntityTakeDamage hook? Make sure the second function arg actually is "dmginfo".
Sorry about that i feel kinda retarted for not doing that in the first place
[code]function Shellshock(ent, inflictor, attacker, amount, dmginfo)
if ent:IsPlayer() and ent:IsValid() and dmginfo:IsDamageType( DMG_BLAST ) then
ent:ConCommand( "pp_motionblur 1; pp_dof 1; sensitivity 1; play shock.wav" )
ent:SetWalkSpeed(50)
ent:SetRunSpeed(50)
timer.Simple( 5, ent.ConCommand, ent, "pp_motionblur 0; pp_dof 0; sensitivity 10" )
timer.Simple( 5, ent.SetWalkSpeed, ent, "250" )
timer.Simple( 5, ent.SetRunSpeed, ent, "500" )
end
end
hook.Add("EntityTakeDamage","Shell_shock",Shellshock)[/code]
[QUOTE=residualgrub;38430814]Sorry about that i feel kinda retarted for not doing that in the first place[/QUOTE]
should be
[lua]function Shellshock(ent, dmginfo)[/lua]
Ya You Should Feel Retarted Bitch What The Fuck Why Are You Passing Non Existent Arguments In EntityTakeDamage You Dumb Bitch Heres How You Do It
Function GM:Initialize()
Hook.Add("EntityTakeDamage", function(ent,inflictor)
Return False
End)
End
Thanks blood it worked but now my timers are failing im trying to fix it but to no avail
[img]http://gyazo.com/5cf0f752d0d186e6e5186227e1172a7a.png?1352778889[/img]
[code]function Shellshock(ent, dmginfo)
if ent:IsPlayer() and ent:IsValid() and dmginfo:IsDamageType( DMG_BLAST ) then
ent:ConCommand( "pp_motionblur 1; pp_dof 1; sensitivity 1; play shellshock.wav" )
ent:SetWalkSpeed(50)
ent:SetRunSpeed(50)
timer.Simple( 5, ent.ConCommand, ent,"pp_motionblur 0; pp_dof 0; sensitivity 10" )
timer.Simple( 5, ent.SetWalkSpeed, ent, "250" )
timer.Simple( 5, ent.SetRunSpeed, ent, "500" )
end
end
hook.Add("EntityTakeDamage","Shell_shock",Shellshock)[/code]
You can't pass arguments into timers like that anymore.
[lua]function Shellshock(ent, dmginfo)
if ent:IsPlayer() and ent:IsValid() and dmginfo:IsDamageType( DMG_BLAST ) then
ent:ConCommand( "pp_motionblur 1; pp_dof 1; sensitivity 1; play shellshock.wav" )
ent:SetWalkSpeed(50)
ent:SetRunSpeed(50)
timer.Simple(5, function()
if not IsValid(ent) then return end
ent:ConCommand("pp_motionblur 0; pp_dof 0; sensitivity 10")
ent:SetWalkSpeed(250)
ent:SetRunSpeed(500)
end)
end
end
hook.Add("EntityTakeDamage","Shell_shock",Shellshock)
[/lua]
Ah ok thanks. the wiki still said you could so that threw me off.
-snip- ninja'd
Does anybody know of documentation for making and using custom derma skins?
Most I could find was [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa2b0.html"]this[/URL] but I don't know where to get the files to make the skin or where to save it.
changing timescale to 0.3 w/o cheats on :o pls help lol
[url]http://facepunch.com/showthread.php?t=1225529[/url]
[QUOTE=sackcreator54;38431649]changing timescale to 0.3 w/o cheats on :o pls help lol
[url]http://facepunch.com/showthread.php?t=1225529[/url][/QUOTE]
Use [url=http://wiki.garrysmod.com/page/Libraries/game/SetTimeScale]game.SetTimeScale[/url]
How to use the custom ammo thing? And is it still broken?
EDIT:
Found how to use it. Not sure if still broken.
My 2D3D'd text was blurry and nice before yesterday's update
[t]http://puu.sh/1pN9N[/t] [t]http://puu.sh/1pNbw[/t]
Not anymore :c
Did something change, apart from the fix for Linux?
I'm fixing up HatsChat and it works perfectly except the line icons and glows. I get this error from it.
[CODE][ERROR] addons/hatschat_chatbox/lua/cl_hatschat.lua:77: attempt to call method 'GetPData' (a nil value)
1. unknown - addons/hatschat_chatbox/lua/cl_hatschat.lua:77
Timer Failed! [Simple][@addons/hatschat_chatbox/lua/cl_hatschat.lua (line 100)][/CODE]
The snippit of code with the error:
[CODE]
local ShowLineIcons, ShowLineGlow
local LineIcons = function()
ShowLineIcons = CreateConVar("HatsChat_LineIcons", LocalPlayer():GetPData("HatsChat_LineIcons", 1) )
ShowLineGlow = CreateConVar("HatsChat_LineGlow", LocalPlayer():GetPData("HatsChat_LineGlow", 1) )
local function ChangeCallback( cvar, prev, new )
LocalPlayer():SetPData( tostring(GetConVar(cvar)) , new)
end
cvars.AddChangeCallback( "HatsChat_LineIcons", ChangeCallback)
cvars.AddChangeCallback( "HatsChat_LineGlow", ChangeCallback)
end
timer.Simple(1, LineIcons )
[/CODE]
Any ideas why it is error'ing would be appreciated. I tried the individual lines in my console using lua_run_cl and they worked fine so I'm not sure whether something else in the code is the issue.
[QUOTE=jellybaby34;38435800]I'm fixing up HatsChat and it works perfectly except the line icons and glows. I get this error from it.
[CODE][ERROR] addons/hatschat_chatbox/lua/cl_hatschat.lua:77: attempt to call method 'GetPData' (a nil value)
1. unknown - addons/hatschat_chatbox/lua/cl_hatschat.lua:77
Timer Failed! [Simple][@addons/hatschat_chatbox/lua/cl_hatschat.lua (line 100)][/CODE]
The snippit of code with the error:
[CODE]
local ShowLineIcons, ShowLineGlow
local LineIcons = function()
ShowLineIcons = CreateConVar("HatsChat_LineIcons", LocalPlayer():GetPData("HatsChat_LineIcons", 1) )
ShowLineGlow = CreateConVar("HatsChat_LineGlow", LocalPlayer():GetPData("HatsChat_LineGlow", 1) )
local function ChangeCallback( cvar, prev, new )
LocalPlayer():SetPData( tostring(GetConVar(cvar)) , new)
end
cvars.AddChangeCallback( "HatsChat_LineIcons", ChangeCallback)
cvars.AddChangeCallback( "HatsChat_LineGlow", ChangeCallback)
end
timer.Simple(1, LineIcons )
[/CODE]
Any ideas why it is error'ing would be appreciated. I tried the individual lines in my console using lua_run_cl and they worked fine so I'm not sure whether something else in the code is the issue.[/QUOTE]
GetPData is a serverside function, you can't run it on the client unless you create a custom piece for accessing it.
[QUOTE=Luni;38426767]Where [i]exactly[/i] are the folders and files you're trying to load?
What are you passing ProcessFolder the first time you call it?
Is t_Directories an empty table as well?[/QUOTE]
I don't know about t_Directories, it's supposed to recursively go down specified directories and automatically add all content in it.
[code]
resource.AddFile("models/weapons/v_pist_lugr.mdl")
resource.AddFile("models/weapons/w_pist_lugr.mdl")
resource.AddDir("sound/weapons/junkwep")
resource.AddDir("sound/weapons/nazigun")
[/code]
The models download fine, the sounds do not. The folders are all in addons (including the following code which is in the same addon as the sounds/models), this worked fine in gm12 and I don't know if garry has changed something about the way addons load.
-snip- fixed
Not exactly something I need help with, but I was just wondering what other people do for 2D animations. The way I've been doing it is storing an X or Y position in a variable and changing it with math.Approach. This method works for the most part, but when it gets to more complex animations, it becomes a tedious task to handle all the variables. :l
[QUOTE=Darkwater124;38435721]My 2D3D'd text was blurry and nice before yesterday's update
-snip-
Not anymore :c
Did something change, apart from the fix for Linux?[/QUOTE]
Try playing around with texture filtering. This might solve your problems. [url]http://garry.tv/post/34414478795/texture-filtering[/url]
[QUOTE=jmazouri;38416650]Ah shit, you're right.[/QUOTE]
No possible way to get it to work then?
Sorry, you need to Log In to post a reply to this thread.