Me pueden ayudar con onplayerconnect ?
#9

Quote:
Originally Posted by [J]ulian
Посмотреть сообщение
Probб asн:

pawn Код:
static nombre[MAX_PLAYER_NAME];
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, nombre, sizeof(nombre));
    if(ComprobarNick(nombre))
    {
        SendClientMessage(playerid, -1, "SERVIDOR: No puedes utilizar nъmeros en el nick.");
        return Kick(playerid);
    }
    return 1;
}

stock ComprobarNick(cuenta[])  // By Juliбn
{
    new chars = strlen(cuenta), pos = 0;
    while(pos != chars)
    {
        if(cuenta[pos] == '_') cuenta[pos] = '\0';
        pos++;
    }
    chars = strlen(cuenta), pos = 0;
    for(new c = 0; c < chars; c++)
    {
        if(cuenta[c] == '1' || cuenta[c] == '2' || cuenta[c] == '3' || cuenta[c] == '3' || cuenta[c] == '4' || cuenta[c] == '5' || cuenta[c] == '6' || cuenta[c] == '7' || cuenta[c] == '8' || cuenta[c] == '9' || cuenta[c] == '0')
            pos+=1;
    }
    if(pos != 0) return 0;
    return 1;
}
Si no es lo que queres, probб asн:

pawn Код:
static nombre[MAX_PLAYER_NAME];
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, nombre, sizeof(nombre));
    if(ComprobarNick(nombre))
    {
        SendClientMessage(playerid, -1, "SERVIDOR: No puedes utilizar nъmeros en el nick.");
        return Kick(playerid);
    }
    return 1;
}

stock ComprobarNick(cuenta[]) // By Juliбn
{
    new chars = strlen(cuenta), pos = 0;
    while(pos != chars)
    {
        if(cuenta[pos] == '_') cuenta[pos] = '\0';
        pos++;
    }
    chars = strlen(cuenta), pos = 0;
    for(new c = 0; c < chars; c++)
    {
        if(cuenta[c] == '1' || cuenta[c] == '2' || cuenta[c] == '3' || cuenta[c] == '3' || cuenta[c] == '4' || cuenta[c] == '5' || cuenta[c] == '6' || cuenta[c] == '7' || cuenta[c] == '8' || cuenta[c] == '9' || cuenta[c] == '0')
            pos+=1;
    }
    if(pos != 0) return 1;
    return 0;
}
Todavнa no entiendo como querйs, pero una de esas 2 es la que necesitas.
Cual de los dos detecta que el numero es primero que las letras?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)