NPC Pos
#1

Hello

I have a npc in my server i wanna make this code work.
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,2.0, x, y, z ))
    {
        if (strfind(text, "browse") != -1)
        {
ShowPlayerDialog(playerid, DIALOG_WP, DIALOG_STYLE_LIST, "Weapon Spawner", "Grenade ($1000)\nColt 45 ($1000)\nColt 45 (Silenced) ($1000)\nDesert Eagle (1000$)\nNormal Shotgun (1000$)\nSawnoff Shotgun (1000$)\nCombat Shotgun (1000$)\nMicro Uzi (Mac 10) (1000$)\nMP5 (1000$)\nAK47 (1000$)\nM4A1 (1000$)\nTec9 (1000$)\nCountry Rifle (1000$)\nSniper Rifle (1000$)\nRocket Launcher (100000$)\nHeat-Seeking Rocket Launcher (100000$)\nFlamethrower (1000$)", "Purchase", "Cancel");
}
 return 1;
    }
I dont know how to get npc pos.

I want this text should work if player is in range of npc.

Npc name is drugdealer if you can get his id and then pos.

Please leave the code.
Reply
#2

Do you mean you want to know how to activate the NPC ?
Reply
#3

Not to activate the NPC i want that when player is in range of npc and say browse the weapon dialog wil pop up bt i am not able to find the code for detecting npc pos
Reply
#4

See this: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

IF i helped "+REP" me and thanks

i can make it you by the way if you don't understand it
Reply
#5

I know that but how to get npc location and put it for range
Reply
#6

Get the location's FLOAT:X, FLOAT:Y and FLOAT:Z
Reply
#7

Yeah but how to get location for NPC
Reply
#8

pawn Код:
if(GetNPCPos(playerid, x, y, z ))
    {
         if(IsPlayerInRangeOfPoint(playerid, x, y ,z))
                {
        if (strfind(text, "browse") != -1)
        {
ShowPlayerDialog(playerid, DIALOG_WP, DIALOG_STYLE_LIST, "Weapon Spawner", "Grenade ($1000)\nColt 45 ($1000)\nColt 45 (Silenced) ($1000)\nDesert Eagle (1000$)\nNormal Shotgun (1000$)\nSawnoff Shotgun (1000$)\nCombat Shotgun (1000$)\nMicro Uzi (Mac 10) (1000$)\nMP5 (1000$)\nAK47 (1000$)\nM4A1 (1000$)\nTec9 (1000$)\nCountry Rifle (1000$)\nSniper Rifle (1000$)\nRocket Launcher (100000$)\nHeat-Seeking Rocket Launcher (100000$)\nFlamethrower (1000$)", "Purchase", "Cancel");
}
}
 return 1;
    }
Reply
#9

Not working anyone please help fast
Reply
#10

Why ? where are the errors if it is not working ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)