AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   All players name problem (https://forums.alliedmods.net/showthread.php?t=77062)

anakin_cstrike 09-04-2008 12:42

All players name problem
 
PHP Code:

new 
    
tplayers[32],ctplayers[32],tname[32],ctname[32],
    
tnum,ctnum,tindex,ctindex,i,j;
    new 
tNames[1024],ctNames[1024];
    
get_players(tplayers,tnum,"he","TERRORIST");
    
get_players(ctplayers,ctnum,"he","CT");
    for(
0;tnum;i++)
    {
        
tindex tplayers[i];
        if(!
is_user_connected(tindex))
            continue;
        
get_user_name(tindex,tname,31);    
        if(
strlen(tNames) > 0)
            
format(tNames1023"%s,%s"tNamestname);
        else
            
copy(tNames1023tname);    
    }
    for(
0;ctnum;j++)
    {
        
ctindex ctplayers[j];
        if(!
is_user_connected(tindex))
            continue;
        
get_user_name(ctindex,ctname,31);
        if(
strlen(ctNames) > 0)
            
format(ctNames1023"%s,%s"ctNamesctname);
        else
            
copy(ctNames1023ctname);    
    }
    
console_print(id,"%s ; %s",tNames,ctNames); 

It shows:
Code:

;

v3x 09-04-2008 16:30

Re: All players name problem
 
What are you trying to do? I'm confused.

[X]-RayCat 09-04-2008 16:47

Re: All players name problem
 
Quote:

Originally Posted by v3x (Post 681234)
What are you trying to do? I'm confused.

I think his trying to list ts/ct player names -->
Code:

Ct players:
name1,
name2,
name3
...


Exolent[jNr] 09-04-2008 16:48

Re: All players name problem
 
Trying to get all player names and printing to admin's console.

Code:
enum {     TEAM_NONE,     TEAM_T,     TEAM_CT,     TEAM_SPEC,         MAX_TEAMS }; #define OFFSET_TEAM 114 #define fm_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM) new g_max_clients; public plugin_init() {     // ...     g_max_clients = get_maxplayers(); } // ... new name[32], team, all_names[MAX_TEAMS][sizeof(name) * 32]; // 32 player names for( new i = 1; i <= g_max_clients; i++ ) {     if( !is_user_connected(i) )     {         continue;     }         team = fm_get_user_team(i);     if( team != TEAM_T && team != TEAM_CT )     {         continue;     }         get_user_name(i, name, sizeof(name) - 1);     if( all_names[team][0] )     {         format(all_names[team], sizeof(all_names[]) - 1, "%s, %s", all_names[team], name);     }     else     {         copy(all_names[team], sizeof(all_names[]) - 1, name);     } } console_print(client, "%s ; %s", all_names[TEAM_T], all_names[TEAM_CT]);

anakin_cstrike 09-06-2008 08:55

Re: All players name problem
 
Well:
[IMG]http://img169.**************/img169/8122/ssus0.th.jpg[/IMG]
Can you fix it please?

anakin_cstrike 09-06-2008 13:24

Re: All players name problem
 
Lol...hleV..you've said that twice...however...forget my videocard...and yes, it doesn't suport opengl...happy ? :P
Now,:lol:, can anybody help me please ?

Exolent[jNr] 09-06-2008 13:53

Re: All players name problem
 
Show me your full code.

anakin_cstrike 09-06-2008 13:54

Re: All players name problem
 
If i'm blind, sorry.
PHP Code:

enum
{
    
TEAM_NONE,
    
TEAM_T,
    
TEAM_CT,
    
TEAM_SPEC,
    
MAX_TEAMS
};
new 
g_max_clients;
// ...
register_concmd("amx_teams","teams_cmd");
g_max_clients get_maxplayers();
// etc..

public teams_cmd(id)
{
    new 
name[32], teamall_names[MAX_TEAMS][sizeof(name) * 32];
    for(new 
1;<= g_max_clients;i++)
    {
        if(!
is_user_connected(i))
            continue;
    
        
team fm_get_user_team(i);
        if(
team != TEAM_T && team != TEAM_CT)
            continue;
    
        
get_user_name(i,name,sizeof(name) - 1);
        if(
all_names[team][0])
            
format(all_names[team], sizeof(all_names[]) - 1"%s, %s"all_namesname);
        else
            
copy(all_names[team], sizeof(all_names[]) - 1name);
    }

    
console_print(id"TS: %s ; CT: %s"all_names[TEAM_T], all_names[TEAM_CT]);
    
client_print(id,print_chat,"TS: %s ; CT: %s"all_names[TEAM_T], all_names[TEAM_CT]);
    return 
PLUGIN_HANDLED;



Exolent[jNr] 09-06-2008 13:59

Re: All players name problem
 
The problem was with my code. Look at my post and you will see what I did wrong.
But, you won't see it with my code, cause I already fixed it.

anakin_cstrike 09-06-2008 14:24

Re: All players name problem
 
Oh....so that was the only problem ?


All times are GMT -4. The time now is 03:15.

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