[HELP] I new to using tables. How do I have it so if playermodel = any value in table?

Like I said in the title.

If I have a table like this.
[LUA]
Playermodels ={
“models/humans/Group01/Female_01.mdl”,
“models/humans/Group01/Female_02.mdl”,
“models/humans/Group01/Female_03.mdl”,
“models/humans/Group01/Female_04.mdl”,
“models/humans/Group01/Female_06.mdl”,
“models/humans/Group01/Female_07.mdl”,
“models/humans/Group02/Female_01.mdl”,
“models/humans/Group02/Female_03.mdl”,
“models/humans/Group02/Female_06.mdl”
}
[/LUA]

So how would I have it so like
[LUA]
if ply:GetModel = Playermodels{}?
[/LUA]

  • you’re not calling GetModel
  • you’re using the assignment operator rather than the equality operator
  • you’re using the wrong braces
  • random question mark
  • you need to loop through the table

I’m not saying thats what I’m doing I’m asking how would I do it ^ that was just a random thing I put in case some people don’t understand what I’m talking about and I’m pretty sure those are the right braces

[editline]25th November 2016[/editline]

oh I know what you mean with braces I think are you talking about these?

Why would he need to loop through the table?

[lua]
ply:SetModel( table.Random( Playermodels ) );
[/lua]

I’m not trying to set model to a random model in that table

I’m trying to recieve if the players playermodel is one of the models inside of the table.

Ah yeah sorry, thought you wanted the playermodel to be one of those.

[lua]
table.HasValue( Playermodels, ply:GetModel() );
[/lua]

Didn’t know about this function, thanks.

thx alot I saw table.HasValue but didn’t know it could be used this way I’ll try it out