Author Topic: Weapon Hands  (Read 3832 times)

0 Members and 1 Guest are viewing this topic.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Weapon Hands
« on: August 16, 2013, 04:53:36 AM »
 :'( Sadly this is not a ulx related question, I just feel it's best to ask it here first before going to other forums.. i.e. facepunch.
Anyways,

So for the last year I've been creating a gamemode called jokingly: Very Basic Team Deathmatch. Which in relatity it's not basic at all, and it's really complex actually.
You can see it here: http://steamcommunity.com/sharedfiles/filedetails/?id=116777393

Anyways, so ever since Garry (ugh... why does he do things) updated garry's mod to add.. "hands" on the weapons, the models of my gamemode no longer show the hands for the DEFAULT hl2 weapons that are default for garry's mod. I mean it's just annoying, it's not causing any problems or anything like that. I would like to know if anyone has a suggestion or fix, I've tried looking on the not well made wiki.garrysmod.com site for my 'hands help', but no luck at all.

So I just hope someone here can help me, thanks friends.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Weapon Hands
« Reply #1 on: August 16, 2013, 05:13:27 AM »
Actually, as soon as I posed this my friend on steam found out how to fix this. So yeah...
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Weapon Hands
« Reply #2 on: August 16, 2013, 10:08:07 AM »
Maybe post the solution you found instead of just saying you found a solution and closing the thread.

This might still come up for people who have the same problem down the road.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Weapon Hands
« Reply #3 on: August 16, 2013, 01:23:46 PM »
Those who are having the same issue with the hand models not showing on your gamemode, or generally your server, you can either go here or just use the code (which I recommend):
http://facepunch.com/showthread.php?t=1285788
http://facepunch.com/showthread.php?t=1285087


Just place this in any server side file:
Code: [Select]
// I don't know how this works, nor do I care. It just gives my gamemode hands! - Msg From Apple
function HandsSpawn(ply)
local oldhands = ply:GetHands()
if ( IsValid( oldhands ) ) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if ( IsValid( hands ) ) then
ply:SetHands( hands )
hands:SetOwner( ply )

-- Which hands should we use?
local cl_playermodel = ply:GetInfo( "cl_playermodel" )
local info = player_manager.TranslatePlayerHands( cl_playermodel )
if ( info ) then
hands:SetModel( info.model )
hands:SetSkin( info.skin )
hands:SetBodyGroups( info.body )
end

-- Attach them to the viewmodel
local vm = ply:GetViewModel( 0 )
hands:AttachToViewmodel( vm )

vm:DeleteOnRemove( hands )
ply:DeleteOnRemove( hands )

hands:Spawn()
end
end

hook.Add( "PlayerSpawn", "HandsSpawn", HandsSpawn )


Then place this in any client side file
Code: [Select]
// I don't know how this works, nor do I care. It just gives my gamemode hands! - Msg From Apple
function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
if ( IsValid( hands ) ) then hands:DrawModel() end
end
end
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.