-snip-
I guess I can try that with local variables. Thanks.
Ok so I was an idiot with my earlier post, but I threw this in a new lua file in lua/autorun/
[CODE]hook.Add( "PreDrawHalos", "VampHalo", function()
for k,v in pairs(player.GetAll()) do
if v:PS_HasItemEquipped("vampiricenchant") and v:Alive() then
halo.Add( {v}, Color( 255, 0, 0 ), 3, 3, 1 )
end
end
end)[/CODE]
however halos aren't adding 100% correctly. For some players, they can see it on the player with it equipped, but others will not see it on them at all. Any reasoning why?
Is there anyway to dump the stack, or get the lua file where a function is called? For example:
[lua]
-- program.lua
function myFunction()
print("This function is called in: ") -- program.lua prints here
end
[/lua]
AddCSLuaFile( ) does that. (If there is no argument in it) You should take a look at how it's done.
[QUOTE=Drak_Thing;46353210]Is there anyway to dump the stack, or get the lua file where a function is called? For example:
[lua]
-- program.lua
function myFunction()
print("This function is called in: ") -- program.lua prints here
end
[/lua][/QUOTE]
This may be helpful: [url]https://github.com/thelastpenguin/pLib/blob/master/lua/includes/modules/dprint.luasrc[/url]
[QUOTE=Drak_Thing;46353210]Is there anyway to dump the stack, or get the lua file where a function is called? For example:
[lua]
-- program.lua
function myFunction()
print("This function is called in: ") -- program.lua prints here
end
[/lua][/QUOTE]
[URL="http://wiki.garrysmod.com/page/debug/getinfo"]debug.getinfo[/URL]
Use a number (for the stack level) instead of a function as the argument.
Holy hell, that's perfect. I didn't think something like that existed. Thanks guy.
So there is a site where you could find every single sound in Garry's mod / hl2, and i cant find that site? Has it been removed or something? If you can find it link it please... This is really stupid, its like its been ereased for me lol.
[QUOTE=Invule;46356776]So there is a site where you could find every single sound in Garry's mod / hl2, and i cant find that site? Has it been removed or something? If you can find it link it please... This is really stupid, its like its been ereased for me lol.[/QUOTE]
[url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8f77.html[/url]
How could I have multiple models in a SENT? I'm currently using render.Model in the Draw hook but I doubt this is the best way to do it and it also seems to have some rendering flaws.
[QUOTE=Sereni;46358523]How could I have multiple models in a SENT? I'm currently using render.Model in the Draw hook but I doubt this is the best way to do it and it also seems to have some rendering flaws.[/QUOTE]
in Initialize try local randommodel = table.Random(modeltable)
self:SetModel(randommodel)
[QUOTE=Tomelyr;46358534]in Initialize try local randommodel = table.Random(modeltable)
self:SetModel(randommodel)[/QUOTE]
Sorry I probably didn't state my problem clearly enough. I want to have multiple models at one time (to create a two part model). So at the moment I'm using the :SetModel() for the "foundation" and then render.Model for an additional second model.
[QUOTE=man with hat;46357447][url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8f77.html[/url][/QUOTE]
Thank you.
[QUOTE=Sereni;46358593]Sorry I probably didn't state my problem clearly enough. I want to have multiple models at one time (to create a two part model). So at the moment I'm using the :SetModel() for the "foundation" and then render.Model for an additional second model.[/QUOTE]
AFAIK render.Model just creates a clientside entity and immediately removes it, so you're better off just keeping a ClientsideModel and positioning/drawing it yourself
Anyone know the names of good maps to dev on? Any with mirrors?
[QUOTE=Blasteh;46361043]Anyone know the names of good maps to dev on? Any with mirrors?[/QUOTE]
gm_construct
there is a mirror in the basement and a nice white colorable room-.
How are you meant to use [url=http://wiki.garrysmod.com/page/Weapon/GetActivity]Weapon:GetActivity()[/url]? I've tried the example on the wiki and it doesn't work
[quote=Wiki]
local wep = player.GetByID( 1 ):GetActiveWeapon()
if( wep ) then // Makes sure that wep exists
print( wep:GetViewModel():GetActivity() ) // Prints the sequence number
end
[/quote]
[IMG]http://i.imgur.com/k1Lpvyx.png[/IMG]
Seems like GetViewModel() doesn't work on a weapon at all.
[QUOTE=isnipeu;46366376]How are you meant to use [url=http://wiki.garrysmod.com/page/Weapon/GetActivity]Weapon:GetActivity()[/url]? I've tried the example on the wiki and it doesn't work
[IMG]http://i.imgur.com/k1Lpvyx.png[/IMG]
Seems like GetViewModel() doesn't work on a weapon at all.[/QUOTE]GetViewModel is supposed to be used on players, not weapons.
Is it possible to change properties of a vehicles handling file ([I]i.e[/I] [b]scripts/vehicles/jeep_test.txt[/b]) in lua?
No. You will need a 3rd party module for that.
I'm creating a menu, where various parts on it need to update in real time as the user clicks or types things, etc
Am I going to have to use vgui.Register and make my own panels to do this?
[QUOTE=NiandraLades;46369459]I'm creating a menu, where various parts on it need to update in real time as the user clicks or types things, etc
Am I going to have to use vgui.Register and make my own panels to do this?[/QUOTE]
What are you having difficulty with? Shouldn't it be simple enough just to do stuff in the DoClick and other element events? If you mean doing complex stuff you should probably just make custom element methods by attaching functions to derma elements. But if you're going to do that you might as well use custom derma elements and add functions there, since it makes stuff neater (IMO).
I seem to have trouble using vararg:
[lua]
function META:Call(index, ...)
if self.Hooks[index] then
self.Hooks[index](...);
end
end
[/lua]
When I try to call:
[lua]function Plugin:SetData(index, value)
print(index, value);
end[/lua]
by using: META:Call("SetData", "Doop", "poop");
SetData returns: "poop nil"
[QUOTE=Commander11;46370474]I seem to have trouble using vararg:
[lua]
function META:Call(index, ...)
if self.Hooks[index] then
self.Hooks[index](...);
end
end
[/lua]
When I try to call:
[lua]function Plugin:SetData(index, value)
print(index, value);
end[/lua]
by using: META:Call("SetData", "Doop", "poop");
SetData returns: "poop nil"[/QUOTE]
You've defined Plugin.SetData using a colon, which is equivalent to:
[code]
function Plugin.SetData(self, index, value)
print(index, value);
end
[/code]
Hopefully that'll explain why only your second argument is printing.
[QUOTE=Willox;46370651]You've defined Plugin.SetData using a colon, which is equivalent to:
[code]
function Plugin.SetData(self, index, value)
print(index, value);
end
[/code]
Hopefully that'll explain why only your second argument is printing.[/QUOTE]
Awesome, thank you I fixed it by passing it this way: [lua]self.Hooks[index](self, ...);[/lua]
Is it possible to disable player collision with an entity but still use Touch events?
Yes, set the entity's [URL="http://wiki.garrysmod.com/page/Entity/SetCollisionGroup"]collision group to COLLISION_GROUP_WEAPON[/URL] and then use [URL="http://wiki.garrysmod.com/page/Entity/SetTrigger"]SetTrigger( true )[/URL] serverside on the entity.
Whats the easiest way to outline vgui elements?
[lua]pnl.Paint = function(s,w,h)
surface.SetDrawColor(0,0,0) -- Outline color
surface.DrawRect(w,h,0,0)
surface.SetDrawColor(255,255,255) -- Main color
surface.DrawRect(w+1,h+1,h-2,-2)
end[/lua]
Simple example using the Paint function. (There are other methods, of course)
I'm working on a conversion for TTT using F:AS 2.0. It's been a while but I'm having one main issue which is double switching of the weapons? The first switch displays an animation across everyone's screen of the gun deploying and the second time actually switches. Any ideas?
(Other than this the weapons are fine)
Sorry, you need to Log In to post a reply to this thread.