[PEDIDO]/an e /sms com anti numeros
#1

Ae galera boa noite primeiramente, tipo eu tou precisando fazer um /an e /sms com anti-numeros, tipo se ele colocar qualquer numero no /an ou /sms, apareca algo como

SendClientMessage(playerid,COLOR_WHITE,"[INFO] Vocк nгo pode colocar numeros no /an.");


Oque eu tenho por enquanto .

Quote:

}
if(strcmp(cmd,"/An",true) == 0 || strcmp(cmd,"/anuncio",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid,COLOR_GREY,"Vocк deve estar logado!");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid,COLOR_GRAD1,"Vocк deve ter nнvel 3 !");
return 1;
}
GetPlayerName(playerid,sendername,sizeof(sendernam e));
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,"Use: (/An)uncio [Texto do Anuncio]");
return 1;
}
new praVoce = idx * 10;
if(GetPlayerMoneyEx(playerid) < praVoce)
{
format(string,sizeof(string),"* Vocк usou %d caracteres que custa %d R$,Vocк Nгo tem dinheiro suficiente.",offset,praVoce);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
return 1;
}
if(panuncio == 1)
{
SendClientMessage(playerid,COLOR_GRAD2,"Espere alguns Segundos para poder anunciar novamente!");
return 1;
}
GivePlayerMoney(playerid,- praVoce);
SBizzInfo[7][sbTill] += praVoce;
ExtortionSBiz(7,praVoce);
format(string,sizeof(string),"Anuncio: %s,Contato: %s Telefone: %d", result,sendername,PlayerInfo[playerid][pPnumber]);
OOCNews(TEAM_GROVE_COLOR,string);
format(string,sizeof(string),"~r~Pagou %d R$~n~~w~Letra contidas: %d Caracteres",praVoce,idx);
GameTextForPlayer(playerid,string,5000,5);
panuncio = 1;
TempoAn = SetTimer("Anuncio", 30000, 0);
}
return 1;
}

E o /sms -

Quote:

}
if(strcmp(cmd, "/sms", true) == 0 || strcmp(cmd, "/t", true) == 0 || strcmp(cmd, "/sms", true) == 0)
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid,COLOR_GRAD1,"Vocк deve ter nнvel 3 !");
return 1;
}
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Voce nгo estб logado!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Use: (/t)ext [telefone] [texto]");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um celular...");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s pegou o celular.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
new phonenumb = strval(tmp);
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, "Use: (/t)ext [NUMERO TELEFONE] [TEXTO]");
return 1;
}
if(phonenumb == 555)
{
if ((strcmp("sim", result, true, strlen(result)) == 0) && (strlen(result) == strlen("sim")))
{
SendClientMessage(playerid, COLOR_WHITE, "Mensagem enviada.");
if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: Eu nгo tenho nenhuma idйia o sobre o que vocк estб falando, Remetente,: Ronaldo (555)");
RingTone[playerid] = 20;
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: Um simples Sim farб, Remetente: Ronaldo (555)");
RingTone[playerid] = 20;
return 1;
}
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
{
giveplayerid = i;
Mobile[playerid] = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " O celular chamado esta fora da area de cobertura ou desligado !");
return 1;
}
format(string, sizeof(string), "SMS: %s, enviou: %s (%d)", result,sendername,PlayerInfo[playerid][pPnumber]);
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
//format(string, sizeof(string), "* %s's phone beeps.", sendername);
RingTone[giveplayerid] =20;
SendClientMessage(playerid, COLOR_WHITE, "SMS Enviado");
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "~r~R$-%d", SBizzInfo[2][sbEntranceCost]);
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoneyEx(playerid,-SBizzInfo[2][sbEntranceCost]);
SBizzInfo[2][sbTill] += SBizzInfo[2][sbEntranceCost];
ExtortionSBiz(2, SBizzInfo[2][sbEntranceCost]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Mobile[playerid] = 255;
return 1;
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " Mensagem falhou!");
}
return 1;
}

Reply
#2

Use IsNumeric, nгo estou com a stock aqui, mas hб posts que tem o stock do mesmo !!!
Reply
#3

E onde coloco isso? =S
Reply
#4

@Franz

Final Gm
pawn Код:
IsNumeric(const string[])
{
        for (new i = 0, j = strlen(string); i < j; i++)
        {
                if (string[i] > '9' || string[i] < '0') return 0;
        }
        return 1;
}
Agora no Comando antes de outras Funзхes:

