It is difficult to help as I do not know all the specifics of what you want to do. However, it does appear that you are currently using et_clientbegin and et_clientdisconnect to control when actions are taken, and I would suggest this is not the appropriate time to do things. Using et_clientcommand may be a better option.
I can offer some excerpts from a couple of my scripts that hopefully will be of some help.
This is how I counted players on the server, with an option to include specs or not.
Code: Select all
-- Shall spectators be counted in the playercount? (1/0 = yes/no)
includespecs = 1
-- COUNT THE NUMBER OF PLAYERS ON THE SERVER
if includespecs == 1 then
for i = 0, (maxclients - 1) do
if et.gentity_get(i, "sess.sessionTeam") ~= 0 then
--et.trap_SendConsoleCommand(et.EXEC_APPEND, "qsay \"^3sessionteam " .. i .. " " .. et.gentity_get(i, "sess.sessionTeam") .. "\"\n")
playercount = playercount + 1
end
end
elseif includespecs == 0 then
for i = 0, (maxclients - 1) do
if (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 1) or (tonumber(et.gentity_get(i, "sess.sessionTeam")) == 2) then
playercount = playercount + 1
end
end
end
It may be appropriate to enforce your restriction using et_clientcommand, like in this example:
Code: Select all
-- called on client command
function et_ClientCommand(cno, cmd)
if string.lower(cmd) == "team" then
if -- insert condition to be met for whether or not to join axis/allies or whatever
et.trap_SendServerCommand(cno, "cp \"^3Sorry, you cannot join that team.\n\" " )
return 1 -- prevents the teamjoin
end
end
return 0 -- allows the cmd
end
I would also suggest avoiding the use of et_print if at all possible. At best, it is a pain in the ass: at worst, unforseen events break everything.