Amount of players

I tryed something like that

[lua]
local Players = player.GetAll()
if(Players > 0)

end
[/lua]

And it’s not working i have no idea what getall output

But still is there a way to do it :S?

And one more question
I canceled the noclip only to admins
But people getting in to a vehicle and getting out fast and it’s let them noclip

How i fixing it?

Try


if #player.GetAll() > 0 then end

It worked can you explain me what # do?

Well # is the pound sign (aka number sign). Not exactly sure…

It isn’t the pound sign? If you use say, #anyrandomtablehere the result will be the amount of keys in a table, a bit like **[Table.Count

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Table.Count)**

Number sign is a name for the symbol #, which is used for a variety of purposes.”

“In the United States, the symbol is usually called the **pound sign.”

**http://en.wikipedia.org/wiki/Number_sign

Edit: really guys if you dont 100% what thats means how you using it o.O

Ok the player.GetAll table is like so
[1] = FirstPlayer
[2] = SecondPlayer

#player.GetAll() returns 2, not because SecondPlayer’s index is two but because there are two values in the table, so

[lua]
local bob = {“Hello”, “There”, “Jill”}
print(#bob)
[/lua]
Will print the number 3 because the table bob has 3 keys / values whatever you want to say it counts

I believe it is called the “Length Operator”

[Lua]
for k, v in pairs(player.GetAll()) do
if(k > 0) then
—code stuff
end
end
[/Lua]
That should work but its not tested
And with the noclip thing check a few topics below