#1

yo se que es un poco tonta la pregunta pero como hago para que en el chat en ves de que aparesca asi 123456789 aparesca asi ********* ? como hago eso
Reply
#2

Agregalo a las palabras prohibidas de el Anti Cheat !.
Reply
#3

Depende lo que quieres hacer. Si es algo bien basico, puedes hacer algo asi:
pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new i, j=strlen(text); i<j; i++)
        if('0' <= text[i] <= '9')
            text[i] = '*';
    return 1;
}
Si buscas algo mas avanzado entonces podrias hacer algo asi:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new nums, dots, ddots, len;
    len = strlen(text);
    for(new i; i<len; i++)
    {
        if('0' <= text[i] <= '9')
            nums++;
        else if(text[i] == '.')
            dots++;
        else if(text[i] == ':')
            ddots++;
    }
    if(nums > 7 && dots > 2 && ddots > 0)
        for(new i; i<len; i++)
            if('0' <= text[i] <= '9')
                text[i] = '*';
    return 1;
}
Reply
#4

pawn Код:
if(strcmp(cmd, "/h", true) == 0 || strcmp(cmd, "/hablar", true) == 0 || strcmp(cmd, "/h", true) == 0)
{
if(IsPlayerConnected(playerid))
{

GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')){idx++;}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Servidor: Para Hablar Usa ( /h Texto ) ");
return 1;
}
new nums, dots, ddots, len;
len = strlen(result);
for(new i; i<len; i++)
{
if('0' <= result[i] <= '9')
nums++;
else if(result[i] == '.')
dots++;
else if(result[i] == ':')
ddots++;
}
if(nums > 7 && dots > 2 && ddots > 0)
for(new i; i<len; i++)
if('0' < result[i] < '9')
result[i] = '*';

new Hora, Minuto;
gettime(Hora,Minuto);
SetPlayerTime(playerid,Hora,Minuto);
format(string,256,"{0000FF}%d:%d {FFFFFF}.:{00FF00}%s{FFFFFF}:. {FFFF00}Dice{FFFFFF}: {FFFFFF}%s",Hora,Minuto,sendername,result);
SendClientMessageToAll(-1,string);
}
return 1;
}
PD: error Lo coloque asi y no me sirve = manda los numeros en ves de ****
Reply
#5

El segundo cуdigo que te enviу es mas para IPs, usa el segundo para nъmeros normales
Reply
#6

Le acabo de editar una cosita que estaba mal.
pawn Код:
if('0' < text[i] < '9')
//debia ser:
if('0' <= text[i] <= '9')
PD: Tene en cuenta que el segundo codigo, solo funciona con ips completas como por ejemplo: "192.168.1.1:7777" y no con numeros solos como puede ser "1374312".
Reply
#7

entoces colocare ambos codigos a ver si fuca tanto para ip como para numeros

EDIT: GRACIAS DE NUEVO THE_CHAOZ
Reply
#8

GROVE4L Hizo uno ke anda perfecto ---> https://sampforum.blast.hk/showthread.php?tid=248973
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)