ULX

Author Topic: world model repositioning script issue  (Read 2648 times)

0 Members and 1 Guest are viewing this topic.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
world model repositioning script issue
« on: March 15, 2013, 09:22:04 AM »
I've being using this script to reposition a world model, it works perfectly however, i had one issue. I am using this for the ttt gamemode and when the weapon is dropped it causes the world model to freeze in place for anyone who was looking at the world model however the person dropping it sees it fall no problem. Does anyone know how i can modify this code to make it so the world model actually falls?

Code: [Select]
SWEP.Offset = {
Pos = {
Up = 0,
Right = 1,
Forward = -3,
},
Ang = {
Up = 0,
Right = 0,
Forward = 0,
}
}

function SWEP:DrawWorldModel( )
local hand, offset, rotate

if not IsValid( self.Owner ) then
self:DrawModel( )
return
end

if not self.Hand then
self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
end

hand = self.Owner:GetAttachment( self.Hand )

if not hand then
self:DrawModel( )
return
end

offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up

hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )

self:SetRenderOrigin( hand.Pos + offset )
self:SetRenderAngles( hand.Ang )

self:DrawModel( )
end
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: world model repositioning script issue
« Reply #1 on: March 15, 2013, 01:03:06 PM »
Make sure you're running it on the server and not the client. It sounds like you're only running the drop logic on the clients.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: world model repositioning script issue
« Reply #2 on: March 15, 2013, 01:54:29 PM »
Quick view of the code would indicate to me, what megiddo said.
Too many 'self', no server player objects.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: world model repositioning script issue
« Reply #3 on: March 15, 2013, 02:49:50 PM »
its in a shared.lua should i put it in a different file? Also the way ttt is coded when you press q the weapon is dropped its written into the gamemode im only using this script because if i dont the weapons world model appears in the middle of the player model and not in the player models hands.
« Last Edit: March 15, 2013, 02:51:52 PM by bender180 »
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.