[IMG]http://blog.donga.com/monadko/files/2013/02/1485176961361799826.jpg[/IMG]
Hi, I'm having a problem with that. When I spawn entity, my nickname freezes there (명박오니●) not attached to that white thing.
How can I attach my nickname to that white thing?
I have code here: [CODE]if (SERVER) then
resource.AddFile("materials/entities/sent_jetpack.png");
end;
AddCSLuaFile();
ENT.Type = "anim";
ENT.PrintName = "nametag";
ENT.Author = "Chessnut";
ENT.Information = "touch";
ENT.Category = "tag";
ENT.Spawnable = true;
function ENT:SetupDataTables()
self:NetworkVar("Int", 0, "Thrust");
self:NetworkVar("Int", 0, "DamageAmount");
end;
function ENT:SpawnFunction(client, trace)
if (!trace.Hit) then
return;
end;
if ( (client.nextJetPack or 0) < CurTime() ) then
if ( IsValid(client.jetpack) ) then
client.jetpack:Remove();
end;
local entity = ents.Create(self.ClassName);
entity:SetPos( client:LocalToWorld( client:OBBCenter() ) );
entity:SetOwner(client);
entity:SetCollisionGroup(COLLISION_GROUP_DEBRIS);
entity:Spawn();
entity:Activate();
entity:SetMaterial ("models/shiny")
client.jetpack = entity;
return entity;
else
client:ChatPrint("You cannot get another jetpack yet!");
end;
end;
function ENT:Initialize()
if (CLIENT) then
local pos = self.Entity:GetPos();
local ang = self.Entity:GetAngles();
local owner = self:GetOwner();
local texttext = ents.CreateClientProp( "models/hunter/blocks/cube025x025x025.mdl" )
texttext:SetModel( "models/hunter/blocks/cube025x025x025.mdl" )
texttext:SetPos(pos)
texttext:SetAngles(Angle(0,0,90))
texttext:SetNotSolid(SOLID_BBOX);
texttext:SetMoveType(MOVETYPE_VPHYSICS);
texttext:PhysicsInit(SOLID_BBOX);
texttext:Health(5)
texttext:DrawShadow( false )
function texttext:RenderOverride()
if CLIENT then
cam.Start3D(EyePos(), EyeAngles())
cam.Start3D2D(pos, Angle(0,0,90), 1)
surface.SetFont("DermaDefault")
surface.SetTextColor(color_black)
surface.SetTextPos(0,0)
surface.DrawText( owner:Nick() )
cam.End3D2D()
cam.End3D()
end
end
texttext:RenderOverride()
texttext.mbox = 1
end
if SERVER then
self:SetModel("models/props_phx/construct/wood/wood_boardx1.mdl");
self:SetNotSolid(SOLID_BBOX);
self:SetMoveType(MOVETYPE_VPHYSICS);
self:PhysicsInit(SOLID_BBOX);
self:SetUseType(SIMPLE_USE);
self:Health(5)
self:DrawShadow( false )
local physicsObject = self:GetPhysicsObject();
if ( IsValid(physicsObject) ) then
physicsObject:Wake();
physicsObject:EnableMotion(true);
end;
end;
self.CrateHealth = 5
self.mbox = 1
end;
function ENT:OnTakeDamage(Damage)
self.CrateHealth = self.CrateHealth - Damage:GetDamage()
if self.CrateHealth <= 0 then
self:RemoveIt()
end
end
function ENT:RemoveIt()
local pos = self.Entity:GetPos()
local Choose = math.random(1, 1)
local owner = self:GetOwner();
local all = player.GetAll()
self:Remove()
local Random = ents.Create("prop_physics")
Random:SetModel("models/props_junk/wood_crate002a.mdl")
Random:SetPos(pos);
Random:Spawn()
Random:Fire("break","",0)
owner:Kill()
Random:EmitSound( "beyonceout.wav", 0, 95)
if (SERVER) then
timer.Simple( 0.0, function() game.SetTimeScale( 0.06 ) end )
timer.Simple( 0.1, function() game.SetTimeScale( 1 ) end )
end
end
function ENT:Think()
local owner = self:GetOwner();
if ( !IsValid(owner) ) then
self:Remove();
return;
end;
local bone = owner:LookupBone("ValveBiped.Bip01_Spine2");
if (bone) then
local position, angles = owner:GetBonePosition(bone);
angles:RotateAroundAxis(angles:Forward(), 90);
angles:RotateAroundAxis(angles:Right(), -20);
angles:RotateAroundAxis(angles:Up(), 90);
self:SetPos( position + (angles:Up() * 8) + (angles:Forward() * 0) + (angles:Right() * 2) );
self:SetAngles(angles);
local scale = Vector( 2,0.5,0.5 )
local mat = Matrix()
mat:Scale( scale )
if CLIENT then
self:EnableMatrix( "RenderMultiply", mat )
end
end;
end;[/CODE]
sorry.. not good at english!
Sorry, you need to Log In to post a reply to this thread.