[Pedido] Chat normal con uno de entorno.
#10

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Esta exagerada tu funcion.

pawn Код:
// ** INCLUDES

#include <a_samp>

// ** DEFINES

// *** FUNCTIONS

#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)

// ** MAIN

main()
{
    print("Loaded \"color_opening_and_closing_tags.amx\".");
}

// ** CALLBACKS

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPlayerColor(playerid, 0xFF0000FF);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new opening_tag_pos = strfind(text, "*", true);
    if(opening_tag_pos != -1)
    {
        new new_text[128], closing_tag_pos = strfind(text, "*", true, (opening_tag_pos + 1));
        strcpy(new_text, text, 128);

        if(closing_tag_pos != -1)
        {
            new string[256];
            strdel(new_text, opening_tag_pos, (opening_tag_pos + 1));
            strdel(new_text, (closing_tag_pos - 1), closing_tag_pos);

            strins(new_text, "{FFFFFF}", (closing_tag_pos - 1), 128);
            strins(new_text, "{FFF000}", opening_tag_pos, 128);

            format(string, sizeof(string), "%s: {FFFFFF}%s", ReturnPlayerName(playerid), new_text);
            SendClientMessageToAll(GetPlayerColor(playerid), string);
            return 0;
        }
    }
    return 1;
}

// ** FUNCTIONS

stock ReturnPlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}


Esto nomas te permitira usar una vez los dos "*", si mandas, por ejemplo "hola *hola* hola *hola*". Solo la primera "*hola*" cambiara de color. Y el otro sera omitido. Si quieres tu puedes aсadir eso.
ЎSaludos!

Me gustу bastante estб, ya que me llamу a la atenciуn que puedas poner el Mensaje principal, luego el rol de entorno y la continuaciуn... Yo lo habнa hecho de otra manera.

PHP код:
[HTML]new Asterisco strfind(text"*");
    new 
string[172], Mensaje[172];
    
strmid(Mensajetext0strlen(text));
    if(
Asterisco != -1)
    {
        
strdel(MensajeAsteriscoAsterisco+1);
        
strins(Mensaje"{00E673}"Asterisco172);
        
format(stringsizeof(string), "%s dice: %s"NombreJugador(playerid), Mensaje);
        
ProxDetector(15.0playeridstringHablarHablar2Hablar3Hablar4Hablar5);
        
SetPlayerChatBubble(playeridMensaje0xFFFFFFFF15.05000);
    }
    else
    {
        
format(stringsizeof(string), "%s dice: %s"NombreJugador(playerid), text);
        
ProxDetector(15.0playeridstringHablarHablar2Hablar3Hablar4Hablar5);
        
SetPlayerChatBubble(playeridtext0xFFFFFFFF15.05000);
    }[/
HTML
Pero como lo hiciste tu me gustу mбs, solo cambie unas cosas en el tuyo y le aсadн unas variables que tenнa gracias.


PD: Gracias a todos los que pusieron una soluciуn u ayuda... Se les agradece de corazуn, y sobre el ъltimo que comento que no habнa seсal de mi, tuve algunos problemas personales por eso estaba ausente.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)