[QUOTE=Zyler;39548037]Is it at all possible in lua to auto-generate new variables? What I have in mind is that the code auto-generates a new variable every time you run a function and a variable is already present, e.g. if var1 exists create var2, if var2 exists create var3 and so on. This way it will procedurally create new variables without you having to manually create them.[/QUOTE]
[lua]
local vars = {}
vars[0] = 0
function addVar()
vars[#vars] = 0 //# prefix gives us the number of values in a table
end
[/lua]
Might give you an error, not sure, can't try it out right now...
Does http.Fetch only retrieve once? Then from a cache or something?
It seems to not be updating when i run the function, unless the file is reloaded.
Is it possible to change the colour of anything printed to the console?
[QUOTE=jaooe;39550715]Is it possible to change the colour of anything printed to the console?[/QUOTE]
Yes, with the MsgC() function [url]http://wiki.garrysmod.com/page/Global/MsgC[/url]
[editline]11th February 2013[/editline]
It works for both client console and server console. And you need to add new line at the end.
[QUOTE=Benjiko99;39551178]Yes, with the MsgC() function [url]http://wiki.garrysmod.com/page/Global/MsgC[/url]
[editline]11th February 2013[/editline]
It works for both client console and server console. And you need to add new line at the end.[/QUOTE]
what the hell happened to the wiki
[QUOTE=>>;39552992]what the hell happened to the wiki[/QUOTE]
I don't know, I don't like it though.
hello
I use TDMCars, and people joining cannot spawn the cars in their vehicles menu, and that is what I want, but somehow they are able to bypass it by right clicking the icon and using 'spawn with toolgun'
tool name is greator tool i tried too look in fpp but found nothing.
I have googled around and have found nothing... I use ULX if that's any help...
[QUOTE=skullorz;39553040]I don't know, I don't like it though.[/QUOTE]
I am scared :c
[QUOTE=Triple-X;39532125]How would you include an addon file from an entity directory in a gamamode folder?[/QUOTE]
[QUOTE=Paco Capone;39553141]hello
I use TDMCars, and people joining cannot spawn the cars in their vehicles menu, and that is what I want, but somehow they are able to bypass it by right clicking the icon and using 'spawn with toolgun'
tool name is greator tool i tried too look in fpp but found nothing.
I have googled around and have found nothing... I use ULX if that's any help...[/QUOTE]
sbox_maxvehicles 0
Ive been having problems with my swep lateley. The console gives me errors such as attemp to call method 'Ammo1' A nil value and attempt to index field 'playspinloop' a nil value. I cant seem to find what is wrong. here is the swep
[url]http://pastebin.com/pN677vUg[/url]
Its missing the beginning part like the authour, ammo, and such on purpose, i decided not to put it there. So whats the problem???
-snip- fixed
[QUOTE=>>;39544421]
Is it in a serverside script and are you sure the script is being ran?
Try adding print("this hook is running") above that line and restart the server; if it prints to the server console then we can explore other possible problems.[/QUOTE]
[lua]
hook.Add( "PlayerShouldAct", "no actin' fool", function( objPl, strAct, iAct ) print("Hook fired"); return false; end );
print("Hook created")
[/lua]
Running on serverside creates the console output of:
[quote]
Hook created
[/quote]
but it never outputs
[quote]
Hook fired
[/quote]
I've been testing with
[quote]
act muscle
[/quote]
and
[quote]
act group
[/quote]
on the console.
Where should I look for creating a third person script?
CalcView h
[QUOTE=Science;39549983]Does http.Fetch only retrieve once? Then from a cache or something?
It seems to not be updating when i run the function, unless the file is reloaded.[/QUOTE]
can anyone answer this
[QUOTE=>>;39558051]can anyone answer this[/QUOTE]
I don't think http.Fetch will cache. It shouldn't.
.. but again I got no idea (It doesn't say it anywhere).
It doesn't say it does.
But it does for sure, and I can't have it do that.
Is anyone aware of how to, or even if it's possible, to deploy the css Colt M4A1 or the HK USP without a suppressor being drawn on the world model? I have all of the back end code written regarding first person view for suppressed drawing, and unsuppressed drawing, as well as suppressed and unsuppressed firing, but I have no clue how you can remove the suppressor from the world model.. Is it a skin, an alternative model, a flag, or is it just not possible at all??
Goodbye old magazine: [url]http://cloud.steampowered.com/ugc/613883653010881924/A7D7ED27449BBBED56B72E7851CA042FB6259E26/[/url]
[url]http://cloud-2.steampowered.com/ugc/613883653010882723/3EE2BAB22D1C48CF1A029D924871D5AEBFB0726A/[/url]
Edit: Well, it's not a skin. Any suggestions?
-snipped-
How do you stop a sound from playing that's being emitted from your weapon?
Preferably on death or on holster.
[lua]self.Weapon:StopSound(Sound ("SOUNDPATH.wav" ) )[/lua]
doesn't work
I have the Q menu disabled on my zombie server, is it possible to make only Super admins able to open the menu?
Try to find the lines of code that disable the Menu and add a
(ServerSide)
[lua]
if !ply:IsAdmin()
[/lua]
btw , you should use SandBox as base gamemode
Hmm, can't seem to find it in any of my cl_init.lua's.
Any ideas?
[QUOTE=soupface;39560292]Hmm, can't seem to find it in any of my [b]cl[/b]_init.lua's.
Any ideas?[/QUOTE]
[QUOTE=ExtReMLapin;39560174](ServerSide)[/QUOTE]
Trying to make a swep go into a passive animation when you do use+primary fire, this is the code I got
[code]function SWEP:PrimaryAttack()
if(self.Owner:KeyDown(IN_USE)) then
if(self.SetWeaponHoldType("revolver"))then(self.SetWeaponHoldType("passive"))else(self.SetWeaponHoldType("revolver"))
end
[/code]
And it does this error.
[code][ERROR] ...myaddon/lua/weapons/wep_mywep/shared.lua:154: syntax error near 'else'
1. unknown - addons/myaddon/lua/weapons/wep_mywep/shared.lua:0
[/code]
Any help? As far as I can see my use of else is just fine, but that can't be true.
[QUOTE=ExtReMLapin;39560174]Try to find the lines of code that disable the Menu and add a
(ServerSide)
[lua]
if !ply:IsAdmin()
[/lua]
[/QUOTE]
btw, he said Super Admins so
[CODE]ply:IsSuperAdmin()[/CODE]
[editline]12th February 2013[/editline]
[QUOTE=elowin;39560755]Trying to make a swep go into a passive animation when you do use+primary fire, this is the code I got
[code]function SWEP:PrimaryAttack()
if(self.Owner:KeyDown(IN_USE)) then
if(self.SetWeaponHoldType("revolver"))then(self.SetWeaponHoldType("passive"))else(self.SetWeaponHoldType("revolver"))
end
[/code]
And it does this error.
[code][ERROR] ...myaddon/lua/weapons/wep_mywep/shared.lua:154: syntax error near 'else'
1. unknown - addons/myaddon/lua/weapons/wep_mywep/shared.lua:0
[/code]
Any help? As far as I can see my use of else is just fine, but that can't be true.[/QUOTE]
You're trying to get the holdtype by doing SetWeaponHoldType... use Weapon:GetHoldType() and btw KeyDown() is gonna be returning true for the duration it is pressed/down, maybe you should try KeyPressed() instead
[QUOTE=Acecool;39559748]Is anyone aware of how to, or even if it's possible, to deploy the css Colt M4A1 or the HK USP without a suppressor being drawn on the world model? I have all of the back end code written regarding first person view for suppressed drawing, and unsuppressed drawing, as well as suppressed and unsuppressed firing, but I have no clue how you can remove the suppressor from the world model.. Is it a skin, an alternative model, a flag, or is it just not possible at all??
Goodbye old magazine: [url]http://cloud.steampowered.com/ugc/613883653010881924/A7D7ED27449BBBED56B72E7851CA042FB6259E26/[/url]
[url]http://cloud-2.steampowered.com/ugc/613883653010882723/3EE2BAB22D1C48CF1A029D924871D5AEBFB0726A/[/url]
Edit: Well, it's not a skin. Any suggestions?[/QUOTE]
Set the sequence to the ones that aren't silenced?
There's different sequences like idle_silenced and etc.. it's probably playing the silenced ones instead of the non-silenced.
[QUOTE=Benjiko99;39560765]You're trying to get the holdtype by doing SetWeaponHoldType... use Weapon:GetHoldType() and btw KeyDown() is gonna be returning true for the duration it is pressed, maybe you should try KeyPressed() instead[/QUOTE]
Oh, didn't know there was a seperate function for getting the hold type, thanks for that.
Still getting the same error though.
[QUOTE=YoshieMaster;39555929][lua]
hook.Add( "PlayerShouldAct", "no actin' fool", function( objPl, strAct, iAct ) print("Hook fired"); return false; end );
print("Hook created")
[/lua]
Running on serverside creates the console output of:
but it never outputs
I've been testing with
and
on the console.[/QUOTE]
The hook is called "PlayerShouldTaunt", not "PlayerShouldAct".
Sorry, you need to Log In to post a reply to this thread.