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

[ES] Detectar cantidad de users por 2da vez


  
 
 
Thread Tools Display Modes
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 03-21-2010 , 10:14   Re: [ES] Detectar cantidad de users por 2da vez
#11

Quote:
Originally Posted by xfile_ View Post
Code:
       for ( new players = 0; players <= get_maxplayers ( ); players++ )
       {
              if ( is_user_connected ( players ) )
              { 
                    new PLname [ 32 ]
                    get_user_name( players, PLname, sizeof PLname - 1 )
                    client_print ( 0, print_center, "%s -", PLname )
              }
       }
Ya habia probado eso, pero eso solo me detecta el name del ultimo conectado, quisiera especificamente del 2do o del 3ero o de cualquiera.
__________________
Oh hell no this shit is awesome !!!
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
xfile_
Senior Member
Join Date: Apr 2009
Old 03-21-2010 , 10:50   Re: [ES] Detectar cantidad de users por 2da vez
#12

Quote:
Originally Posted by shinoda View Post
Ya habia probado eso, pero eso solo me detecta el name del ultimo conectado
Es porque el texto esta en print_center, cambialo a print_chat

Quote:
Originally Posted by shinoda View Post
quisiera especificamente del 2do o del 3ero o de cualquiera.
PHP Code:
#include <amxmodx>

public plugin_init() 
{
    
register_clcmd("say awd""name")
}

public 
name(id
{
       new 
xplayers;

       for ( new 
players 0players <= get_maxplayers ( ); players++ )
       {
              if ( 
is_user_connected players ) )
              { 
                    
xplayers++

                    new 
PLname 32 ]
                    
get_user_nameplayersPLnamesizeof PLname )
                    
client_print 0print_chat"%d - %s^n"xplayersPLname )
              }
       }

       
set_hudmessage42255420.50.506.010.0 )
       
show_hudmessageid"( %i ) players conectados"xplayers )


Last edited by xfile_; 03-21-2010 at 11:10.
xfile_ is offline
Send a message via MSN to xfile_
ILUSION
Senior Member
Join Date: Oct 2006
Location: Argentina
Old 03-21-2010 , 17:46   Re: [ES] Detectar cantidad de users por 2da vez
#13

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("say name""name")
}

public 
name(id) {
    
client_print(idprint_chat"Usuarios conectados: %d"get_playersnum(0))

ILUSION is offline
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 03-21-2010 , 17:53   Re: [ES] Detectar cantidad de users por 2da vez
#14

@ILUSION

Lo probaste?
Raddish is offline
ILUSION
Senior Member
Join Date: Oct 2006
Location: Argentina
Old 03-21-2010 , 18:10   Re: [ES] Detectar cantidad de users por 2da vez
#15

Quote:
Originally Posted by Raddish View Post
@ILUSION

Lo probaste?
No, pero debería andar.
ILUSION is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 03-21-2010 , 23:07   Re: [ES] Detectar cantidad de users por 2da vez
#16

PHP Code:
#include <amxmodx>

new maxplayers

public plugin_init() {
    
register_clcmd("say name""name")
    
maxplayers get_maxplayers()
}

public 
name(id) {
    switch(
conectados) {
        case 
1:  client_print(idprint_chat"Estas solo gay")
        case 
3: {

            
// Quiero sacar el nombre de esos 3 conectados :S
            
client_print(0print_chat"El name del 1º es: %s "...)
            
client_print(0print_chat"El name del 2º es: %s "...)
            
client_print(0print_chat"El name del 3º es: %s "...)
        }
    }
}

conectados() {
    static 
Indexusersconectadosusersconectados 0
    
for(Index=1Index<=maxplayersIndex++)
        if(
is_user_connected(Index)) usersconectados++
    
    return 
usersconectados;

Quiero sacar el nombre de esos 3 conectados :S
__________________
Oh hell no this shit is awesome !!!
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 03-22-2010 , 04:18   Re: [ES] Detectar cantidad de users por 2da vez
#17

guiate con este :p

PHP Code:
#include <amxmodx>

new iMaxPlayers;
new 
msgSayText;

static const 
color[] = "^x03" 

public plugin_init() {
    
register_plugin("Players Online""1.0""G_often")
    
    
register_clcmd("say /players","handle_say")
    
    
iMaxPlayers get_maxplayers()
    
msgSayText get_user_msgid("SayText")
}
public 
handle_say(id)
{
    new 
Players[33][32]
    new 
message[256]
    new 
Countxlena
    
    
for (1<= iMaxPlayersa++)
    {    
        if(
is_user_connected(a))
        {
            
get_user_name(aPlayers[Count++], 31)
        }
    }
    
    
len format(message255"%s Players Conectados : "color)
    
    if(
Count 0)
    {
        for(
Count x++)
        { 
            
len += format(message[len], 255-len"%s%s "Players[x], < (Count-1) ? "," "")
            
            if(
len 96 )
            {
                
print_message(idmessage)
                
len format(message255"%s ",color)
            }
        }
        
print_message(idmessage)
    }
    else if(
Count == 1)
    {
        
len += format(message[len], 255-len"Estas vos solo conectado")
        
print_message(idmessage)
        
    }
    else if(
Count <= 0)
    {
        
len += format(message[len], 255-len"No hay players conectados")
        
print_message(idmessage)
    }
    
}
print_message(idmsg[])
{
    
message_begin(MSG_ONEmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

__________________
Reality is wrong, dreams are for real.
g_often is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 03-22-2010 , 09:33   Re: [ES] Detectar cantidad de users por 2da vez
#18

PHP Code:
conectados() {
    static 
Indexusersconectadosusersconectados 0
    
for(Index=1Index<=maxplayersIndex++)
        if(
is_user_connected(Index)) usersconectados++
    
    return 
usersconectados;

->

PHP Code:
stock conectados()
{
    return 
get_playersnum()

http://www.amxmodx.org/funcwiki.php?go=func&id=173
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 03-23-2010 , 11:49   Re: [ES] Detectar cantidad de users por 2da vez
#19

Gracias a todos por la ayuda pero aun no logro sacar los nombres T_T


PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("say name""name")
}

public 
name(id) {
    switch(
get_playersnum() ) {
        case 
1:  client_print(idprint_chat"Estas solo gay")
        case 
3: {

            
// Quiero sacar el nombre de esos 3 conectados :S
            
client_print(0print_chat"El name del 1º es: %s "...)
            
client_print(0print_chat"El name del 2º es: %s "..)
            
client_print(0print_chat"El name del 3º es: %s "...)
        }
    }

__________________
Oh hell no this shit is awesome !!!

Last edited by shinoda; 03-23-2010 at 11:53.
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 03-23-2010 , 11:56   Re: [ES] Detectar cantidad de users por 2da vez
#20

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("say name""name")
}

public 
name(id) {
    new 
Players[32]
    new 
nombre[32]
    new 
playerCount
    get_players
(PlayersplayerCount
    switch(
playerCount) {
        case 
1:  client_print(idprint_chat"Estas solo gay")
        default: {
            for(new 
0playerCounti++)
            {
                
get_user_name(Players[i], nombrecharsmax(nombre))
                
client_print(0print_chat"El name del %iº es: %s"i+1nombre)
            }
        }
    }

__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
 



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 05:37.


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