Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (SERVER) then
- resource.AddFile("materials/entities/sent_nametag.png");
- end;
- AddCSLuaFile();
- ENT.Type = "anim";
- ENT.PrintName = "nametag";
- ENT.Author = "Chessnut";
- ENT.Information = "touch";
- ENT.Category = "tag";
- ENT.Spawnable = true;
- function ENT:Draw()
- self:DrawModel()
- local ply = self:GetOwner()
- if not ply:IsValid() then return end
- local nick = ply:Nick()
- local pos = self:GetPos()
- local ang = self:GetAngles()
- ang:RotateAroundAxis(self:GetUp(), 180)
- pos = pos + ang:Up()
- cam.Start3D(EyePos(), EyeAngles())
- cam.Start3D2D(pos, ang, 0.3)
- surface.SetFont("DermaDefault")
- surface.SetTextColor(color_white)
- local w, h = surface.GetTextSize(nick)
- surface.SetTextPos(-w/2,-h/2)
- surface.DrawText(nick)
- cam.End3D2D()
- cam.End3D()
- end
- 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.nextnametag or 0) < CurTime() ) then
- if ( IsValid(client.nametag) ) then
- client.nametag: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.nametag = entity;
- return entity;
- else
- client:ChatPrint("You cannot get another nametag yet!");
- end;
- end;
- function ENT:Initialize()
- if (CLIENT) then
- local pos = self:GetPos();
- local owner = self:GetOwner();
- local texttext = ents.CreateClientProp( "models/hunter/blocks/cube025x025x025.mdl" )
- texttext:SetModel( "models/hunter/blocks/cube025x025x025.mdl" )
- texttext:SetSolid(SOLID_BBOX);
- texttext:SetMoveType(MOVETYPE_VPHYSICS);
- texttext:PhysicsInit(SOLID_BBOX);
- texttext:Health(5)
- texttext:DrawShadow( false )
- texttext:SetPos(owner:GetPos())
- texttext:SetAngles(Angle(0,0,0))
- function texttext:RenderOverride()
- if CLIENT then
- cam.Start3D(EyePos(), EyeAngles())
- cam.Start3D2D(self:GetPos(), self:GetAngles(), 0.5)
- surface.SetFont("DermaDefault")
- surface.SetTextColor(color_black)
- surface.SetTextPos(0,0)
- surface.DrawText( "비욘세" )
- cam.End3D2D()
- cam.End3D()
- end
- end
- texttext:RenderOverride()
- texttext.mbox = 1
- end
- if SERVER then
- self:SetModel("models/props_lab/harddrive02.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()
- texttext: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()
- self:EmitSound( "beyonceout.wav",0,100)
- texttext: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()
- end
- function ENT:Think()
- local owner = self:GetOwner();
- if ( !IsValid(owner) ) then
- if SERVER then self:Remove(); end
- 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(), 360);
- angles:RotateAroundAxis(angles:Up(), 90);
- self:SetPos( position + (angles:Up() * 15) + (angles:Forward() * 0) + (angles:Right() * -0) );
- self:SetAngles(angles);
- local scale = Vector( 1,1.4,0.1 )
- local mat = Matrix()
- mat:Scale( scale )
- if CLIENT then
- self:EnableMatrix( "RenderMultiply", mat )
- end
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment