splewis / csgo-multi-1v1

CS:GO Sourcemod plugin to create multi-1v1 arena servers
GNU General Public License v3.0
278 stars 68 forks source link

Fix Team Select Problem #270

Closed crashzk closed 3 years ago

crashzk commented 4 years ago

Credits for @Ilusion9: https://github.com/splewis/csgo-multi-1v1/issues/245#issuecomment-641921103

borzaka commented 4 years ago

Nobody-x has almost the same PR: https://github.com/splewis/csgo-multi-1v1/pull/262

He said:

// Since I removed SetEventBroadcast call into player_team event we need this workaround
// I don't know exactly why but it seem to be how the engine works.
DataPack pack;
CreateDataTimer(0.1, Timer_UpdateClientArenaTag, pack);

pack.WriteCell(GetClientSerial(client));
pack.WriteString(buffer);

I don't know it's related, but it seems. Have you tested fully your code?

crashzk commented 4 years ago

Yes, I realized that too. In this case, I only made the changes that passed the issues I commented on.

I will be testing in depth, anything includes these modifications that you also mentioned.

Nobody-x commented 4 years ago

Nobody-x has almost the same PR:

262

He said:

// Since I removed SetEventBroadcast call into player_team event we need this workaround
// I don't know exactly why but it seem to be how the engine works.
DataPack pack;
CreateDataTimer(0.1, Timer_UpdateClientArenaTag, pack);

pack.WriteCell(GetClientSerial(client));
pack.WriteString(buffer);

I don't know it's related, but it seems. Have you tested fully your code?

Unfortunately this has not fixed 100% the problem. I've accomplished more testing but never managed to fix the clan tag issue related to my PR.

But.

In my Event_OnPlayerTeam function I used return Plugin_Changed; instead of return Plugin_Continue;. You still use the second one. Are you sure that event.SetBool("silent", true); fixed the team selection menu ? If yes, then you have the correct fix to this.

Its seems to me that return Plugin_Changed; is the cause of the others errors. If I remember correctly, this is required to fix the team selection menu but I can be wrong.

crashzk commented 4 years ago

To block tag changes you can try this:

public void OnClientPutInServer(int client)
{
    CS_SetClientClanTag(client, "");
}

public Action OnClientCommandKeyValues(int client, KeyValues kv)
{
    char command[PLATFORM_MAX_PATH];
    if (kv.GetSectionName(command, sizeof(command)) && StrEqual(command, "ClanTagChanged", false))
    {
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

Compile and see if it solves the problem.

On the event.SetBool("silent", true); I will thoroughly check if you have fixed the team selection menu problem.

borzaka commented 4 years ago

I'am and many of us are using this plugin: [CS:GO] Multi 1v1 - Country Tag https://forums.alliedmods.net/showthread.php?p=2547876

It would be great, if this needs a fix as well, that you guys open would open a PR. Thx!

crashzk commented 4 years ago

It seems that only the modifications event.SetBool("silent", true); is not enough, the problem still occurs, as can be seen here.

https://forums.alliedmods.net/showpost.php?p=2707116&postcount=1607 https://forums.alliedmods.net/showpost.php?p=2707119&postcount=1608

borzaka commented 4 years ago

I wouldn't trust them only, because you didn't have to wait until the round end, you can press ESC after a team selection.

crashzk commented 4 years ago

I wouldn't trust them only, because you didn't have to wait until the round end, you can press ESC after a team selection.

I understand, I will test it myself ... If the problem continues I see the other changes from @Nobody-x to see if it solves the problem.

crashzk commented 4 years ago

I did the test myself on my server, problem continues.

I connect to the server, choose a team, I still have to wait for the round to end or press ESC to close. I will try to implement the @Nobody-x fix to see how it solves the problem.

crashzk commented 4 years ago

Now, I did the test and everything is working fine, no errors so far.

I believe it can be merged into the main branch of the project.

crashzk commented 4 years ago

Fix is ​​not effective.... When you send the change to the server for the first time it works, however when changing the map the BUG continues.

Ilusion9 commented 4 years ago

Fix is ​​not effective.... When you send the change to the server for the first time it works, however when changing the map the BUG continues.

Try to replace cs_switchteam with changeclientteam in SwitchPlayerTeam function.

crashzk commented 4 years ago

Try to replace cs_switchteam with changeclientteam in SwitchPlayerTeam function.

I tried, nothing yet, bug continues.

borzaka commented 4 years ago

@RavageCS made a possible fix for csgo-retakes: https://github.com/splewis/csgo-retakes/pull/270

Related issue: https://github.com/splewis/csgo-retakes/issues/269

This was working except as soon as someone clicked on join spectator you need to click twice again. I went and changed the rest of the event function calls to use this syntax, and from my testing it looks to be fixed.

crashzk commented 4 years ago

@RavageCS made a possible fix for csgo-retakes: splewis/csgo-retakes#270

Related issue: splewis/csgo-retakes#269

This was working except as soon as someone clicked on join spectator you need to click twice again. I went and changed the rest of the event function calls to use this syntax, and from my testing it looks to be fixed.

Interesting, I'll check it out and test it.

Ilusion9 commented 4 years ago

Maybe putting clients as Spectators when they join doesn't close the menu. I put players automatically to CT on my dr server and the menu is auto closing. You can try to put them on T or CT side, and in the next frame to SPEC. Or you can put them on T or CT and leave them there, would that be a problem?