Help with player in range of NPC.
#8

pawn Код:
GetNPCID(npcName[MAX_PLAYER_NAME], bool: ignorecase = false)
{
    new npcid = INVALID_PLAYER_ID, npcNameEx[MAX_PLAYER_NAME];
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerNPC(i))
        {
            GetPlayerName(i, npcNameEx, MAX_PLAYER_NAME);
            if(!strcmp(npcName, npcNameEx, ignorecase))
            {
                npcid = i;
                break;
            }
        }
    }

    return npcid;
}

new Float: npcPos[3];
GetPlayerPos(GetNPCID("YOUR NPC NAME", true), npcPos[0], npcPos[1], npcPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 2.0, npcPos[0], npcPos[1], npcPos[2]))
{
    if(strfind(text, "browse") > -1)
    {
        ShowPlayerDialog(playerid, CmdsMenu, DIALOG_STYLE_LIST, "Weapons:","1): UZI, nAK-47, Spray Paint\n2): Tec9, M4, Fire Extinguer\n3): Sniper Rifle, Knife, Silenced Pistol\n4): Deagle, MP5, Sawnoff Shotgun\n5): Parachute", "OK", "ESC");
    }

    return 1;
}
Make sure to replace 'YOUR NPC NAME'.
Reply


Messages In This Thread
Help with player in range of NPC. - by Black Wolf - 24.08.2012, 16:44
Re: Help with player in range of NPC. - by Jstylezzz - 24.08.2012, 16:52
Re: Help with player in range of NPC. - by Black Wolf - 25.08.2012, 03:43
Re: Help with player in range of NPC. - by Black Wolf - 25.08.2012, 11:16
Re: Help with player in range of NPC. - by ikkentim - 25.08.2012, 11:25
Re: Help with player in range of NPC. - by Black Wolf - 25.08.2012, 11:27
Re: Help with player in range of NPC. - by Black Wolf - 26.08.2012, 02:42
Re: Help with player in range of NPC. - by SuperViper - 26.08.2012, 04:12

Forum Jump:


Users browsing this thread: 3 Guest(s)