All pastes #549337 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-08 02:41 UTC
rendered paste body
stock FindUser(pname[])
{
    for(new s=0; s<strlen(pname); s++) // loop through the length of pname
    if(pname[s] > '9' && pname[s] < '0') return strval(pname); // he gave us an id, return him the id
    new name[24]; // create variables to store data in
    for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) // loop through all players and then check if they connected.
    {
          GetPlayerName(i,name,24); // get the player's name
          if(strfind(name, pname, true) == 0) return i; // set the var to record number of hits we get
    }
    return -1; // if it gets too here, we have no match.
}