CMD:test(playerid,params[]) { newFloat:X,Float:Y,Float:Z; GetPlayerPos(npcid,X,Y,Z); if(IsPlayerInRangeOfPoint(playerid,5.0,X,Y,Z)) { // The player is near the specified NPC, do your stuff here. } return1; }
Of course range can be whatever you want it to be, I just set it to 5.0 here for the example.
Needless to say you need to know the player id of the NPC, denoted as 'npcid' in the example above.