How would I make a simple SENT that makes kills you and displays a message in the center of the screen of the person who died in red bold text whenever you touch it?
[highlight](User was banned for this post ("Wrong section" - mahalis))[/highlight]
This is the simplest I could come up with. The text is not red though as it uses a premade function.
[lua]function ENT:Initialize()
self.Entity:SetModel("models/props_junk/watermelon01.mdl")
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
local phys = self.Entity:GetPhysicsObject()
if phys:IsValid() then
phys:Sleep()
end
end
function ENT:Touch(ent)
if not ( ValidEntity(ent) and ent:IsPlayer() ) then return end
ent:Kill()
ent:PrintMessage(HUD_PRINTCENTER, "I'm on your screen, printing you a message.")
end[/lua]
Also is there a way to get it to play a sound too?
[QUOTE=Banshee FrieNd;24548037]Also is there a way to get it to play a sound too?[/QUOTE]You should really do atleast 15 seconds of research on the wiki before creating a new thread. Anyway..[CODE]self:EmitSound("soundpath/soundname.wav")[/CODE]
Sorry, you need to Log In to post a reply to this thread.