SA-MP Forums Archive
[Ajuda]Proibir numeros - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda]Proibir numeros (/showthread.php?tid=158049)



[Ajuda]Proibir numeros - keller012 - 08.07.2010

Pessoal eu ate tentei adaptar um anti ip no anuncio mas nao consegui.
eu queria que nao desse para colocar numeros nos /anuncios que os players fazer.

alguem sabe como??
o cmd que tem no meu gm eh esse:

Код:
	if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pLevel] < 2)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa ter nнvel 2 para usar essa funзгo !");
	            return 1;
	        }
			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, "USE: (/an)uncio [texto]");
				return 1;
			}
			if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
			{
				format(string, sizeof(string), "   Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !",  (addtimer/1000));
				SendClientMessage(playerid, COLOR_GRAD2, string);
				return 1;

			}
    		new payout = idx * 5;
			if(GetPlayerMoney(playerid) < payout)
	        {
	            format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
	            SendClientMessage(playerid, COLOR_WHITE, string);
	            return 1;
	        }
			SafeGivePlayerMoney(playerid, - payout);
			SBizzInfo[7][sbTill] += payout;
			ExtortionSBiz(7, payout);
			format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
			OOCNews(TEAM_GROVE_COLOR,string);
			format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
			GameTextForPlayer(playerid, string, 5000, 1);
			if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
		}
		return 1;
	}



Re: [Ajuda]Proibir numeros - keller012 - 08.07.2010

nenhuma ideia?


Re: [Ajuda]Proibir numeros - ipsBruno - 08.07.2010

pawn Код:
if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa ter nнvel 2 para usar essa funзгo !");
                return 1;
            }
                 if(IsNumeric(result))
{
SendClientMessage(playerid, COLOR_GREY, "   Sem Numeros Filho da Puta !");
                return 1;

}
            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, "USE: (/an)uncio [texto]");
                return 1;
            }

            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "   Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
            {
                format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            SafeGivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
        }
        return 1;
    }
Final GM:
pawn Код:
stock IsNumeric(const string[]) {
    new length=strlen(string);
    if (length==0) return false;
    for (new i = 0; i < length; i++) {
        if (
        (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
        || (string[i]=='-' && i!=0)                                             //
        || (string[i]=='+' && i!=0)                                             //
        ) return false;
    }
    if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
    return true;
}



Re: [Ajuda]Proibir numeros - keller012 - 08.07.2010

deu esse erro drakon

Код:
symbol already defined: "IsNumeric"
tive que realocar oque voce colocou la mas deu
so isso ai deu erro


Re: [Ajuda]Proibir numeros - keller012 - 08.07.2010

stock IsNumeric nao й padrao do samp??
pq deu esse erro?


Re: [Ajuda]Proibir numeros - GTA.Drifter - 16.09.2010

Double post amigo ;\


Re: [Ajuda]Proibir numeros - keller012 - 16.09.2010

nooossa
ta desenterando topicos
pra fala double post??


Re: [Ajuda]Proibir numeros - Canabis - 16.09.2010

Quote:
Originally Posted by keller012
Посмотреть сообщение
deu esse erro drakon

Код:
symbol already defined: "IsNumeric"
tive que realocar oque voce colocou la mas deu
so isso ai deu erro
й so vc excluir

pawn Код:
stock IsNumeric(const string[]) {
    new length=strlen(string);
    if (length==0) return false;
    for (new i = 0; i < length; i++) {
        if (
        (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
        || (string[i]=='-' && i!=0)                                             //
        || (string[i]=='+' && i!=0)                                             //
        ) return false;
    }
    if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
    return true;
}



Re: [Ajuda]Proibir numeros - TiagoPS - 16.09.2010

eu tenho uma duvida quanto ao codigo de /an do keller.

porque tem uma espйcie de "strtok" inteira dentro do comando ??

obrigado se me responderem