NotJustin / SkillAutoBalance

12 stars 3 forks source link

Spawn bug #7

Closed NotJustin closed 4 years ago

NotJustin commented 4 years ago

Sometimes, a player will spawn in the wrong location.

It may be related to: forcing players to join a team when they connect blocking players from switching team

I have no idea why it happens or how to fix it.

bubobih commented 4 years ago

It can be solved. add me to discord MAMAC #9993

bubobih commented 4 years ago

also sab_forcejointeam doesent work, he keep u in camera view and u cant join on any team

WhyFaust commented 4 years ago

also sab_forcejointeam doesent work, he keep u in camera view and u cant join on any team

Not true, I have it working, maybe you have some conflict with other plugins.

NotJustin commented 4 years ago

It can be solved. add me to discord MAMAC #9993

Please try to explain here if you have a suggestion on how to solve it. It is better to discuss publicly.

also sab_forcejointeam doesent work, he keep u in camera view and u cant join on any team

Do not post here about other issues. Make a new issue (you can click here to make a new issue).

NotJustin commented 4 years ago

https://forums.alliedmods.net/showpost.php?p=2691336&postcount=1

The code I posted in that thread is short, ~153 lines, and causes this same bug. I wish I knew of a good way to debug this.

I suspect that it is related to the jointeam command listener. I would like to try completely disabling the jointeam command listener, but then it allows people to switch team through the jointeam console command. Still, I would like to try it, so that I can rule it out. So, I will do so on my server for awhile.

bubobih commented 4 years ago

Maybe this thing can help u

pragma semicolon 1

pragma newdecls required

include

include

};

public void OnClientPutInServer(int iClient) { if (iClient && !IsFakeClient(iClient) && !IsClientSourceTV(iClient) && !GameRules_GetProp("m_bWarmupPeriod")) { int iTeamDiff = GetTeamClientCount(2) - GetTeamClientCount(3); iTeamDiff = (iTeamDiff > 0 ? 3 : (iTeamDiff < 0 ? 2 : GetRandomInt(2, 3))); PrintToServer("[Auto Join Team] For player %N set team of %s", iClient, iTeamDiff == 2 ? "T" : "CT"); ClientCommand(iClient, "jointeam %i", iTeamDiff); } }

bubobih commented 4 years ago

or this plugin i use it for months no wrong spawn problem

https://forums.alliedmods.net/showthread.php?t=321314

NotJustin commented 4 years ago

Thank you for showing me this! I will implement it and credit SM9, let's see if the problem goes away.

edit: Oh, you are MAMAC that he mentions in his thread! I will credit you as well.

edit2: Earlier I mention that my issue might be related to the jointeam listener. In SM9's plugin, they do not block players from changing team, but they do force players on team when they connect. So, my problem may still occur, as I am also stopping players from changing team (as an option).

bubobih commented 4 years ago

Actualy spawn bug is retailed to autojoin, or force join.... as we diagnose it, we had problems that ppl spawning on middle map in wall and sometimes in spawn, so we had 2 bugs, spawn problem was because balance plugin do late balance (im currently using your and he do balance ok). Second bug is when a player join and get force pickup team just a milisecond before round start, he somehow get spawned in middle of map or in some wall or on enemy spawn. sm9 plugin solve that, true we lost several days to detect a problem, but i dont have anymore problems on server.

The thing that was ok (in some parts) was to use valve cvars not plugin to make force join and pickup team. So orginaly i try this

mp_force_assign_teams 1 mp_force_pick_time 0

this was great in some tests, till some ppl start to get kicked instead to pickup team, force pickup time is buggy (probably valve bug) and he sometimes kick player just u get kicked if u doesent choose team at all, and he shoud pickup team not kick it. Maybe to set 1 second i didnt try it...

NotJustin commented 4 years ago

I tried mp_force_assign_teams 1 awhile ago and it would only put some players on team, the rest would be stuck in spectate.

I also had mp_force_pick_time 0 and I think it did work?

I will push what I am testing now, if you want to try it too.

bubobih commented 4 years ago

with that plugin from sm9 i still use mp_force_assign_teams 1 and i dont have problems

teoretical if u push mp_force_pick_time 0 (player shoud force pickup some team in menu in 0 seconds) default is 15 and that is a time that u get count in pickup team menu, so if u push it to 0 players shoud pickup team in 0 seconds when menu appear, and force assing shoud make that possible, so that 2 cvars shoud do a trick, but as i say, its ok then later on map ppl get kicked on joining (they get kicked just when u get kicked from team choose menu, if u dont pickup a team and that 15 seconds by default past and u get kicked). So maybe force pick time to 1 second shoud do a trick... i didnt test because we get a working plugin from sm9.

NotJustin commented 4 years ago

In the code you wrote, you have "jointeam number", in SM9's plugin they have "jointeam 0 number" I just used what SM9 had.

Also, https://sm.alliedmods.net/new-api/console/ClientCommand

"Executes a client command. Note that this will not work on clients unless they have cl_restrict_server_commands set to 0."

I am confused by this. I do not see this command cl_restrict_server_commands. Also, when I do: findflags server_can_execute I do not see jointeam listed there. Pushing anyway

edit: Doing a push with the word "fix" closes the issue. Now I know not to do that 🤦

NotJustin commented 4 years ago

Have not received any reports of the bug happening after 4 days. Closing.