Is there a way to check to see if an entity has a certain model?
Im trying to identify an entity based off of its model, like identifying a buggy. If the model matches, then it activates something else
[b][url=http://wiki.garrysmod.com/?title=Entity.GetModel]Entity.GetModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[lua]if ent:GetModel() == "modelname" then
-- Code
end[/lua]
To identify a buggy you might want to test the entity with IsVehicle first.
[b][url=http://wiki.garrysmod.com/?title=Entity.IsVehicle]Entity.IsVehicle [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
okay, that seemed to work, but i want to try and make it a bit more simple. What i want is for it to check to see if the model is not something
like
[lua]
if (Ent:GetModel() == "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl") then return end
[/lua]
I want it to check to see if its not "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl"
and then if its not then to return and end
[lua]if Ent:GetModel() ~= "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl" then return end[/lua]
or
[lua]if not Ent:GetModel() == "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl" then return end[/lua]
Sorry, you need to Log In to post a reply to this thread.