AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get all name from a players. (https://forums.alliedmods.net/showthread.php?t=120906)

dFF 03-09-2010 09:46

Get all name from a players.
 
PHP Code:


public plugin_init()
{
    
g_maxplayers get_maxplayers()
    
set_task1.0"test"___"b" )
}

public 
test()
{
    new 
count
    
    
for( new 1<= g_maxplayersi++ ) 
    {
        if( !
is_user_alive] || !cs_get_user_team] != CS_TEAM_T )
            continue
        
        
count++
        new 
name32 ]
        
get_user_nameiname31 )
        
        
set_hudmessage255000.00.1506.012.0 )
        
show_hudmessage0"Ts players:^n%d. %s^n"countname )
    }


What the problem ?

Mxnn 03-09-2010 13:06

Re: Get all name from a players.
 
PHP Code:

if ( !is_user_alive ] || !cs_get_user_team ] != CS_TEAM_T 

Change it to:
PHP Code:

if ( !is_user_alive ) || !cs_get_user_team ) != CS_TEAM_T 

You are obtaining the name of all alive CT players and the hudmessage will show
Code:

Ts players:
[Player ID -1]. [Name of player ID]

If you want to show the ID's and names of TT players change:
[php]
if ( !is_user_alive ( i ) || !cs_get_user_team ( i ) != CS_TEAM_T )
[php]
to:
PHP Code:

if ( !is_user_alive ) || cs_get_user_team ) != CS_TEAM_T 


AntiBots 03-09-2010 13:37

Re: Get all name from a players.
 
untest:

PHP Code:

#include < amxmodx >
#include < cstrike >

#pragma ctrlchar '\'

new g_iMaxPlayers;

public 
plugin_init()
{
    
g_iMaxPlayers get_maxplayers();
    
set_task1.0"test"___"b" );
}

public 
test()
{
    new 
count;
    static 
bigstring[512];
    
    
formatex(bigstring511"Ts Players:\n");
    
    for( new 
1<= g_iMaxPlayersi++ ) 
    {
        if( !
is_user_alive(i) || cs_get_user_team(i) != CS_TEAM_T )
            continue;
        
        
count++
        new 
name32 ];
        
get_user_nameiname31 );
        
        
format(bigstring511"%s%d. %s\n"bigstringcountname);        
    }
    
    
set_hudmessage255000.00.1506.012.0 );
    
show_hudmessage0"%s"bigstring);



Bugsy 03-09-2010 13:51

Re: Get all name from a players.
 
Edit: tested and working

PHP Code:

#include < amxmodx >
#include < cstrike >

#pragma ctrlchar '\'

new g_iMaxPlayers;

public 
plugin_init()
{
    
g_iMaxPlayers get_maxplayers();
    
set_task1.0"test"___"b" );
}

public 
test()
{
    new 
count iPos;
    static 
bigstring[512] , name33 ];

    
iPos formatex(bigstring511"Ts Players:\n");
    
    for( new 
1<= g_iMaxPlayersi++ ) 
    {
        if( !
is_user_alive(i) || cs_get_user_team(i) != CS_TEAM_T )
            continue;

        
get_user_nameiname32 );
        
        
iPos += formatex(bigstringiPos ] , 511-iPos"%d. %s\n", ++countname);        
    }
    
    
set_hudmessage255000.00.1506.012.0 );
    
show_hudmessage0bigstring );



AntiBots 03-09-2010 17:17

Re: Get all name from a players.
 
Quote:

Originally Posted by worldspawn (Post 1112893)
you can type +showscores in console and see the names of all players

he want ahother think, read plis :wink:

dFF 03-10-2010 09:00

Re: Get all name from a players.
 
Many thanks guys ;)


All times are GMT -4. The time now is 08:48.

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