1. Post #3041

    October 2015
    253 Posts
    uh all I did was print caller from
    function ENT:Use(activator, caller)
    You sure you're usin it serverside? That should work.

  2. Post #3042

    September 2016
    54 Posts
    uh all I did was print caller from
    function ENT:Use(activator, caller)
    Taken from the Wiki ENT:Use
    Code:
    function ENT:Use( activator, caller )
    	if IsValid( caller ) and caller:IsPlayer() then
    		caller:Kill()
    	end
    end
    Give that a go?

  3. Post #3043
    bigdogmat's Avatar
    May 2014
    873 Posts
    uh all I did was print caller from
    function ENT:Use(activator, caller)
    You're using this on a scripted entity right?

  4. Post #3044
    MGFear's Avatar
    August 2016
    192 Posts
    You're using this on a scripted entity right?
    yeup its a scripted entity

  5. Post #3045
    DonkeySoda's Avatar
    January 2016
    150 Posts
    I'm trying to preset a bodygroup value but I don't know where to put this code in the QC file :
    Code:
    static int BodyGroup_Sights = FindBodygroupByName("sights"); // calculate this value once
    SetBodygroup( BodyGroup_Sights , 1 ); // laser dot
    Should I put it inside the $bodygroup box?
    Code:
    $bodygroup sights
    {
    	studio "ironsights.smd"
    	studio "laser_dot.smd"
    	blank
    }
    Reply With Quote Edit / Delete Reply Windows 8.1 Chrome Brazil Show Events Dumb Dumb x 1 (list)

  6. Post #3046
    Shit
    On
    Shit
    code_gs's Avatar
    March 2013
    18,500 Posts
    No, that code has to be in the mod you are making the model for. Model-wise, you just have to make you name your bodygroup "sights".
    Reply With Quote Edit / Delete Reply Android Chrome United States Show Events Informative Informative x 1 (list)

  7. Post #3047

    March 2014
    43 Posts
    I can't seem to hide a AvatarImage from a DarkRP HUD properly



    Code:
    local av
    local function DrawPlayerAvatar( p )	
    	av = vgui.Create("AvatarImage")
    	av:SetPos(64,ScrH() - 130)
    	av:SetSize(56, 56)
    	av:SetPlayer( p, 64 )
    end
    
    local function HUDPaint()
    	if av then
    		return
    	else
    		DrawPlayerAvatar( LocalPlayer() )
    	end
    end
    
    hook.Add("HUDPaint", "DarkRP_Mod_HUDPaint", HUDPaint)

    I tried putting in a hook.Call for HUDShouldDraw then doing av:Remove but it doesn't seem to remove. I know when the camera is out it returns true, so it should but doesn't work.. (also tried SetVisible and overwriting the Panel:Paint function)

    Ideas? The HUD is a copy of SleekHUD that's no longer being sold.

    It didn't work, the panel is still visible with the camera out...


    Also.... is there a way to remove a weapon that you registered with https://wiki.garrysmod.com/page/weapons/Register ?

    P.S. How does one embed the wiki links properly and rate things again I've not used the forums in a long time..

  8. Post #3048
    Touhou Enthusiast
    Shendow's Avatar
    January 2011
    1,071 Posts
    It didn't work, the panel is still visible with the camera out...
    When creating the avatar, call Panel:SetPaintedManually so it only draws when you tell it to with Panel:PaintManual, aka when av exists.

    Here's some example code:
    local av
    hook.Add("HUDPaint", "test", function()
    	if (IsValid(av)) then
    		av:PaintManual()
    	else
    		av = vgui.Create("AvatarImage")
    		av:SetPlayer(LocalPlayer())
    		av:SetPaintedManually(true)
    	end
    end)
    

    You cannot remove a weapon defined with weapons.Register. Why would you even need to do that?

    To embed wiki pages you just have to press on the link button next to the realm:


    To rate posts I believe you need a certain amount of posts. Ratings should appear on the bottom-right of a post when hovering it.

  9. Post #3049
    Gold Member
    Ilyaaa's Avatar
    April 2013
    184 Posts
    Can anyone tell me why this may not be working? Using player classes to change movement but for some reason it won't work with IN_MOVELEFT or IN_MOVERIGHT. I've tried SetButtons on both cmd and mv but still nothing.

    Code:
    function PLAYER:StartMove( mv, cmd )
        if cmd:KeyDown( IN_JUMP ) then
            if cmd:GetMouseX() < 0 then
                mv:SetButtons( bit.bor( mv:GetButtons(), IN_MOVELEFT ) )
    
            elseif cmd:GetMouseX() > 0 then
                mv:SetButtons( bit.bor( mv:GetButtons(), IN_MOVERIGHT ) )
    
            end
        end
    end
    When I print GetButtons() in FinishMove it shows them as being active but still doesn't actually do anything.

  10. Post #3050
    bigdogmat's Avatar
    May 2014
    873 Posts
    Can anyone tell me why this may not be working? Using player classes to change movement but for some reason it won't work with IN_MOVELEFT or IN_MOVERIGHT. I've tried SetButtons on both cmd and mv but still nothing.



    When I print GetButtons() in FinishMove it shows them as being active but still doesn't actually do anything.
    Changing the buttons here won't affect anything, use CMoveData:SetForwardSpeed and CMoveData:SetSideSpeed
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Lua Helper Lua Helper x 1 (list)

  11. Post #3051
    Gold Member
    Ilyaaa's Avatar
    April 2013
    184 Posts
    Changing the buttons here won't affect anything, use CMoveData:SetForwardSpeed and CMoveData:SetSideSpeed
    Thank you, did not know this. Weird how that doesn't work, but this autohop does...

    Code:
    function PLAYER:StartMove( mv, cmd )
        if not self.Player:IsOnGround() 
        and self.Player:WaterLevel() < 2 
        and self.Player:GetMoveType() != MOVETYPE_LADDER then
            mv:SetButtons( bit.band( mv:GetButtons(), bit.bnot( IN_JUMP ) ) )
        end
    end
    and again this doesn't

    Code:
    function PLAYER:StartMove( mv, cmd )
        if mv:KeyDown( IN_MOVELEFT ) then
            mv:SetButtons( bit.band( mv:GetButtons(), bit.bnot( IN_MOVELEFT ) ) )
    
        end
    
        if mv:KeyDown( IN_MOVERIGHT ) then
            mv:SetButtons( bit.band( mv:GetButtons(), bit.bnot( IN_MOVERIGHT ) ) )
    
        end
    end
    Edited:

    edit: Actually, I can see how...

  12. Post #3052
    MPan1's Avatar
    March 2015
    3,482 Posts
    Is it better to use the word 'general' or 'generic' when referring to something in general?

    Garry's Mod seems to use 'generic', but I don't know if that is correct.

  13. Post #3053
    Shit
    On
    Shit
    code_gs's Avatar
    March 2013
    18,500 Posts
    Is it better to use the word 'general' or 'generic' when referring to something in general?

    Garry's Mod seems to use 'generic', but I don't know if that is correct.
    Could you give an example?

  14. Post #3054
    MPan1's Avatar
    March 2015
    3,482 Posts

  15. Post #3055

    October 2015
    253 Posts
    Is it better to use the word 'general' or 'generic' when referring to something in general?

    Garry's Mod seems to use 'generic', but I don't know if that is correct.
    A lotta the times, they're interchangeable. They mean pretty much the same thing. However, some cases, they are not interchangeable, like when you are referring to an unbranded drug like aspirin or ibuprofen, you'll say generic. If you are saying something like "In general", its a little weird to say "Generically, " even tho it still works. And also has slightly different connotations. To refer to something in general, just use in general.

    A little off topic, but why does your rule book say "No unnecessary local foo = foo." when the link that the line points to says to use it? And general shouldn't ALWAYS be used. Depends on context which one to use.

  16. Post #3056
    MPan1's Avatar
    March 2015
    3,482 Posts
    A lotta the times, they're interchangeable. They mean pretty much the same thing. However, some cases, they are not interchangeable, like when you are referring to an unbranded drug like aspirin or ibuprofen, you'll say generic. If you are saying something like "In general", its a little weird to say "Generically, " even tho it still works. And also has slightly different connotations. To refer to something in general, just use in general.

    A little off topic, but why does your rule book say "No unnecessary local foo = foo." when the link that the line points to says to use it? And general shouldn't ALWAYS be used. Depends on context which one to use.
    What about NOTIFY_GENERIC? Shouldn't that then technically be NOTIFY_GENERAL?

    Edited:

    A little off topic, but why does your rule book say "No unnecessary local foo = foo." when the link that the line points to says to use it?
    It's a mess. I just thought that it looks bad really

  17. Post #3057

    March 2014
    43 Posts
    When creating the avatar, call Panel:SetPaintedManually so it only draws when you tell it to with Panel:PaintManual, aka when av exists.

    Here's some example code:
    local av
    hook.Add("HUDPaint", "test", function()
    	if (IsValid(av)) then
    		av:PaintManual()
    	else
    		av = vgui.Create("AvatarImage")
    		av:SetPlayer(LocalPlayer())
    		av:SetPaintedManually(true)
    	end
    end)
    

    You cannot remove a weapon defined with weapons.Register. Why would you even need to do that?

    To embed wiki pages you just have to press on the link button next to the realm:


    To rate posts I believe you need a certain amount of posts. Ratings should appear on the bottom-right of a post when hovering it.
    I feel as if you could maybe using weapons.GetStored


    It's late so, I might edit this but if anyone has a way to unregister a weapon please, do tell.. I have need to do so.

  18. Post #3058

    October 2015
    253 Posts
    What about NOTIFY_GENERIC? Shouldn't that then technically be NOTIFY_GENERAL?

    Edited:



    It's a mess. I just thought that it looks bad really
    Well, a generic notification and general notification pretty much have the exact same meaning and connotation so it wouldn't matter. Just use which one sounds better. If they both sound ok, just either one.