I’m starting to make a custom administration mod for my server, because apparently all of them are broken and dysfunctional. (Exsto, Evolve, and ULX not loading commands in)
This is the code I decided to start with, as most of the other commands would revolve around findplayer(name) and updatePlayerList().
plist=player.GetAll() function findplayer(name) updatePlayerList() table.foreach(plist,function(k,v) if v:GetName()==name then return v end end) print("could not find player with given name "..name.." !") end function updatePlayerList() plist=player.GetAll() end function spawn(player,command,args) findplayer(args):Spawn() print("attempted to spawn player ".. args) end concommand.Add("_spawn",spawn)
However, when I try to execute both
My code returns that it could not find the player specified.
The username matches exactly what it should have been, is there something wrong with my findplayer()?
I was using table.foreach(), which doesn’t appear to work.
using the for k,v in pairs(plist) worked perfectly.