Author Topic: Need help with coding!  (Read 1958 times)

0 Members and 3 Guests are viewing this topic.

Offline Rain

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
Need help with coding!
« on: July 05, 2015, 08:44:26 AM »
So I'm not very good at this and I've searched all over!

I'm wanting a prop to auto spawn on players backs ( for my zombie server )

I tried making the prop into an entity and got these errors-

It will spawn, but it is invisible and nothing can be done to it then this error shows in console~

[ERROR]

[ERROR] addons/backpack/lua/entities/ent_backpack/init.lua:6: attempt to index global 'self' (a nil value)
  1. unknown - addons/backpack/lua/entities/ent_backpack/init.lua:6
   2. Spawn - [C]:-1
    3. SpawnFunction - gamemodes/base/entities/entities/base_entity/init.lua:77
     4. Spawn_SENT - gamemodes/sandbox/gamemode/commands.lua:609
      5. unknown - gamemodes/sandbox/gamemode/commands.lua:674
       6. unknown - lua/includes/modules/concommand.lua:54


[MY SCRIPT]
[INIT.LUA FILE]

AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )

function ENT:Initialize()

    self:SetModel( "models/fallout3/campish_pack.mdl" )
   self:PhysycsInit( SOLID_VPHYSICS )
   self:SetMoveType( MOVETYPE_VPHYSICS )
   self:SetSolid( SOLID_VPHYSICS )
   self:SetUseType( SIMPLE_USE )
   Self:DrawShadow( false )

end

function ENT:Think()
local owner=self:GetOwner()
if owner==NULL then return end
local bone=owner:LookupBone("ValveBiped.Bip01_Spine")
if(bone)then
local position,angles=owner:GetBonePosition(bone)
angles:RotateAroundAxis(angles:Forward(),0)
angles:RotateAroundAxis(angles:Right(),-90)
angles:RotateAroundAxis(angles:Up(),0)
self.Entity:SetPos(position+(angles:Up()*-7)+(angles:Forward()*8))
self.Entity:SetAngles(angles)
end
end

I NEED URGENT HELP PLEASE :(!
« Last Edit: July 05, 2015, 08:46:17 AM by Rain »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given