pawn Код:
if(IsNumeric(tmp)) return SendClientMessage(playerid,color,"Sem Nъmeros");
Reply
#5

Mais facil colocar para apenas Nv 3+ poder ligar
e colocar anti divulgador, ele e kickado ou banido se mandar por exemplo 201.

Ai ele nгo consegue divulguar...
Conselho...

Coloque tb no anti divulgador exemplo: "201-199" ou "191,10" ou "191 101"
Para nao ter de jeito nenhum ter divulgaзгo ! =p
Reply
#6

Menor:Isso dб muito Trabalho ficar fazendo 200*,200.,200-
No meu Game Mode eu uso um Avanзado sistema de Contagem de nъmero em String caso o Player fale

127*.0.1.1.4 ou 1272114214

Daria na mesma pois ele detecta por o nъmeros encontrados na String assim й impossнvel Publicar de qualquer forma

pawn Код:
stock AntiPublic(playerid,text[])
{
    new size=strlen(text);
    new cts=0;
    for (new i=0;i<=size;i++) if ((text[i] >= 47) && (text[i] <= 58)) cts++;
    if (cts >= 8) {
        for (new x=0;x<=size;x++) if((text[x] == 46) || (text[x] == 58)) {
            BanEx(playerid,"Propaganda");
            return false;     }}
    return true;
}
8 й o nъmero mбximo permitido na String caso passe de 8 Nъmeros (Considerado IP) ele Bane
Reply
#7

pera, com drakon??
se o cara falar qlq coisa com mais de 8 numeros ele й banido
isso??
Reply
#8

isso ai keller
Reply
#9

Drakon, vocк sabia que se vocк pegar o texto:
Код:
Olб
3 caracteres

Ou seja, text = Olб

Se colocar, text[1], ficarб:
Код:
Nгo poderб dar um fail aн? =x
Reply
#10

@SubZero:

Loop Amigo,Loop


for (new x=0;x<=size;x++)

Sendo:

111 222 333
OLб Olб Olб


Ele checarб:
pawn Код:
text[0] == 'D';
text[1] == 'R';
text[2] == 'A';
text[3] == 'K';
text[4] == 'I';
text[5] == 'N';
text[6] == 'S';
Depois:
pawn Код:
text[2] == 'D';
text[3] == 'R';
text[4] == 'A';
text[5] == 'K';
text[6] == 'I';
text[7] == 'N';
text[8] == 'S';
Isto,chamado equivalencia й parecido com a funзгo strfind,porйm strfind й uma funзгo e й 100x mais lento que a Equivalencia,que tambйm й encontrada em outras linguagens..
string[LOCAL] OPERADOR-RELACIONAL 'DWORD'

Cada um dessas Equivalкncia tem suporte a colocar uma DWORD dentro dos ' ', uma DWORD Equivale a 4 Bytes ( 32 bits), que Equivale a 1 Caracter, que logicamente Equivale ao Valor de um Index em uma Matriz.
new array[10], entгo levando em conta que uma Index equivale a um Caracter..
Sendo:

D r a K i N s
1 2 34 5 6 7

new Array[7]

Observe que a nъmero de caracters da palavra DraKiNs foi equivalente a 7 Index na Matriz "Array",totalizando a ocupaзгo de 28 Bytes (112 Bits) ...

EXPLICANDO MINHA FUNЗГO:

Com o Loop ele checarб tudo em Cadeias,isto й ele checara Caracter por caracter atй achar o DWORD corresponde a o que esta dentro de ' ',assim ele checarб o prуximo caracter,caso a funзгo toda executada de resultado verdadeiro ele irб adicionar um valor em um array,caso esse valor checar a 8 e for menor que 16,o que seria um numero de IP,ele irб aplicar a aзгo...


Nгo,nгo darб 'Fail'

@Keller:
Nгo se usa da Seguinte Forma:

pawn Код:
stock AntiPublic(playerid,text[])
{
    new size=strlen(text);
    new cts=0;
    for (new i=0;i<=size;i++) if ((text[i] >= 47) && (text[i] <= 58)) cts++;
    if (cts >= 8) {
        for (new x=0;x<=size;x++) if((text[x] == 46) || (text[x] == 58)) {
            //- O QUE FAZER -//
            return false;     }}
    return true;
}
E no Cуdigo Coloca
pawn Код:
AntiPublic(playerid,tmp);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)