View model in my head and world model sticking out of my side.

So its my first time trying to make a swep. Obviously I wanted to think outside of the box and do a custom model. The only problem is that the view model is in my head (see pictures) and the world model is sticking out of my side (see pictures).

Code:


SWEP.Base = "weapon_base" -- Sets up everything not defined in this script (It's not because I'm leaving stuff out, it just defines what to do with animations etc)

-- Effect settings
SWEP.PrintName		= "Fallout 3 Gun Test"	-- The name of the weapon
SWEP.Slot			= 1					-- The weapon slot this SWEP belongs in (0-5)
SWEP.SlotPos		= 4					-- The position in the slot this weapon belongs in (0-infinity, DO NOT COVER UP EXISTING WEAPONS)
SWEP.DrawAmmo		= true				-- Display how much ammo this weapon has left?
SWEP.DrawCrosshair	= true				-- Display the crosshair?
SWEP.ViewModel		= "models/llama/10mmsil.mdl"	-- First person model
SWEP.WorldModel		= "models/llama/10mmsil.mdl"	-- Third person model
SWEP.ReloadSound	= "weapons/pistol/pistol_reload1.wav"	-- What sound should this weapon make when reloaded?
SWEP.HoldType		= "pistol"			-- What kind of weapon this is (to define how it's held)
-- Other settings
SWEP.Weight				= 5			-- How powerful is this weapon?
SWEP.AutoSwitchTo		= false		-- Automatically switch to this weapon if it's more powerful than what we're already holding
SWEP.AutoSwitchFrom		= false		-- Automatically switch from this weapon if what we pick up is more powerful than this weapon
SWEP.Spawnable			= true		-- Can clients spawn this weapon?
SWEP.AdminSpawnable		= true		-- Can admins spawn this weapon?
 
-- Weapon info
SWEP.Author			= "Supergamer22"		-- Who made this
SWEP.Contact		= "I do not like spam"		-- How you can contact who made this
SWEP.Purpose		= "A Fallout 3 10mm Pistol"	-- Why was this made?
SWEP.Instructions	= "SHOOT"		-- How do you use this?

-- Primary fire settings
SWEP.Primary.Sound			= "Weapon_Pistol.Single"	-- What sound should this weapon make when fired?
SWEP.Primary.Damage			= 20		-- How much damage each bullet inflicts
SWEP.Primary.NumShots		= 1			-- How many bullets we should shoot each time we fire the weapon (Use more than one for shotguns and the like)
SWEP.Primary.Recoil			= 0			-- How much we should punch the view
SWEP.Primary.Cone			= 1			-- How many degrees the bullets can spread (90 max)
SWEP.Primary.Delay			= 0.1		-- How many seconds between each shot
SWEP.Primary.ClipSize		= 32		-- How big the clip is
SWEP.Primary.DefaultClip	= 64		-- How much ammo the gun comes with
SWEP.Primary.Tracer			= 1			-- Fire a tracer round every so many bullets
SWEP.Primary.Force			= 50			-- How much force the bullets have when they hit physics objects
SWEP.Primary.TakeAmmoPerBullet = true	-- Take 1 ammo for each bullet = true, take 1 ammo for each shot = false
SWEP.Primary.Automatic		= false		-- Is this weapon automatic?
SWEP.Primary.Ammo			= "pistol"	-- Primary ammo type

-- Secondary fire settings
SWEP.Secondary.Sound		= ""		-- What sound should this weapon make when fired?
SWEP.Secondary.Damage		= 0			-- How much damage each bullet inflicts
SWEP.Secondary.NumShots		= 0			-- How many bullets we should shoot each time we fire the weapon (Use more than one for shotguns and the like)
SWEP.Secondary.Recoil		= 0			-- How much we should punch the view
SWEP.Secondary.Cone			= 0			-- How many degrees the bullets can spread (90 max)
SWEP.Secondary.Delay		= 0			-- How many seconds between each shot
SWEP.Secondary.ClipSize		= 0			-- How big the clip is
SWEP.Secondary.DefaultClip	= 0			-- How much ammo the gun comes with
SWEP.Secondary.Tracer		= 0			-- Fire a tracer round every so many bullets
SWEP.Secondary.Force		= 0			-- How much force the bullets have when they hit physics objects
SWEP.Secondary.TakeAmmoPerBullet = true	-- Take 1 ammo for each bullet = true, take 1 ammo for each shot = false
SWEP.Secondary.Automatic	= false		-- Is this weapon automatic?
SWEP.Secondary.Ammo			= "none"		-- Secondary ammo type

-- Functions that we can use to run certain code at certain times
-- I don't suggest you play around with this stuff unless you know what you're doing

function SWEP:Initialize()			-- Called when this script is run
end

function SWEP:PrimaryAttack()		-- Called when we press primary fire
	if ( !self:CanPrimaryAttack() ) then return end		-- If we shouldn't be shooting, don't shoot
	local bullet = {}	-- Set up the shot
		bullet.Num = self.Primary.NumShots				-- How many bullets we'll fire at once
		bullet.Src = self.Owner:GetShootPos()			-- Where the bullets are coming from
		bullet.Dir = self.Owner:GetAimVector()			-- Where the bullets are headed
		bullet.Spread = Vector( self.Primary.Cone / 90, self.Primary.Cone / 90, 0 )	-- Bullet spread
		bullet.Tracer = self.Primary.Tracer				-- Set up tracer rounds
		bullet.Force = self.Primary.Force				-- Set the bullet's force
		bullet.Damage = self.Primary.Damage				-- Define how much damage each bullet does
		bullet.AmmoType = self.Primary.Ammo				-- Define what kind of ammo we're using
		self.Owner:FireBullets( bullet )				-- Shoot!
	self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )	-- View model animation
	self.Owner:MuzzleFlash()							-- Crappy muzzle light
	self.Owner:SetAnimation( PLAYER_ATTACK1 )			-- 3rd Person Animation
	self.Weapon:EmitSound(Sound(self.Primary.Sound))	-- Make shooty noises
	self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 ))
	if (self.Primary.TakeAmmoPerBullet) then			-- Set up ammo loss
		self:TakePrimaryAmmo(self.Primary.NumShots)
	else
		self:TakePrimaryAmmo(1)
	end
	self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )	-- Don't shoot again until the delay has expired
