Working on GetPlayerID and SetPlayerID functions! Need help!
#1

Hey, I'm working on GetPlayerID and SetPlayerID functions.
I need all the help aviable to make it work.

Here is what I have done so far:
Evrything is untested. (At least no errors while compiling)

pawn Код:
stock GetPlayerID(playerid)
{
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  GetIDFromName(pName);
  return pName;
}
pawn Код:
stock GetIDFromName(string[])
{
  for(new i = 0; i <= MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i) == 1)
    {
      new tName[MAX_PLAYER_NAME];
      GetPlayerName(i, tName, sizeof(tName));
      if(strcmp(tName, string, true, strlen(string)) == 0)
      {
        return i;
      }
    }
  }
  return INVALID_PLAYER_ID;
}
Reply


Messages In This Thread
Working on GetPlayerID and SetPlayerID functions! Need help! - by bajskorv123 - 13.02.2010, 15:01
Re: Working on GetPlayerID and SetPlayerID functions! Need help! - by Joe Staff - 13.02.2010, 15:11
Re: Working on GetPlayerID and SetPlayerID functions! Need help! - by maramizo - 26.02.2011, 11:27

Forum Jump:


Users browsing this thread: 1 Guest(s)