Ulysses
General => Off-Topic => Topic started by: bender180 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?
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
-
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.
-
Quick view of the code would indicate to me, what megiddo said.
Too many 'self', no server player objects.
-
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.