05.09.2009, 04:36
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;
}
NPC connects to the server, but he's not ingame. Any ideas?