[Help]Problem whit a spawned Entity

FIXED…Check the new code

Hello,i can fix my enitiy,so,i can spawn it,and i add function,but,when i spawn it and i move the entity,the origin doesn’t move,just move the prop…

See the picture

http://cloud.steampowered.com/ugc/559796680955225395/11D3171F8C5BFE7DF260EF4D382F281C588198BB/

The code of the Shared.lua (the unique code)

[lua]
ENT.Base = “base_anim”
ENT.Type = “anim”
ENT.Category = “Gonzalolog”
ENT.PrintName = “Iphone”
ENT.Author = “Gonzalolog”
ENT.Contact = “”
ENT.Purpose = “A flash white :D”
ENT.Instructions = “”
ENT.Spawnable = true
ENT.AdminSpawnable = true

bateria = 10

function ENT:Initialize()

self.Entity:SetModel( "models/nitro/iphone4.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )     
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )   
self.Entity:SetSolid( SOLID_VPHYSICS )         
self.Entity:SetUseType(SIMPLE_USE)
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
	phys:Wake()
end

end

function ENT:SpawnFunction( ply, tr )

if !tr.Hit then return end

local SpawnPos = tr.HitPos + tr.HitNormal * 16

local ent = ents.Create( "iphone" )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()

return ent

end

function ENT:Use(user)
user:ConCommand(“pp_colormod 1”)
user:ConCommand(“pp_colormod_addb 35”)
user:ConCommand(“pp_colormod_addr 35”)
user:ConCommand(“pp_colormod_addg 35”)
user:ConCommand(“pp_motionblur 1”)
bateria = ( 10 - 1 )
self.Entity:EmitSound(“npc/scanner/scanner_photo1.wav”, 100, 100)
timer.Simple(5, function()
user:ConCommand(“pp_colormod_addb 0”)
user:ConCommand(“pp_colormod_addr 0”)
user:ConCommand(“pp_colormod_addg 0”)
user:ConCommand(“pp_motionblur 0”)
user:ConCommand(“pp_colormod 0”)

	end)

end

function ENT:OnRemove()
self.Entity:EmitSound(“npc/scanner/cbot_servoscared.wav”, 100, 100)
end

function ENT:OnTakeDamage(dmg)
local vPoint = self.Entity:GetPos()
local effectdata = EffectData()
effectdata:SetStart( vPoint )
effectdata:SetOrigin( vPoint )
effectdata:SetScale( 1 )
self.Entity:Remove()
util.Effect( “cinematicexplosion”, effectdata )
destruido = true
end
[/lua]

Thanks for help :smiley:

Just saying, you do not need to use self.Entity when referring tonthe entity.
Just use self instead.

Thanks,but it doesn’t work :frowning:

I’ve change the initialize code by
[lua]
self:SetModel(“models/nitro/iphone4g.mdl”)

self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )

[/lua]

I can’t get what i do :S