[Ajuda] Anъncio cobra o dinheiro mais nгo vai a mensagem
#1

Pessoal, й o seguinte, o anъncio quando estб muito grande, gasta 300 reais da pessoa mais nгo envia nada. Entгo eu fui e adicionei um cуdigo para limitar a quantidade de caracteres, porem ele nгo estб funcionando. Me ajudem com isso por favor:

PHP код:
if( !strcmpcmd"/An"true ))
{
    if( 
pInfoplayerid ][ Level ] < )
    {
        
SendClientMessageplayeridCOLOR_ERRO"[ x ] Vocк sу pode enviar um anuncio global com level 5 ou superior !" );
        return 
1;
    }
    if( 
viwerANplayerid ] > gettime( ))
    {
        
formatgStrsizeofgStr ), "[ x ] Aguarde %d segundos para fazer um novo anъncio !"viwerANplayerid ] - gettime( ));
        
SendClientMessageplayeridCOLOR_ERROgStr );
        return 
1;
    }
    if( 
GetPlayerCashplayerid ) < 300 )
    {
        
SendClientMessageplayeridCOLOR_ERRO"[ x ] Vocк nгo tem dinheiro suficiente para fazer um anъncio ! ( Preзo: $300 )" );
        return 
1;
    }
    new 
length strlencmdtext );
    while (( 
idx length ) && ( cmdtextidx ] <= ' ' ))
    {
        
idx++;
    }
    new 
offset idx;
    new 
result64 ];
    while (( 
idx length ) && (( idx offset ) < ( sizeofresult ) - )) )
    {
        
resultidx offset ] = cmdtextidx ];
        
idx++;
    }
    
resultidx offset ] = EOS;
    if( !
strlenresult ))
    {
        
SendClientMessageplayeridCOLOR_ERRO"[ x ] Uso correto: /An [ Mensagem ]" );
        return 
1;
    }
    if( 
strlenresult ) > 60 )
    {
        
SendClientMessageplayeridCOLOR_ERRO"[ x ] Anъncio muito grande, envie um anъncio de no mбximo 60 caracteres !" );
        return 
1;
    }
    new
    
viewer512 ]
    ;
    
formatviewersizeofviewer ), "{FFFAFA}ANЪNCIO: {00FF00}%s{FFFAFA} anuncia: {A9A9A9}%s {FFFAFA}- Contato: {A9A9A9}/SMS %d"PlayerNameplayerid ), resultplayerid );
    
SendClientMessageToAllCOLOR_BRANCOviewer );
    
viwerANplayerid ] = gettime( ) + 120;
    
sGivePlayerCashplayerid, -300 );
    return 
1;

Reply
#2

Jб tentou trocar o SendClientMessageToAll por um loop em todos os players?
Reply
#3

Nгo deu certo nгo man...
Reply
#4

up !
Reply
#5

Realmente assim com Strcmp e Strtok fica complicado. Uma maneira mais fбcil й utilizando ZCMD e SSCANF.

Aqui um exemplo simples que resolveria seu problema

pawn Код:
CMD:teste(playerid, params[])
{
    new texto[50]; // Parametro recebido (string).

    new string[100]; // Texto para format
   
    if(sscanf(params, "s[50]", texto)) return SendClientMessage(playerid, -1, "Comando errado.");

    format(str, sizeof(str), "Texto: %s, Length: %d", texto, strlen(texto)); // Mostrando o texto e seu tamanho.
   
    if(strlen(texto) > LIMITE)
    {
        // ... Aзгo
    }
   
    SendClientMessage(playerid, -1, str); // Enviando mensagem formatada.
   
    return 1;
}

Reply
#6

Como falaram, faзa os teus comandos com o uso de ZCMD, fica mais fбcil e mais rбpido.

Abraзos,
Reply
#7

Fiz isso. Resolvido !
Obrigado !

+Rep para quem nгo tinha dado antes !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)