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
#2

Quote:
Originally Posted by Seif_
What would SetPlayerID do?
Not work.



GetPlayerID seems, in itself, redundant. All it's doing is using GetPlayerName, so by using this function you're not really saving yourself any CPU time.
What exactly do you mean by SetPlayerID? It's going to change their name? Or is it going to change their place on the server? If it's the latter then you're not going to be getting anywhere with it.
Reply
#3

Why would anyone want to set a player's ID?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)