[Ajuda] stock InvalidNameCheck
#1

Tem alguma coisa errada aqui, sempre kika mas nгo avisa sobre o nome invбlido

Код:
stock InvalidNameCheck(playerid)
{

	new
		szPlayerName[MAX_PLAYER_NAME],
		arrForbiddenNames[][] = {
			"com1", "com2", "com3", "com4",
			"com5", "com6", "com7", "com8",
			"com9", "lpt4", "lpt5", "lpt6",
			"lpt7", "lpt8", "lpt9", "nul",
			"clock$", "aux", "prn", "con",
			"InvalidNick", "BannedPlayer"
		},
		iLength,
		i;

	GetPlayerName(playerid, szPlayerName, sizeof(szPlayerName));
	iLength = strlen(szPlayerName);

	while(i < sizeof(arrForbiddenNames)) if(strcmp(arrForbiddenNames[i++], szPlayerName, true) == 0) {
		SetPlayerName(playerid, "InvalidNick");
		SendClientMessage(playerid, COLOR_NEWS, "You have been kicked for using an invalid name.");
		Kick(playerid);
		return 0;
	}

	if(szPlayerName[iLength - 1] == '_' || szPlayerName[0] == '_' || strfind(szPlayerName, "_", false) == -1)
	{
		SendClientMessage(playerid, COLOR_NEWS, "You have been kicked for failing to connect with a role play name (i.e. John_Smith).");
  		SetPlayerName(playerid, "InvalidNick");
		Kick(playerid);
		return 0;
	}
	return 1;
}
Reply
#2

isso aconteceu comigu tam bem
eu criei um timer no kick pra esperar meio segundo para kikar
ai da tempo de mandar a mensage
Reply
#3

Como vocк colocou, aqui tentei e nгo deu certo D:
Reply
#4

criei uma funзгo...
pawn Код:
KickT(playerid);
pawn Код:
public KickT(Chefao)
{
    if(IsPlayerConnected(Chefao))
    {
        SetTimerEx("KickTT",1000, false, "i", Chefao);
        return 1;
    }
    return 1;
}
public KickTT(Chefao)
{
    if(IsPlayerConnected(Chefao))
    {
        Kick(Chefao);
        return 1;
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Chefгo
Посмотреть сообщение
criei uma funзгo...
pawn Код:
KickT(playerid);
pawn Код:
public KickT(Chefao)
{
    if(IsPlayerConnected(Chefao))
    {
        SetTimerEx("KickTT",1000, false, "i", Chefao);
        return 1;
    }
    return 1;
}
public KickTT(Chefao)
{
    if(IsPlayerConnected(Chefao))
    {
        Kick(Chefao);
        return 1;
    }
    return 1;
}
IsPlayerConnected?
Reply
#6

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
IsPlayerConnected?
eterno gf kkk...
@topic
PHP код:
#define Kick(%0) SetTimerEx("kickTwo", 1000, 0, "i", %0)
forward kickTwo(playerid);
public 
kickTwo(playerid)
     return 
Kick(playerid); 
Reply
#7

pawn Код:
new STRX[256];

stock InvalidNameCheck(playerid)
{

    new
        szPlayerName[MAX_PLAYER_NAME],
        arrForbiddenNames[][] = {
            "com1", "com2", "com3", "com4",
            "com5", "com6", "com7", "com8",
            "com9", "lpt4", "lpt5", "lpt6",
            "lpt7", "lpt8", "lpt9", "nul",
            "clock$", "aux", "prn", "con",
            "InvalidNick", "BannedPlayer"
        },
        iLength,
        i;

    GetPlayerName(playerid, szPlayerName, sizeof(szPlayerName));
    iLength = strlen(szPlayerName);

    while(i < sizeof(arrForbiddenNames)) if(strcmp(arrForbiddenNames[i++], szPlayerName, true) == 0) {
        SetPlayerName(playerid, "InvalidNick");
        SendClientMessage(playerid, COLOR_NEWS, "You have been kicked for using an invalid name.");
        Kick(playerid);
        return 0;
    }

    if(szPlayerName[iLength - 1] == '_' || szPlayerName[0] == '_' || strfind(szPlayerName, "_", false) == -1)
    {
        SetPlayerName(playerid, "InvalidNick");
        format(STRX, sizeof(STRX), "You have been kicked for failing to connect with a role play name (i.e. John_Smith).");
        SendClientMessage(playerid,COLOR_NEWS, STRX);
        KickLog(STRX);
        Kick(playerid);
        return 0;
    }
    return 1;
}

forward KickLog(string[]);
public KickLog(string[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\r\n", string);
    new File:hFile;
    hFile = fopen("Logs/Kicks.Kick", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
    return 1;
}
use isso vai funcionar
nгo se esqueзa de criar uma pasta chamada "Logs" no scriptfiles OK....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)