[HELP]Aheal cmd
#5

Uhm... try again my first code with ReturnUser(tmp); and add this:
pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new pos = 0;
    while (text[pos] < 0x21) // Strip out leading spaces
    {
        if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
        pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos])) // Check whole passed string
    {
        userid = strval(text[pos]);
        if (userid >=0 && userid < MAX_PLAYERS)
        {
            if(!IsPlayerConnected(userid))
            {
                userid = INVALID_PLAYER_ID;
            }
            else
            {
                return userid;
            }
        }
    }
    new len = strlen(text[pos]);
    new count = 0;
    new 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, "Multiple users found, please narrow earch");
            } else { SendClientMessage(playerid, 0xFF0000AA, "No matching user found");}
                } userid = INVALID_PLAYER_ID; } return userid;
}
Reply


Messages In This Thread
[HELP]Aheal cmd - by [Aka]Dragonu - 01.09.2011, 12:29
Re: [HELP]Aheal cmd - by Jafet_Macario - 01.09.2011, 13:31
Re : [HELP]Aheal cmd - by Naruto_Emilio - 01.09.2011, 13:33
Re: [HELP]Aheal cmd - by [Aka]Dragonu - 01.09.2011, 13:47
Re: [HELP]Aheal cmd - by Jafet_Macario - 01.09.2011, 13:55
Re: [HELP]Aheal cmd - by [Aka]Dragonu - 01.09.2011, 14:03
Re: [HELP]Aheal cmd - by [Aka]Dragonu - 02.09.2011, 07:58
Re: [HELP]Aheal cmd - by Speed - 02.09.2011, 08:24
Re: [HELP]Aheal cmd - by [Aka]Dragonu - 02.09.2011, 08:27
Re: [HELP]Aheal cmd - by Sasino97 - 02.09.2011, 08:36

Forum Jump:


Users browsing this thread: 1 Guest(s)