I want to make 2 models spawn through admin, a start and an end. Once a player walks through or USE's both models in order, it triggers an event.
Here is how I think it would be used, using the ENT.Touch example from the wiki.
[lua]
function ENT:Touch( hitEnt )
if ( hitEnt:IsValid() and hitEnt:IsPlayer() ) then
hitEnt:Msg(mapmsg.start) -- this is the event
end
end
[/lua]
I don't know how to specify a certain model, it isn't documented or I couldn't find it. How would I go about specifying specific models to touch?
I found
ents.FindByModel
util.IsValidModel(model)
But I don't know what I would do with it. Can someone give me an example of how I would incorporate it?
[lua]
local whatever = ents.FindByModel("models/whatever.mdl")
function ENT:Touch( hitEnt )
if ( hitEnt:IsValid() and hitEnt:IsPlayer() and ) then
hitEnt:Msg(mapmsg.start) -- this is the event
end
end
[/lua]
Maybe this?
[lua]
function ENT:Touch( hitEnt )
if ( hitEnt:IsValid() and hitEnt:IsPlayer() ) then
if ( hitEnt:GetModel() == "the_model_that_you_want.mdl")
hitEnt:Msg(mapmsg.start);
end
end
end
[/lua]
I actually didn't know that you could embed an if statement inside an if statement. I feel dumb.
Thanks :buddy:
Sorry, you need to Log In to post a reply to this thread.