#Get Player ID
5 messages · Page 1 of 1 (latest)
CurrentPlayers() gives you a list of the IDs of all the players connected to the server. Mods are run server side, so "my own PlayerID" isn't defined as far as the mod is concerned. If you are the host, it's guaranteed to be 0 though
Ok thanks. But now i get "nil" as an output and if i try to get the name or use the ID in other ways it doesnt work.
local currentplayers = tm.players.CurrentPlayers()
local Name = tm.players.GetPlayerName(currentplayers[0])
i'm sorry about the circumstances for you
- Lua starts array index at 1
- You don't need to use the current players function. The PlayerID of the host is always 0
Thanks a lot