Jump to content
Planty

[Bug Report] » [TTT] rslays gives role before slaying

Recommended Posts

Posted (edited)

Rslays used to slay the person without giving them the role, but i've noticed that when i have slays on me but it was supposed to be my T round i get assigned traitor. I don't recall getting the innocent role but I have gotten slayed and got assigned T.


View full bug

Edited by Planty
In my defense, Rslays has been the slay plugin for a while now so i my brain just automatically typed it

Share this post


Link to post
Share on other sites
Posted (edited)

/slaynr is a new command, implemented ~1w ago

fixes this issue 

 

edit: ya nvm, 2 traitors just got assigned a role on the round they were supposed to be slayed. Also me and other admins been getting slayed on first round for no reason, its vv annoying

Edited by george

Share this post


Link to post
Share on other sites
4 hours ago, Diam0ndz said:

Will now force players who are being slayed to have the innocent role. 

That doesn't necessarily fix it. Then, say, if 16 people are on and 2/3 are slain, there will be 13/14 players actively playing but 4 Traitors and 2 Detectives will be selected. So there's less innos but still the same large amount of Ts

Share this post


Link to post
Share on other sites
Posted (edited)
34 minutes ago, sleepy said:

That doesn't necessarily fix it. Then, say, if 16 people are on and 2/3 are slain, there will be 13/14 players actively playing but 4 Traitors and 2 Detectives will be selected. So there's less innos but still the same large amount of Ts

It should. It slays them in TTT_OnRoundStartPre() which is called before TeamInitialize() which should take into account the number of dead players and TTT_SetRole()

Edited by Diam0ndz

Share this post


Link to post
Share on other sites
17 minutes ago, Diam0ndz said:

It should. It slays them in TTT_OnRoundStartPre() which is called before TeamInitialize() which should take into account the number of dead players and TTT_SetRole()

Then why would the parent issue exist in the first place? It should've slain them before TeamInitialize(), but it still, according to this ticket, granted roles. I might be misunderstanding this to begin with.

Share this post


Link to post
Share on other sites
57 minutes ago, sleepy said:

Then why would the parent issue exist in the first place? It should've slain them before TeamInitialize(), but it still, according to this ticket, granted roles. I might be misunderstanding this to begin with.

I might be the one goofing but what it does is add all clients to an array, and if they are slain within OnRoundStartPre(), it removes them from that array and in TeamInitialize() it takes all players in that array and gives them a role if they don't already have one, which is why I assign the inno role now since apparently its not removing the slain client from array or something.

Share this post


Link to post
Share on other sites
8 hours ago, Diam0ndz said:

I might be the one goofing but what it does is add all clients to an array, and if they are slain within OnRoundStartPre(), it removes them from that array and in TeamInitialize() it takes all players in that array and gives them a role if they don't already have one, which is why I assign the inno role now since apparently its not removing the slain client from array or something.

Right, so 

 

10 hours ago, sleepy said:

That doesn't necessarily fix it. Then, say, if 16 people are on and 2/3 are slain, there will be 13/14 players actively playing but 4 Traitors and 2 Detectives will be selected. So there's less innos but still the same large amount of Ts

^ this issue still stands then. 

Slaynr needs to remove them from that array or it will continue to be an issue.

Bara did this by decreasing iPlayers by 1 for every user slain (line 931 of ttt.sp). In Bara’s case, he did this in a TimerSelection() check immediately after OnRoundStartPre(), but you would have to do it in OnRoundStartPre() since you’re not messing with ttt.sp.

Or instead of using your own slay function, you could just use rslays to add the slays but through !slaynr so it adds to your database still. 

Share this post


Link to post
Share on other sites
Posted (edited)
7 hours ago, sleepy said:

Right, so 

 

^ this issue still stands then. 

Slaynr needs to remove them from that array or it will continue to be an issue.

Bara did this by decreasing iPlayers by 1 for every user slain (line 931 of ttt.sp). In Bara’s case, he did this in a TimerSelection() check immediately after OnRoundStartPre(), but you would have to do it in OnRoundStartPre() since you’re not messing with ttt.sp.

Or instead of using your own slay function, you could just use rslays to add the slays but through !slaynr so it adds to your database still. 

