I'm a lua noob, but would appreciate any help. I'm trying to modify some code I found. I want it to be used as a shrubbot command that would return in console to the requestor the number of empty slots on the server (excluding private slots). This is the code I'm using and I'm sure there's a lot wrong with it as it doesn't do anything at all.
function et_ClientCommand(clientNum, command) if et.trap_Argv (0) == "lua" then if et.trap_Argv( 1 ) == "free" then local playercount = 0 local slots = 0 maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) for i = 6, (maxclients - 1) do if et.gentity_get(i, "sess.sessionTeam") ~= 0 then playercount = playercount + 1 end -- -7 = 6 for priv slots and 1 because of slots are numbered from 0-33 slots = maxclients - playercount - 7 et.trap_SendServerCommand(clientnum, 'print "^qFree Slots " slots' ) end end end
The shrubbot command is:
[command] command = free exec = lua free  desc = displays number of free slots (not including private slots) levels = 0 1 2 3 4 5
Would anyone please point out the multitude of things I probably did wrong?