Why doesn't this function work?
#1

pawn Код:
stock GetPlayerIDFromName(playername[])
{
    new name[255];
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      GetPlayerName(i,name,sizeof(name));
      if(strcmp(playername, name, false) == 0)
      {
        return i;
      }
    }
  }
  return INVALID_PLAYER_ID;
}
forward AddNPC(name[64], skin, Float:x, Float:y, Float:z, Float:angle);
public AddNPC(name[64], skin, Float:x, Float:y, Float:z, Float:angle)
{
  ConnectNPC(name,"npcidle"); //npcidle is just a blank script default with the 0.3 package.
  new npcid = GetPlayerIDFromName(name);
  SetSpawnInfo(npcid, 0, skin, x, y, z, angle, 0, 0, 0, 0, 0, 0);
  return 1;
}
AddNPC is the function that doesn't work, GetPlayerIDFromName works fine.

NPC connects to the server, but he's not ingame. Any ideas?
Reply


Messages In This Thread
Why doesn't this function work? - by Norn - 05.09.2009, 04:36
Re: Why doesn't this function work? - by Zezombia - 05.09.2009, 04:41
Re: Why doesn't this function work? - by Norn - 05.09.2009, 04:45
Re: Why doesn't this function work? - by Zezombia - 05.09.2009, 05:02
Re: Why doesn't this function work? - by Norn - 05.09.2009, 05:35
Re: Why doesn't this function work? - by Zezombia - 05.09.2009, 05:38
Re: Why doesn't this function work? - by Norn - 05.09.2009, 06:00

Forum Jump:


Users browsing this thread: 1 Guest(s)