Guten Abend,
Ich habe ein kleines Problem, ich möchte gerne mein Model, welches ich für mein SWep Addon benutze einmal drehen, so dass die Person das Model anders hält, leider funktioniert es nicht mit "GetViewModelPosition"
Ich weiß leider auch nicht weiter, da ich gerade erst angefangen habe zu Programmieren.
Ich bin über jede Hilfe sehr dankbar!
Hier ist mein Code:
SWEP.PrintName = "Besen"
SWEP.Author = "SnapBacks"
SWEP.Instructions = "Linke Maustaste drücken um zu fegen."
SWEP.Category = "Besen"
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = "none"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 2
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
SWEP.ViewModel = "models/props_c17/pushbroom.mdl"
SWEP.WorldModel = "models/props_c17/pushbroom.mdl"
SWEP.ShootSound = Sound( "weapons/broom/sweep1.mp3" )
function SWEPrimaryAttack()
self:SetNextPrimaryFire( CurTime() + 0.5 )
end
function SWEP:SecondaryAttack()
end
function SWEP:Besen( model_file )
local owner = self:GetOwner()
if ( not owner:IsValid() ) then return end
self:EmitSound( self.ShootSound )
if ( CLIENT ) then return end
local ent = ents.Create( "prop_physics" )
if ( not ent:IsValid() ) then return end
ent:SetModel( model_file )
local aimvec = owner:GetAimVector()
local pos = aimvec * 16
pos:Add( owner:eyePos() )
ent:SetPos ( pos )
ent:SetAngles( owner:EyeAngles() )
ent:Spawn()
local phys = ent.GetPhysicsObject()
if ( not phys:IsValid() ) then ent:Remove() return end
aimvec:Mul ( 100 )
aimvec.Add( VectorRand( -10, 10 ) )
phys:ApplyForceCenter( aimvec )
cleanup.Add( owner, "props", ent )
undo.Create( "Besen" )
undo.AddEntity( ent )
undo.SetPlayer( owner )
undo.Finish()
end