Are you able to check if the player has a model downloaded via lua?

Hey! As the title says I am wondering if you’re able to check via lua if the player has a model downloaded?
My idea with this is that you could check if the person has a particular game installed when they join.

Thanks :slight_smile:

Or is there an easier way to do this?

Take a look at this:

[editline]7th March 2014[/editline]

You will need to check if the game you are looking for also returns “mounted”

Thanks! :slight_smile:

How do I put as solved?

You can also check if they have a specific file with file.Exists.
Something like [lua]if file.Exists(“models/mymodel.mdl”, “GAME”) then[/lua]

This is slightly useful if maybe you wanted to allow people to use downloaded models that aren’t actually mounted. (For some reason a lot of people just don’t buy CSS, this is especially true with second accounts and stuff like that.)

To close the thread, click Mark as Solved in the blue bar right above your post.


Potential alternatives, might be worth a look.

Those only work if you’ve precached/loaded the model. It doesn’t even work right then, you have to physically spawn the model.

[lua]local MOSSMAN = “models/mossman.mdl”
print(file.Exists(MOSSMAN, “GAME”), util.IsValidModel(MOSSMAN), util.IsModelLoaded(MOSSMAN))
print(util.IsValidModel(MOSSMAN), util.IsModelLoaded(MOSSMAN))
RunConsoleCommand(“gm_spawn”, MOSSMAN)
print(util.IsValidModel(MOSSMAN), util.IsModelLoaded(MOSSMAN))[/lua]


true	false	false
false	false
true	true