Zelly Posted March 6, 2014 Share Posted March 6, 2014 Would there be anyway to create a callback that signals everytime a player switches team. ClientSwitchTeam(clientNum,toteam) (or maybe add (clientNum,fromTeam,toTeam) ) function et_ClientSwitchTeam( clientNum , toTeam) local currentTeam = et.gentity_get(clientNum,"sess.sessionTeam") et.G_LogPrint("Stopping " .. clientNum .. " from switching from " .. currentTeam .. " " .. toTeam .."\n") return 1 end function et_ClientSwitchTeam( clientNum ,fromTeam, toTeam) et.G_LogPrint("Stopping " .. clientNum .. " from switching from " .. fromTeam .. " " .. toTeam .."\n") return 1 end I can't decide which switchteams it should catch though. There is /team and the limbo menu and then there is things like inactivity, ref putallies, !putteam, and !shuffle also I think there is an automove in the killrating playerbalance thing.I would like them all but it seems like there could be problems that could cause.It would be nice if I could possibly return 1 like I do in ClientCommand to stop them from joining. I had originally thought that I could basically create my own with client command (And Possibly a runframe for inactivity) but it doesn't seem like the limbo menu passes any kind of command that lua catches(Or am I wrong?)Anyways thoughts on the idea? Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted March 6, 2014 Management Share Posted March 6, 2014 I don't know if et_clientUserinfoChanged could work as a trigger to check if the team has changed. I don't see a reason why we couldn't add it, but I'm saying that before investigating the issue at all. The callback would be probably called for all team changes though. However, as the single point for them all could be after forced team change information is printed to the game, there could be prints that seem wrong if the team change was cancelled. We will look into this. http://mygamingtalk.com/wiki/index.php/Silent_Lua#et_ClientUserinfoChanged Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted March 7, 2014 Management Share Posted March 7, 2014 function et_TeamCange( clientNum, fromTeam, toTeam ) et.trap_SendServerCommand( -1, "chat \"Team change, client "..clientNum.." from team "..fromTeam.." to team "..toTeam.."\"") -- return 0 -- allow change -- return 1 -- disallow change -- no return value at all or any other value then 1 equals returning 0 end This kind of hook is possible. It catches all team changes, but the called hook does not know why it is happening. It can quietly intercept and stop the team change. In case of inactivity, it could cause bad repetiting attempt to move the player to spectators. The inactivity timers can be seen using gentity_get though. Thoughts about this? This is the time to change the behaviour if needed, before any existing Lua depends on it. Quote Link to comment Share on other sites More sharing options...
Sol Posted March 7, 2014 Share Posted March 7, 2014 (edited) I had originally thought that I could basically create my own with client command (And Possibly a runframe for inactivity) but it doesn't seem like the limbo menu passes any kind of command that lua catches(Or am I wrong?)Yeah, any team, limbo changes are shown in et_clientUserinfoChanged always for sure.You don't have to check them directly from userinfo, you can use instead et.gentity_get function, works faster imo. edit:If you want to stop client from team switching then catch commands from et_ClientCommand callback, check team etc. and then just return value to stop from post-executing or not. Edited March 7, 2014 by solaЯ Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted March 7, 2014 Management Share Posted March 7, 2014 Yes. I don't know if you want the intercept option only for client actions. If that is the case, then this callback might not be the best option. Quote Link to comment Share on other sites More sharing options...
Zelly Posted March 7, 2014 Author Share Posted March 7, 2014 Hmm, ok thank you guys. I will see if I can accomplish what I need using the et_clientUserInfoChanged method. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.