• What do you need help with? V3
    6,419 replies, posted
I couldn't answer that question for you. However, you could do this: [code] LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType()) > 0 || LocalPlayer():GetActiveWeapon():Clip1() > 0 [/code] And use it as a variable for any weapon equipped.
[QUOTE=Banana Lord.;39349657]The type of it, so I can get how much the player has. Either I'm missing something or objPl:GetAmmoCount( "pistol" ) is returning 0 for me[/QUOTE] I did: [code] lua_run print(Entity(1):GetActiveWeapon():GetPrimaryAmmoType()) 7 [/code] More stuff: [code] Pistol - 3 SMG - 4 Magnum - 5 Ar2 - 1 Shotgun - 7 [/code]
[QUOTE=I Like Cereal;39348686]How would I make a 'setmoney' command. What I got so far: [code] function bw_setmoney() end [/code] and [code] concommand.Add("bw_setmoney", bw_setmoney) [/code][/QUOTE] Hey Brandon, any chance you could help me with this? ^
[QUOTE=I Like Cereal;39349808]Hey Brandon, any chance you could help me with this? ^[/QUOTE] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5eef.html[/url] i dont know if this is what you mean
[QUOTE=Leystryku;39314693]Getting a value from a string ? Do you know how to code ? I guess your confusing strings with tables or values with variable names. If I get you right you are creating a variable name that references to another variable, that's stupid because you would have 2 variables doing the same thing. But if you mean how to get keys from tables, PrintTable(tbl). Or if you want to get the value tbl["key"].[/QUOTE] How rude. I figured it out, just formatted the information a bit different. [editline]25th January 2013[/editline] [img]http://puu.sh/1Sj5X[/img] this. Why does it happen? I only saw it on objects parented to other entities, but it's occuring on all parts of the entity. it goes off to where it originally spawns, and sometimes i can collide with what seems like invisible duplicates of all the parts. Can anyone explain this to me, and how i can stop it?
When I shoot my SWEP, I want my textures to show in time order. Primary attack -> low timescale -> show texture 1 -> show texture 2 after delay -> reset timescale I used this code, [CODE]surface.SetTexture( surface.GetTextureID( my texture ) ) surface.SetDrawColor ( 255, 255, 255, 255 ) surface.DrawTexturedRect( ScrW() /2 - 128, ScrH() -166, 256, 85 )[/CODE] but I don't know how/where should i put this! sorry not good at english
You have to use The hook : HUDPaint
So. Ive been trying hard to fix this broken addon for awhile and i cant seem to fix these lua errors in the console maybe you guys can help me out? [ERROR] lua/entities/sent_srr/init.lua:113: attempt to perform arithmetic on local 'dir' (a nil value) 1. unknown - lua/entities/sent_srr/init.lua:113 [ERROR] lua/entities/sent_srr/cl_init.lua:23: bad argument #2 to 'SetModelScale' (number expected, got no value) 1. SetModelScale - [C]:-1 2. unknown - lua/entities/sent_srr/cl_init.lua:23
[QUOTE=ExtReMLapin;39351143]You have to use The hook : HUDPaint[/QUOTE] thanks!! it worked!! umm.. One more problem happened How do I get rid of texture after shooting?
Having some trouble with the net library, trying to get this money system down-pat.. [lua] if SERVER then util.AddNetworkString("SetMoney") util.AddNetworkString("AddMoney") function playerMeta:NetSetMoney(amount) net.Start("SetMoney") net.WriteFloat(amount) net.Send(self) end function playerMeta:NetAddMoney(amount) net.Start("AddMoney") net.WriteFloat(tonumber(MyMoney) + amount) net.Send(self) end else net.Receive("SetMoney", function(length) MyMoney = net.ReadFloat() end) end [/lua] I know something isn't right, this is just one of the many attempts I've had at trying to get it to ADD onto my current figure. Any help is appreciated.
net.WriteFloat(tonumber(MyMoney) + amount) The players money shouldn't be in a global variable, think of what would happen if there were multiple players on the server at one time. Apply it to the player object instead.
[QUOTE=Archemyde;39350715]How rude. I figured it out, just formatted the information a bit different. [editline]25th January 2013[/editline] [img]http://puu.sh/1Sj5X[/img] this. Why does it happen? I only saw it on objects parented to other entities, but it's occuring on all parts of the entity. it goes off to where it originally spawns, and sometimes i can collide with what seems like invisible duplicates of all the parts. Can anyone explain this to me, and how i can stop it?[/QUOTE] You're creating the physics on the client and server. You only need to do it on the server.
[QUOTE=brandonj4;39349784]I did: [code] lua_run print(Entity(1):GetActiveWeapon():GetPrimaryAmmoType()) 7 [/code] More stuff: [code] Pistol - 3 SMG - 4 Magnum - 5 Ar2 - 1 Shotgun - 7 [/code][/QUOTE] ............................... thanks
I'd like to make a drivable tron lightcycle, and eventually a gamemode based around it, but I don't really know where to start. I've downloaded a suitable lightcycle model. I need to figure out how to create a drivable entity out of it, with customized controls and sounds. Can someone point me in the right direction?
Here's an odd problem; I'm making a SWEP which fires a cannon round from the owner's shoot position and eye angles. This works but when a player spawns the SWEP and another player picks it up, the cannon rounds come from the player who spawned it, rather than the player who's shooting. It seems the SWEP thinks that its owner is the spawner and while it's technically correct, it's not the behaviour I'm looking for. :v: My question is, how do I get the [i]holder[/i] of the SWEP rather than the owner? I'm using self.Owner right now. Edit; @above You could start by making a scripted entity with the lightcycle model, and then you can use the think hook to execute applyforce and applytorque functions on it according to its owner's keypresses. You can use a calcview hook on the owner to put their view on the cycle. For more complicated behaviour there's a ton of other entity hooks that can help out. Here's some material to get you started; [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa944-3.html[/url] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9d06.html[/url] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1432.html[/url] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa5ae.html[/url]
[TTT]Anti RDM System Is there anyway make the server automaticlly detec when a innocent crowbars another innocent to death? Specially if he is afk.. I assume that 99% of the times an inno is killed with a crowbar it is rdm.
So, I'm trying to make a little script where I can place clientside markers down on the floor (Don't ask me why I'm just learning and what-not) as you can see in the script it's very basic, but of course it doesn't seperate x,y,z when it adds it into a table, and I'm not sure of a simple way to so a string.Explode without it just returning the table[xsfhsfeg.ETC] [CODE] local Graphs = {} local ply = LocalPlayer() function GetPos( ) local pos = ply:GetShootPos() local ang = ply:GetAimVector() local tracedata = {} tracedata.start = pos tracedata.endpos = pos+(ang*800000) tracedata.filter = ply local trace = util.TraceLine(tracedata) loc = trace.HitPos return loc end function AddToTable() GetPos( ) table.insert(Graphs, loc) for k,v in pairs(Graphs) do print(v) end end concommand.Add("Testing", AddToTable) function ClearGraph() table.Empty(Graphs) end concommand.Add("ClearGraph", ClearGraph) function DrawGraph( ) for k,v in pairs(Graphs) do local Position = ( Vector(v) ):ToScreen() draw.DrawText( k, "default", Position.x, Position.y, Color( 255, 255, 255, 255 ), 1 ) end end hook.Add( "HUDPaint", "DrawGraph", DrawGraph ) [/CODE] [IMG]https://dl.dropbox.com/u/13645752/savemefacepunch.png[/IMG]
[lua] for k,v in pairs(Graphs) do local Position = ( Vector(v) ):ToScreen() draw.DrawText( k, "default", Position.x, Position.y, Color( 255, 255, 255, 255 ), 1 ) end [/lua] to [lua] for k,v in pairs(Graphs) do local Position = v:ToScreen() draw.DrawText( k, "default", Position.x, Position.y, Color( 255, 255, 255, 255 ), 1 ) end [/lua] ? [editline]25th January 2013[/editline] Also you shouldn't have "local ply = LocalPlayer()" defined outside of a function, LocalPlayer() is often returns a null entity when run before InitPostEntity is called. [editline]25th January 2013[/editline] And instead of doing all the tracing manually you can just use LocalPlayer():GetEyeTrace().HitPos
Thank you VERY much my friend!
GetPos() is actually a table, it returns with x,y,z. To call them indivually do GetPos().x, GetPos().y, GetPos().z
[QUOTE=Science;39354879]GetPos() is actually a table, it returns with x,y,z. To call them indivually do GetPos().x, GetPos().y, GetPos().z[/QUOTE] GetPos() returns a vector, the vector can be added to the table once and then have :ToScreen() applied directly to it, like he should be doing now.
I want to be able to disable cars but not the seats. I got the code for disabling bouncy ball, but not how to disable the jeep and airboat etc. (and pod) PM me if you can help me! :D
Is there any efficient way I can draw rotated text? I'm looking to turn small pieces of text (less than 4 characters) 90 degrees to the right. And apparently everyone is my friend list "is not really good with UI."
Need help making a scrollable rules tab for DarkRP. I have tried using SetText but it has a character limit and does not scroll. Tried using a RichText panel but i cannot change the font of it, so i need something that can 1.) Use AppendText 2.) Can scroll 3.) Can copy text from 4.) Can change font
[QUOTE=0oRichard;39356098]Need help making a scrollable rules tab for DarkRP. I have tried using SetText but it has a character limit and does not scroll. Tried using a RichText panel but i cannot change the font of it, so i need something that can 1.) Use AppendText 2.) Can scroll 3.) Can copy text from 4.) Can change font[/QUOTE] For a quick and easy solution, a HTML panel will work, and you'll get a lot more styling easily than using standard vgui.
vgui in gmod is a pain in the arse compared to, say, Android layout XML's. The part of DarkRP which I consider to have the worst quality is the vgui. Specifically the F4 menu. Then again, I started writing it in 2008, not even a year after I started reading the Lua pil to learn my first programming/scripting language.
VGUI in GMod is powerful and can look good, but for beginners a simple HTML panel to display rules is all they need.
You should ask kaade, he's the GUI master :v:
Could someone explain why the bars move a bit when I look at a player (Name bar)? [url]http://www.youtube.com/watch?v=AUfwH7U6dnA&feature=youtu.be[/url]
I don't see any bars moving?
Sorry, you need to Log In to post a reply to this thread.