Raised This Month: $12 Target: $400
 3% 

Panel Listing Players 1-8, Only Displays Last Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
QOOOOOOOOQ
Senior Member
Join Date: Dec 2012
Old 09-23-2014 , 01:12   Panel Listing Players 1-8, Only Displays Last Player
Reply With Quote #1

I've made a recursive function that stores all the players into an array by userid, then lists them on a panel in order depending on their team. This way, all players in the game are shown on a panel listed from longest play time to least, top to bottom. The situation I'm having is that it only shows the LAST player in the respective team on the panel (for 3 teams, only shows 3 players on the panel, I don't know why).

Spoiler

Sorry about readability, just want it to work first.

Last edited by QOOOOOOOOQ; 09-23-2014 at 03:53.
QOOOOOOOOQ is offline
QOOOOOOOOQ
Senior Member
Join Date: Dec 2012
Old 09-27-2014 , 04:14   Re: Panel Listing Players 1-8, Only Displays Last Player
Reply With Quote #2

This is what I've got now, still does the exact same thing, it makes 0 sense. I'm telling it to add a bunch of newlines followed by names on 1 string, it only partially displays the string on the menu, it's not even logical.
Spoiler

Only thing different is the for loop, changed slightly. Literally. Makes no sense.

Edit: Sorry, I put an additional StrCat after the teamname StrCat, and somehow it now works... (I know it was wrong before, but it should've only omitted the first player's name, not the first three...)

Last edited by QOOOOOOOOQ; 09-27-2014 at 04:22.
QOOOOOOOOQ is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 09-28-2014 , 10:29   Re: Panel Listing Players 1-8, Only Displays Last Player
Reply With Quote #3

If your aim is only to group the players (i.e. ordering by time is just a happy bonus) then you could use something like this. Or at least take parts form it, to integrate into your own to incorporate the player duration too:

PHP Code:
//In globals
#include <sourcemod>
#include <sdktools_functions>

new iTeamOrder[3] = { 23};
new 
String:szTeamNames[3][4] = { "SUR""INV""SPC" }, String:szPanelItem[MAX_NAME_LENGTH 3];

//In function
new Handle:hOrderedPlayerPanel CreatePanel();
for (new 
iTeamIndex 0iTeamIndex sizeof(iTeamOrder); iTeamIndex++)
{
    if (
GetTeamClientCount(iTeamOrder[iTeamIndex]) < 1) continue;
    
    
DrawPanelText(hOrderedPlayerPanelszTeamNames[iTeamIndex]);
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == iTeamOrder[iTeamIndex])
        {
            
FormatEx(szPanelItemsizeof(szPanelItem), " - %N"i);
            
DrawPanelText(hOrderedPlayerPanelszPanelItem);
        }
    }
}
SendPanelToClient(hOrderedPlayerPanelvClientPanel_OrderedPlayerPanel60); 
__________________

Last edited by 11530; 09-28-2014 at 10:37.
11530 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode