NPC doesent move?
#3

it is defined, I am using the intelliNPC and its name is still michael
On top of OnPlayerCommandText:
pawn Код:
new npcid = GetPlayerID("Michael");
GetPlayerID function:
pawn Код:
stock GetPlayerID(const playername[], partofname=0)
{
    new i;
    new playername1[64];
    for (i=0;i<MAX_PLAYERS;i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i,playername1,sizeof(playername1));
            if (strcmp(playername1,playername,true)==0)
            {
                return i;
            }
        }
    }
    new correctsigns_userid=-1;
    new tmpuname[128];
    new hasmultiple=-1;
    if(partofname)
    {
        for (i=0;i<MAX_PLAYERS;i++)
        {
            if (IsPlayerConnected(i))
            {
                GetPlayerName(i,tmpuname,sizeof(tmpuname));

                if(!strfind(tmpuname,playername1[partofname],true, 0))
                {
                    hasmultiple++;
                    correctsigns_userid=i;
                }
                if (hasmultiple>0)
                {
                    return -2;
                }
            }
        }
    }
    return correctsigns_userid;
}
Reply


Messages In This Thread
NPC doesent move? - by Everybody - 27.10.2011, 07:53
Re: NPC doesent move? - by [MWR]Blood - 27.10.2011, 08:26
Re: NPC doesent move? - by Everybody - 27.10.2011, 08:32

Forum Jump:


Users browsing this thread: 1 Guest(s)