Guest User

ReturnUser

a guest
Nov 25th, 2012
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.69 KB | None | 0 0
  1. ReturnUser(text[])
  2. {
  3.     new pos = 0;
  4.     while (text[pos] < 0x21)
  5.     {
  6.         if (text[pos] == 0) return INVALID_PLAYER_ID;
  7.         pos++;
  8.     }
  9.     new userid = INVALID_PLAYER_ID;
  10.     if (IsNumeric(text[pos]))
  11.     {
  12.         userid = strval(text[pos]);
  13.         if (userid >=0 && userid < MAX_PLAYERS)
  14.         {
  15.             if(!IsPlayerConnected(userid))
  16.             {
  17.                 userid = INVALID_PLAYER_ID;
  18.             }
  19.             else
  20.             {
  21.                 return userid;
  22.             }
  23.         }
  24.     }
  25.     new giveid;
  26.     new GetPlayer[256];
  27.     for (giveid=0; giveid<=MAX_PLAYERS; giveid++)
  28.     {
  29.         if (IsPlayerConnected(giveid))
  30.         {
  31.             GetPlayerName(giveid,GetPlayer,16);
  32.             new space = (strfind(GetPlayer, text,true));
  33.             if (space != -1)
  34.             {
  35.                 return giveid;
  36.             }
  37.         }
  38.     }
  39.     return userid;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment