SA-MP Forums Archive
[Ayuda] Ids antes del nick - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Ayuda] Ids antes del nick (/showthread.php?tid=453660)



[Ayuda] Ids antes del nick - dannypanda05 - 25.07.2013

He visto Servidores en donde las Ids aparecen antes del nick en el Chat, he buscado algun scripts pero no encuentro u.u Tengo como la idea de saber como se hace pero no me sale :S
Me pasan el link de donde ta posteado eso? o pasenmen el scripts aqui, lo necesito :C

Ejemplo:
Normal: dannypanda05: [3]: hola .-.
Como lo quiero: [3] dannypanda05: hola .-.


Respuesta: [Ayuda] Ids antes del nick - Swedky - 25.07.2013

Код:
public OnPlayerText(playerid, text[])
{
    new Texto[128], Nombre[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nombre, sizeof (name));
    format(Texto, sizeof (Texto), "[%d] %s: %s", playerid, Nombre, text);
    SendPlayerMessageToAll(playerid, Texto);
    return 0;
}
Probб asн


Respuesta: [Ayuda] Ids antes del nick - EduGTA - 25.07.2013

Simple, se crean 2 arrays, usas GetPlayerName, format, SendPlayerMessageToAll y listo:

pawn Код:
public OnPlayerText(playerid, text[]) //Cuando el jugador inserte X texto
{
    new Texto[128], Nombre[21]; //Los 2 arrays
    GetPlayerName(playerid, Nombre, sizeof (Nombre)); //Almacenamos el nombre del jugador en el array "Nombre"
    format(Texto, sizeof(Texto), "[%d] %s: %s", playerid, Nombre, text); //Hacemos un format con el destino "Texto", con la ID, el nombre y el texto del jugador.
    SendPlayerMessageToAll(playerid, Texto); //Le enviamos el mensaje a todos
    return 0; //IMPORTANTE para esta ocasiуn, si retornamos 0, el mensaje por default NO ES ENVIADO, asн no aparecerбn 2 mensajes al mismo tiempo.
}
NOTA: Todo lo que estб detrбs del texto, serб del color del jugador.

Resultado:
[0] Edugta: Hola

Edit: Holy Shit! EnzoMetlc me ganу



Respuesta: [Ayuda] Ids antes del nick - dannypanda05 - 25.07.2013

No saldrнa ._. Ps me saldrнa el nick x defecto, o sea asi:

dannypanda05: [3] dannypanda05: hola .-.


Respuesta: [Ayuda] Ids antes del nick - xSDx - 25.07.2013

Tienes que usar SendClientMessageToAll, SendPlayerMesageToAll lo envia ya con el nick.


Respuesta: [Ayuda] Ids antes del nick - hotspicytaco - 25.07.2013

pawn Код:
public OnPlayerText(playerid, text[])
{
    static mensaje[198], nombre[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nombre, sizeof(nombre));
    format(mensaje, sizeof(mensaje), "[%i]{%06x} %s:{ffffff}%s", playerid, GetPlayerColor(playerid) >>> 8, nombre, text);
    SendClientMessageToAll(-1, mensaje);
    return 0;
}