View Single Post
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 07-20-2010 , 11:57   Re: [ES]Duda con print_chat (Para simple menu)
#6

Quote:
Originally Posted by Zapdos1 View Post
quieres que ese mensaje salga para todos?

solamente cambia el:

PHP Code:
client_print(idprint_chat"/simon"
por:
PHP Code:
client_print(0print_chat"/simon"
¿Por qué se cambia el id por un 0?

Por el id, significa (en este caso), el mensaje se lo mandará al jugador que seleccione la opción del menú

El 0, significa que no va solamente al jugador que seleccionó la opción del menú, si no, que también se lo manda a todos los jugadores conectados en el servidor

espero haberte ayudado ;)
Que respuesta.

El hecho que al poner 0 se le envie a todos los jugadores es porque el mismo modulo fue hecho para que haga eso.

PHP Code:
static cell AMX_NATIVE_CALL client_print(AMX *amxcell *params/* 3 param */
{
    
int len 0;
    
char *msg;
    
    if (
params[1] == 0)
    {
        for (
int i 1<= gpGlobals->maxClients; ++i)
        {
            
CPlayer *pPlayer GET_PLAYER_POINTER_I(i);
            
            if (
pPlayer->ingame)
            {
                
g_langMngr.SetDefLang(i);
                
msg format_amxstring(amxparams3len);
                
msg[len++] = '\n';
                
msg[len] = 0;
                
UTIL_ClientPrint(pPlayer->pEdictparams[2], msg);
            }
        }
    } else {
        
int index params[1];
        
        if (
index || index gpGlobals->maxClients)
        {
            
LogError(amxAMX_ERR_NATIVE"Invalid player id %d"index);
            return 
0;
        }
        
        
CPlayerpPlayer GET_PLAYER_POINTER_I(index);
        
g_langMngr.SetDefLang(index);
        
        
msg format_amxstring(amxparams3len);
        
msg[len++] = '\n';
        
msg[len] = 0;
        
        if (
pPlayer->ingame)
            
UTIL_ClientPrint(pPlayer->pEdictparams[2], msg);        //format_amxstring(amx, params, 3, len));
    
}
    
    return 
len;

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline