Welcome, Guest. Please login or register.

Author Topic: Prop missing model name.  (Read 4189 times)

0 Members and 1 Guest are viewing this topic.

Offline Monp

Prop missing model name.
« on: May 12, 2011, 01:40:19 AM »
I am messing around with lua and SWEP, and the weapon I am trying to make is not working and I just might be overlooking something but i cannot find out what is wrong.

Code: [Select]

if (SERVER) then
AddCSLuaFile("shared.lua")

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

end

if (CLIENT) then
SWEP.PrintName = "Pumpkin Shooter"
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false

end

SWEP.Author = "Monp"
SWEP.Contact = "Monp787@gmail.com"
SWEP.Purpose = "Throwing a Pumpkin."
SWEP.Instructions = "Left Click to throw a pumpkin."
SWEP.Category = "Prop Launcher"

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"

SWEP.Primary.ClipSize =  -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"

local ShootSound = Sound("Metal.SawbladeStick")

function SWEP:Reload()
end

function SWEP:Think()
end

function SWEP:throw_attack(model_file)
local tr = self.Owner:GetEyeTrace()
self.Weapon:EmitSound(ShootSound)
self.BaseClase.ShootEffects(self)
if (!SERVER) then return end

local ent = ents.Create("prop_physics")
ent:SetModel(model_file)
ent:SetPos(self.Owner:EyePos() + (self.Owner.GetAimVector() * 16))
ent:SetAngles(self.Owner:EyeAngles())
ent:Spawn()

local phys = ent:GetPhysicsObject()
local shot_length = tr.HitPos:Length()
phys:ApplyForceCenter(self.Owner:GetVectorAim():GetNormalized() * math.pow(shot_length, 3))

cleanup.Add(self.Owner, "props", ent)
undo.Create("prop_physics")
undo.AddEntity(ent)
undo.SetPlayer(self.Owner)
undo.Finish()

end

function SWEP:PrimaryAttack()
self:throw_attack("models/pumpkin/pumpkin.mdl")
end


function SWEP:SecondaryAttack()
end

whenever i load the game mode it tells me prop at 824 -32 -142 missing modelname

Offline Inject OH 4

Re: Prop missing model name.
« Reply #1 on: May 12, 2011, 02:44:14 AM »
Slightly offtopic. Is SWEP.Weight = 5 going to make you walk slower? :O
Quote from:  Winston
We shall defend our island, whatever the cost may be, we shall fight on the beaches, we shall fight on the landing grounds, we shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender.
Quote from:  Zombie
Valuve Admin Steve: If not we at valve can act as a "guardian gateway".
Valuve Admin Steve: I will be your daddy.
Looking for graphic artist, Photoshopers, and other graphic related people. Hit me a PM if you can help!

Conjoint Gaming [Game On]

Re: Prop missing model name.
« Reply #1 on: May 12, 2011, 02:44:14 AM »

Offline Monp

Re: Prop missing model name.
« Reply #2 on: May 12, 2011, 03:11:12 AM »
I am not really sure I am learning from the tutorials that were posted on here. I don't know much about any of the gmod stuff I am currently trying to learn.

Conjoint Gaming [Game On]

Re: Prop missing model name.
« Reply #2 on: May 12, 2011, 03:11:12 AM »

 


* ShoutBox!

Refresh History

SimplePortal 2.3.5 © 2008-2012, SimplePortal