Alright, so, iPlayers is just used to check how many players are in the game to see if the game should start. 

if (iPlayers < g_crequiredPlayers.IntValue)
    {
        g_bInactive = true;

        LoopValidClients(i)
        {
            CPrintToChat(i, "%s %T", g_sTag, "MIN PLAYERS REQUIRED FOR PLAY", i, g_crequiredPlayers.IntValue);
            
            if (g_cPlayerHUDMessage.BoolValue)
            {
                SetHudTextParams(0.4, 0.53, 5.1, 205, 173, 0, 255, 0, 0.0, 0.0, 0.0);
                ShowSyncHudText(i, g_hWeAreSync, "%T", "WE ARE", i, iPlayers);
                SetHudTextParams(0.33, 0.565, 5.1, 205, 173, 0, 255, 0, 0.0, 0.0, 0.0);
                ShowSyncHudText(i, g_hRemainingSync, "%T", "REMAINING PLAYERS", i, (g_crequiredPlayers.IntValue - iPlayers));
            }
        }

        g_bCheckPlayers = true;

        Call_StartForward(g_hOnRoundStartFailed);
        Call_PushCell(iPlayers);
        Call_PushCell(g_crequiredPlayers.IntValue);
        Call_Finish();

        GiveWeaponsOnFailStart();

        g_iStatus = Round_Inactive;

        return;
    }

It isn't used at all for the Traitor, Detective, or Innocents ratio. The array that is used is aPlayers. 

public Action Timer_Selection(Handle hTimer)
{

.....

for (int i = 0; i < aPlayers.Length; i++)
{
	if(!IsPlayerAlive(aPlayers.Get(i)))
    {
		aPlayers.Erase(i);
    }
}
                                        
.....
                                        
int iTCount = GetTCount(aPlayers);
int iDCount = GetDCount(aPlayers);
                                    
.....

}

.....
                                    
int GetTCount(ArrayList array)
{
    int iActivePlayers = 0;
    bool bChecked[MAXPLAYERS + 1] = { false, ... };

    for (int i = 0; i < array.Length; i++)
    {
        int client = array.Get(i);

        if (!bChecked[client])
        {
            bChecked[client] = true;
            iActivePlayers++;
        }
    }

    int iTCount = RoundToFloor(float(iActivePlayers) * (float(g_ctraitorRatio.IntValue) / 100.0));

    if (iTCount < 1)
    {
        iTCount = 1;
    }

    if (iTCount > g_cmaxTraitors.IntValue)
    {
        iTCount = g_cmaxTraitors.IntValue;
    }

    return iTCount;
}

int GetDCount(ArrayList array)
{
    int iActivePlayers = 0;
    bool bChecked[MAXPLAYERS + 1] = { false, ... };

    for (int i = 0; i < array.Length; i++)
    {
        int client = array.Get(i);

        if (!bChecked[client])
        {
            bChecked[client] = true;
            iActivePlayers++;
        }
    }

    if (iActivePlayers < g_crequiredPlayersD.IntValue)
    {
        return 0;
    }

    int iDCount = RoundToFloor(float(iActivePlayers) * (float(g_cdetectiveRatio.IntValue) / 100.0));

    if (iDCount > g_cmaxDetectives.IntValue)
    {
        iDCount = g_cmaxDetectives.IntValue;
    }

    return iDCount;
}

That's all called after the OnRoundStartPre forward, meaning that the above code should get called a little bit after the slay. It checks if the client is dead and if they are, to remove them from the array that gets sent to the GetTCount and GetDCount functions which does exactly what they sound like. Based on those counts, it gets a random client from the aPlayers array and since the slayed clients are not in there, it shouldn't get any of those clients.

So no, the issue shouldn't still stand.

Edited by Diam0ndz

Share this post


Link to post
Share on other sites

The issue persists, but it also persists with sm_rslays, meaning Bara never accounted for it in the first place.

@Bottomfraf provided a 900 iq solution which is to force players into spec during OnRoundStartPre() because the plugin doesn't count spectators in the array aPlayers, which means it will select roles in accordance with that.

@ Diam0ndz is testing Bottom's solution tonight.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...