end

function SWEP:SecondaryAttack()		-- Called when we press secondary fire
	if ( !self:CanSecondaryAttack() ) then return end	-- If we shouldn't be shooting, don't shoot
	local bullet = {}	-- Set up the shot
		bullet.Num = self.Secondary.NumShots			-- How many bullets we'll fire at once
		bullet.Src = self.Owner:GetShootPos()			-- Where the bullets are coming from
		bullet.Dir = self.Owner:GetAimVector()			-- Where the bullets are headed
		bullet.Spread = Vector( self.Secondary.Cone / 90, self.Secondary.Cone / 90, 0 )	-- Bullet spread
		bullet.Tracer = self.Secondary.Tracer			-- Set up tracer rounds
		bullet.Force = self.Secondary.Force				-- Set the bullet's force
		bullet.Damage = self.Secondary.Damage			-- Define how much damage each bullet does
		bullet.AmmoType = self.Secondary.Ammo			-- Define what kind of ammo we're using
		self.Owner:FireBullets( bullet )				-- Shoot!
	self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )	-- View model animation
	self.Owner:MuzzleFlash()							-- Crappy muzzle light
	self.Owner:SetAnimation( PLAYER_ATTACK2 )			-- 3rd Person Animation
	self.Weapon:EmitSound(Sound(self.Secondary.Sound))	-- Make shooty noises
	self.Owner:ViewPunch(Angle( -self.Secondary.Recoil, 0, 0 ))
	if (self.Secondary.TakeAmmoPerBullet) then			-- Set up ammo loss
		self:TakeSecondaryAmmo(self.Secondary.NumShots)
	else
		self:TakeSecondaryAmmo(1)
	end
	self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )	-- Don't shoot again until the delay has expired
end

function SWEP:Think()				-- Called every frame while this weapon is active
end

function SWEP:Reload()				-- Called when we reload
	self:DefaultReload(ACT_VM_RELOAD)
	return true
end

function SWEP:Deploy()				-- Called when we take this weapon out
	return true
end

function SWEP:Holster()				-- Called when we put this weapon away
	return true
end

function SWEP:OnRemove()			-- Called right before this gun goes bye-bye
end

function SWEP:OnRestore()			-- Called when we load a save where you have this weapon, or if the admin changes the map
end

function SWEP:Precache()			-- Use this function to precache resources
end

function SWEP:OwnerChanged()		-- Called when this weapons is dropped or someone else picks it up
end



Already been done

Just rename the model and materials, use that

Theres also a SWEP Made by the same guy :expressionless:

The point of Lua isn’t always to make something new, maybe you’re just making it for practice. Don’t rate him “dumb” just because somebody else made a pistol.

As for your problem, I think issues will arise when you try to use a world model as a view model.

^^^^


SWEP.ViewModel		= "models/llama/10mmsil.mdl"	-- First person model
SWEP.WorldModel		= "models/llama/10mmsil.mdl"	-- Third person model

You need to make 2 diffrent models, one Viewmodel one world, not just copys Just google how to make a view model i’m sure you will find what you need

Lol funny part is i wasn’t the one that rated him dumb

I don’t think you’re going to find too much there.

Lrn2 b creativ in googling

also theres a tut on how to do it in XSI which i think is easier