[PEDIDO]Suspeito /su
#5

pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID) {
    new pos = 0;
    while (text[pos] < 0x21) {
        if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
        pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos])) {
        userid = strval(text[pos]);
        if (userid >=0 && userid < MAX_PLAYERS) {
            if(!IsPlayerConnected(userid)) {
                userid = INVALID_PLAYER_ID;
            }
            else {
                return userid; // A player was found
            }
        }
    }
    new len = strlen(text[pos]), count = 0, name[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; ++i) {
        if (IsPlayerConnected(i)) {
            GetPlayerName(i, name, sizeof (name));
            if (strcmp(name, text[pos], true, len) == 0)
            {
                if (len == strlen(name)) {
                    return i;
                }
                else {
                    count++;
                    userid = i;
                }
            }
        }
    }
    if (count != 1) {
        if (playerid != INVALID_PLAYER_ID) {
            if (count) {
                SendClientMessage(playerid, 0xFF0000AA, "Encontrado mъltiplos jogadores(ReturnUser)");
            }
            else {
                SendClientMessage(playerid, 0xFF0000AA, "Jogador nгo encontrado(ReturnUser)");
            }
        }
        userid = INVALID_PLAYER_ID;
    }
    return userid; // INVALID_USER_ID for bad return
}
Reply


Messages In This Thread
[PEDIDO]Suspeito /su - by Nake01 - 14.06.2011, 18:49
Re: [PEDIDO]Suspeito /su - by Ricop522 - 14.06.2011, 19:03
Re: [PEDIDO]Suspeito /su - by Nake01 - 15.06.2011, 17:46
Re: [PEDIDO]Suspeito /su - by Shadoww5 - 15.06.2011, 17:56
Re: [PEDIDO]Suspeito /su - by Ricop522 - 15.06.2011, 17:59
Re: [PEDIDO]Suspeito /su - by RockFire - 15.06.2011, 18:00
Re: [PEDIDO]Suspeito /su - by Nake01 - 15.06.2011, 19:50
Re: [PEDIDO]Suspeito /su - by [R] ousenber [K] - 15.06.2011, 20:00
Re: [PEDIDO]Suspeito /su - by Ricop522 - 16.06.2011, 02:01
Re: [PEDIDO]Suspeito /su - by Nake01 - 16.06.2011, 15:34

Forum Jump:


Users browsing this thread: 1 Guest(s)