• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=zeaga;48029065]How does the filesystem for an addon that overrides gamemode files work? So like, for example, if I wanted to modify garrysmod\gamemodes\terrortown\gamemode\cl_hud.lua, where in my addon should I put the lua file to replace it? (Not actually the file I want to modify, but for example's sake) I could swear I've seen other addons do this, but I can't remember how. Apparently the most obvious way doesn't work.[/QUOTE] If you are trying to overwrite a TTT file, there's lots of hooks you can use, just check the gamemodes source.
[QUOTE=Robotboy655;48029358]Don't do this. Ever. Just don't. Even if it does work right now, it may stop working in the future.[/QUOTE] Why exactly? I can override the TTT HUD etc easily by just putting it in an Initialize hook and overwriting it after the gamemode loads but I don't think there's an equivalent for weapons and entities, and right now I'm doing that by just having myaddon/lua/weapons/weapon_ttt_knife.lua. Is there a better approach that doesn't involve modifying the base gamemode so it gets reset every update?
[QUOTE=ForrestMarkX;48030815]I need some help with a weapon, it's a zombine weapon and what I want it to do when you use secondary fire for the grenade suicide I want it to spawn a grenade model with the trail and attach it to the players right hand but sadly so far it doesn't seem to work the model is invisible and it goes waaaay off nowhere near the hand. Here is the code [code] timer.Simple(0.9, function(wep) self:SendWeaponAnim(ACT_VM_THROW) end) -- timer to pull up grenade if (SERVER) then timer.Simple(3, function(wep) self:Grenade() end) end [/code][/QUOTE] Grrr... my worst pet peeve... timers in predicted hooks....
[QUOTE=A Fghtr Pilot;48031773]Grrr... my worst pet peeve... timers in predicted hooks....[/QUOTE] Any better way to do it? Always open for suggestions
[QUOTE=ForrestMarkX;48031870]Any better way to do it? Always open for suggestions[/QUOTE] [url]http://wiki.garrysmod.com/page/Prediction[/url] Scroll down to timer stuff.
I feel like I'm being dumb here but how come this isn't working? [lua]function RewardPlayer( ply, caller ) if (Value[1] == Value[2] == Value[3]) then print 'yes' else print 'no' end end [/lua] [lua] Value = {math.random(1, 1), math.random(1, 1), math.random(1, 1)} [/lua] It prints no every time, even though right now they are always equal [editline]23rd June 2015[/editline] Never mind - I fixed it all I had to do was make the function [lua] if(Value[1] == Value[2] and Value[2] == Value[3]) then[/lua]
[QUOTE=ForrestMarkX;48031870]Any better way to do it? Always open for suggestions[/QUOTE] A little something called Think Hooks and CurTime().
[QUOTE=WalkingZombie;48000875]So I'm making a shotgun. It uses the C_SHOTGUN model, the Half-Life 2 model, vanilla. I don't want to recompile it, but I have a problem. When it animates, it doesn't play its sounds. Thanks to that, I use EmitSound. The problem is, if I pump the shotgun, and then reload, the pump sound will also play when I fire. I've verified it, and not a single function is being run other than PrimaryAttack when that happens... which means the model itself is emitting the sound. How can I stop this?[/QUOTE]
[QUOTE=WalkingZombie;48034769]I quote myself because I am a tool[/QUOTE] You can't stop that, it's caused by the player model shotgun reload animation.
[QUOTE=Robotboy655;48034880]You can't stop that, it's caused by the player model shotgun reload animation.[/QUOTE] (c) MaxofS2D
[QUOTE=Robotboy655;48034880]You can't stop that, it's caused by the player model shotgun reload animation.[/QUOTE] I quote myself because my message is 2 or 3 pages back and not acknowledged. I've heard that before, and I'm sure there is something that can be done about it... for one, getting the baked sounds to play at the appropriate times, if at all, wtf? If not that, a way to suppress the sounds, but I'm afraid of using a null sound cus it might blank out other sounds too. [editline]23rd June 2015[/editline] I don't want to recompile or replace the shotgun model because I don't want to force people to download a new model, or replacement model, to get my SWEP.
I need to know how to debug crashes. Sometimes when my own code is run, for example a swep, it crashes the game. This can happen very early, but this can also never happen at all. The gmod dump usually skips a few console prints when I look into that, and that's not useful.
[QUOTE=WalkingZombie;48035367] I don't want to recompile or replace the shotgun model because I don't want to force people to download a new model, or replacement model, to get my SWEP.[/QUOTE] It's not about the weapon model, it's the player model animations. [editline]24th June 2015[/editline] I just have to take a look into this one day.
I'm using ply:EmitSound right now as I want the play to emit a sound, however I want to stop the sound when a net.Receive is called, how do I go about this? I can't think of a work around
[QUOTE=FreddiRox!;48037493]I'm using ply:EmitSound right now as I want the play to emit a sound, however I want to stop the sound when a net.Receive is called, how do I go about this? I can't think of a work around[/QUOTE] Whatever sound you're using, make a sound script out of it using [url=http://wiki.garrysmod.com/page/sound/Add]sound.Add[/url], and then in your net.Receive function, use ply:StopSound( soundname ). The reason you have to use sound.Add, if it seems random, is because for some reason you HAVE to use stopsound with sound scripts. Also, put your soundscript in an lua/autorun file.
[QUOTE=A Fghtr Pilot;48037647]Whatever sound you're using, make a sound script out of it using [url=http://wiki.garrysmod.com/page/sound/Add]sound.Add[/url], and then in your net.Receive function, use ply:StopSound( soundname ). The reason you have to use sound.Add, if it seems random, is because for some reason you HAVE to use stopsound with sound scripts. Also, put your soundscript in an lua/autorun file.[/QUOTE] Or he could use an IGmodAudioChannel and stop the sound that way.
[QUOTE=A Fghtr Pilot;48037647]Whatever sound you're using, make a sound script out of it using [url=http://wiki.garrysmod.com/page/sound/Add]sound.Add[/url], and then in your net.Receive function, use ply:StopSound( soundname ). The reason you have to use sound.Add, if it seems random, is because for some reason you HAVE to use stopsound with sound scripts. Also, put your soundscript in an lua/autorun file.[/QUOTE] I did this, thanks a lot. I've also run into another predicament with sounds. Essentially I want a sound to be played the first time a net message is Received, but I'm using a false function, any ideas? [lua] -- cl_init if(Spinning[1] == false) then net.Start('StopSpin') net.SendToServer() end [/lua]
Hey guys, since SetPlayerColor uses Vector(r,g,b) and EVERY OTHER part of the game uses Color(r,g,b) is there any easy way to switch something between vector and color that I'm overlooking?
[QUOTE=B10H4Z4RD;48038939]Hey guys, since SetPlayerColor uses Vector(r,g,b) and EVERY OTHER part of the game uses Color(r,g,b) is there any easy way to switch something between vector and color that I'm overlooking?[/QUOTE] [lua] local c = Color( 255,255,255 ) -- Just so you understand what c is in the code local VectorColor = Vector( c.r / 255, c.g / 255, c.b / 255 ) [/lua]
[QUOTE=James xX;48038966][lua] local c = Color( 255,255,255 ) -- Just so you understand what c is in the code local VectorColor = Vector( c.r / 255, c.g / 255, c.b / 255 ) [/lua][/QUOTE] Thanks bunches!
[QUOTE=James xX;48038966][lua] local c = Color( 255,255,255 ) -- Just so you understand what c is in the code local VectorColor = Vector( c.r / 255, c.g / 255, c.b / 255 ) [/lua][/QUOTE] [QUOTE=B10H4Z4RD;48038984]Thanks bunches![/QUOTE] [lua]local c = Color(255,255,255) local VectorColor = c:ToVector() local ColorVector = VectorColor:ToColor()[/lua] These functions also work for going back and forth without the division.
Why does gm_navigation's Nav:FindPathHull() fail for cases (like starting or ending inside a prop or NPC, but using MASK_OPAQUE) where Nav:FindPath(), util.TraceLine() and util.TraceHull() succeed? [lua] local VEC_START = Vector( 0, 0, 0 ) local VEC_END = VEC_START + Vector( 512, 0, 0 ) -- ...create an NPC or physics prop at VEC_START... PrintTable( util.TraceHull( { start = VEC_START, endpos = VEC_END, mask = MASK_OPAQUE } ) ) -- passes NAV:SetMask( MASK_OPAQUE ) NAV:SetStart( NAV:GetClosestNode( VEC_START + Vector( 0, 0, 1 ) ) ) NAV:SetEnd( NAV:GetClosestNode( VEC_END ) ) NAV:PathFind( print ) -- succeeds NAV:PathFindHull( Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), print ) -- blocked! [/lua]
Anyone know if there's some way to stop things from thinking or mess about with the physics? Trying to make some way to stop time but still allow the player to move
[QUOTE=Robotboy655;48036613]It's not about the weapon model, it's the player model animations. [editline]24th June 2015[/editline] I just have to take a look into this one day.[/QUOTE] That's awfully strange, though. Why doesn't it play when I normally fire? It only plays if I just finished reloading when I decide to fire. In fact, it's a very specific circumstance: Pump, Insert shell, Fire [editline]24th June 2015[/editline] Let me stress, it's manual pump. When I fire, it doesn't automatically pump, but it plays the full firing animation regardless, for both firing AND pumping. And again, normally it doesn't play the pump sound.
[QUOTE=Ylsid;48043190]Anyone know if there's some way to stop things from thinking or mess about with the physics? Trying to make some way to stop time but still allow the player to move[/QUOTE] phys_timescale? :v:
Oh... the shotgun's third person reload animation plays the pump sound :( so lame. No body really knows a way to suppress this event?
Hello all! I was wondering if there was a way to modify a weapon individually. For example, I have this script: [CODE]------------------------------ Give Weapon ------------------- function ulx.giveweapon( calling_ply, target_plys, weapon ) local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] local wep = weapons.Get( weapon ) local ammoamt = wep.Primary.DefaultClip local ammotype = wep.Primary.Ammo for _, k in pairs(v:GetWeapons()) do local wepclass = k:GetClass() if weapons.Get( wepclass ).Kind == wep.Kind then print( wepclass ) --Here to tell me if it successfully found the correct weapons (which it did) v:StripWeapon( wepclass ) end end v:Give( weapon ) v:SetAmmo( ammoamt, ammotype, true ) if wep.Kind == WEAPON_HEAVY then v:SelectWeapon( weapon ) end sound.Play( 'items/gift_pickup.wav', v:GetPos() ) end ulx.fancyLogAdmin( calling_ply, "#A bitch slapped #T!", affected_plys ) end local giveweapon = ulx.command( CATEGORY_NAME, "ulx giveweapon", ulx.giveweapon, "!giveweapon" ) giveweapon:addParam{ type=ULib.cmds.PlayersArg } giveweapon:addParam{ type=ULib.cmds.StringArg, hint="item", completes=ulx.pointshop_item_list } giveweapon:defaultAccess( ULib.ACCESS_SUPERADMIN ) giveweapon:help( "Gives the player a weapon." )[/CODE] How could I modify this to make it give me a version of the weapon I passed it with one value modified? For example, if I passed it [URL="http://pastebin.com/9STz3B8g"]weapon_zm_rifle[/URL], is there any way for the rifle the player receives to have SWEP.ViewModelFlip = true?
When using DIconLayout, it seems if you call GetPos() on a child panel, it returns it's position relative to 0,0 and not relative to it's parent. Is there any way to work around this?
Take the child position and subtract it from the parent position.
[QUOTE=Revenge282;48045990]Take the child position and subtract it from the parent position.[/QUOTE] The parent is a child of a DListLayout so it's also returning 0,0 as it's GetPos :suicide:
Sorry, you need to Log In to post a reply to this thread.