Attempt to call field 'Create' (a nil value) error
2 replies, posted
This one has been bugging me (supposedly an issue with the prop creation line) and I cannot figure out the solution to it:
[ERROR] addons/icebending/lua/weapons/icebending.lua:116: attempt to call field 'Create' (a nil value)
1. unknown - addons/icebending/lua/weapons/icebending.lua:116
Here is the code:
[CODE]function SWEP:PrimaryAttack( right )
self.Owner:SetAnimation( PLAYER_ATTACK1 )
local anim = "fists_left"
if ( right ) then anim = "fists_left" end
local num = math.random(1,50)
for i=1,5 do
if num == i then
anim = "fists_left"
end
end
local vm = self.Owner:GetViewModel()
vm:SendViewModelMatchingSequence( vm:LookupSequence( anim ) )
self:EmitSound( SwingSound )
self:UpdateNextIdle()
self:SetNextMeleeAttack( CurTime() + 0.5 )
self:SetNextPrimaryFire( CurTime() + 0.5 )
self:SetNextSecondaryFire( CurTime() + 0.5 )
if self.Owner:KeyDown(IN_USE) then
local snowball = ents.Create("prop_physics")
self.Ball = snowball
self.Ball:SetModel("models/props_debris/concrete_chunk01c.mdl")
self.Ball:SetPos(self.Owner:GetShootPos()+(self.Owner:GetAimVector()*35))
self.Ball:SetAngles(self.Owner:EyeAngles(15) )
self.Ball:SetMaterial("phoenix_storms/pack2/darkblue")
self.Ball:SetPhysicsAttacker(self.Owner)
self.Ball:Spawn()
self.PhysBall = self.Ball:GetPhysicsObject()
self.Ball:EmitSound("ambient/machines/slicer4.wav")
self.PhysBall:SetMass(500)
self.PhysBall:ApplyForceCenter(self.Owner:GetAimVector(1) * 1000000)
self.Ball:Fire("kill", "", 10)
local trail = util.SpriteTrail( snowball, 0, Color( 0, 255, 255, 255 ), false, 100, 300, .4, 1, 'trails/smoke.vmt' )
self:DeleteOnRemove( trail )
local trail = util.SpriteTrail( snowball, 0, Color( 255, 255, 255, 255 ), false, 50, 200, .6, 1, 'trails/smoke.vmt' )
self:DeleteOnRemove( trail )
end[/CODE]
Any help will be greatly appreciated. Thanks!
ents.Create only works serverside. Add a realm check in-line with your IN_USE check.
[QUOTE=code_gs;50707609]ents.Create only works serverside. Add a realm check in-line with your IN_USE check.[/QUOTE]
*edit*
Nevermind, I see what the issue was. Thanks for the help.
Sorry, you need to Log In to post a reply to this thread.