[Pedido] Quebra de linha automatico
#1

Estou pesquisando e pesquisando e nunca encontro pelo menos uma base, tipo, estou a procura de um sistema que, quando a pessoa digita(tambйm em comandos) pula uma linha caso a mensagem for muito grande.
Reply
#2

PHP код:
#include <a_samp>
public OnPlayerText(playeridtext[])
{
    new 
Texto[144];
    
format(Textosizeof(Texto), "%s(%d): %s"Name(playerid), playeridTexto);
    
    if(
strlen(Texto) < 72// 1/2
    
{
        
SendClientMessageToAll(-1Texto);
    }
    else if(
strlen(Texto) > 72// +1/2
    
{
        new 
Linha[2][73];
        
strmid(Linha[0], Texto07272);
        
SendClientMessageToAll(-1Linha[0]);
        
strmid(Linha[1], Texto7314472);
        
SendClientMessageToAll(-1Linha[1]);
        
strdel(Texto0144);
        return 
false;
    }
    return 
true;
}
stock Name(playerid)
{
    new 
Name[24];
    
GetPlayerName(playeridName24);
    return 
Name;

Reply
#3

Funзхes:
PHP код:
#define MAXIMUM_SIZE_LINE 144 // respeitando os limites do SA-MP (144 caracteres em SendClientMessage() )
SendMessage(playeridcolormessage[] ) {
    for (;;) {
        if ( 
strlen(message) >= MAXIMUM_SIZE_LINE ) {
            new 
str[MAXIMUM_SIZE_LINE 1];
            
format(strsizeof(str), message);
            
strdel(message0MAXIMUM_SIZE_LINE);
            
SendClientMessage(playeridcolorstr);
            if ( 
strlen(message) <= MAXIMUM_SIZE_LINE ) {
                
SendClientMessage(playeridcolormessage);
                break;
            }
        }
        else {
            
SendClientMessage(playeridcolormessage);
            break;
        }
    }
}
SendMessageToAll(colormessage[] ) {
    for (;;) {
        if ( 
strlen(message) >= MAXIMUM_SIZE_LINE ) {
            new 
str[MAXIMUM_SIZE_LINE 1];
            
format(strsizeof(str), message);
            
strdel(message0MAXIMUM_SIZE_LINE);
            
SendClientMessageToAll(colorstr);
            if ( 
strlen(message) <= MAXIMUM_SIZE_LINE ) {
                
SendClientMessageToAll(colormessage);
                break;
            }
        }
        else {
            
SendClientMessageToAll(colormessage);
            break;
        }
    }

Exemplo idiota de uso:
PHP код:
CMD:mensagem(playeridparams[]) {
    if ( 
isnull(params) )
        
SendClientMessage(playerid, -1"Use /mensagem [texto]");
    
SendMessage(playerid, -1params);
    return 
1;

Exemplo menos idiota de uso:
PHP код:
public OnPlayerText(playeridtext[]) {
    
SendMessageToAll(-1text);
    return 
0;

Quote:
Originally Posted by Nenzittow
Посмотреть сообщение
PHP код:
#include <a_samp>
public OnPlayerText(playeridtext[])
{
    new 
Texto[144];
    
format(Textosizeof(Texto), "%s(%d): %s"Name(playerid), playeridTexto);
    
    if(
strlen(Texto) < 72// 1/2
    
{
        
SendClientMessageToAll(-1Texto);
    }
    else if(
strlen(Texto) > 72// +1/2
    
{
        new 
Linha[2][73];
        
strmid(Linha[0], Texto07272);
        
SendClientMessageToAll(-1Linha[0]);
        
strmid(Linha[1], Texto7314472);
        
SendClientMessageToAll(-1Linha[1]);
        
strdel(Texto0144);
        return 
false;
    }
    return 
true;
}
stock Name(playerid)
{
    new 
Name[24];
    
GetPlayerName(playeridName24);
    return 
Name;

Se o texto tiver mais que 144 caracteres nгo vai mostrar a mensagem completa ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)