SA-MP Forums Archive
Player Near Pickup - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player Near Pickup (/showthread.php?tid=640405)



Player Near Pickup - Hiei - 02.09.2017

Nah, in my code door/house, i want when player near pickup, and type /enter
Player will teleporting to any position
How to do this ?


Re: Player Near Pickup - Zeth - 02.09.2017

You should have read wiki.sa-mp.com before posting threads, By the way here is the link OnPlayerPickUpPickup

and same works with dynamicpickups too.


Re: Player Near Pickup - Fungi - 02.09.2017

Код:
CMD:enter(playerid,params[])
{
  if(IsPlayerInRangeOfPoint(playerid,.....))
 {
     SetPlayerPos(playerid);
...............

 }
}



Re: Player Near Pickup - kAn3 - 02.09.2017

You can use this code (if you are using ZCMD)

Код:
CMD:enter(playerid, params[])
{
    // You need here the coordinates (X, Y and Z) of the door
    // The 2nd parameter after "playerid" is the range, 
    // if the player is out of that range,
    // (in this case 5) the command won't work
    if(IsPlayerInRangeOfPoint(playerid, 5, X , Y , Z))
    {
        // Now you need here the X Y and Z coordinates of the house point where the player will be teleported
        // You will need the interior too, either the player will fall in the sky!
        SetPlayerPos(playerid, X, Y, Z); 
        SetPlayerInterior(playerid, HouseInterior);
        SendClientMessage(playerid, -1, "{f0f0f0}You entered the house!");
    }
    else return SendClientMessage(playerid, -1, "{ff0000} You aren't near the door!"); //Player is not at the door
return 1;
}
Tip: Use any map editor to have the coordinates and interior of houses.

Anyways, always check the wiki first, here is the page about the IsPlayerInRangeOfPoint function, and good luck.


Re: Player Near Pickup - Hiei - 02.09.2017

So This is OnPlayerPickUpPickup
or
IsPlayerInRangeOfPoint


Re: Player Near Pickup - kAn3 - 02.09.2017

If you want to use the command /enter then use IsPlayerInRangeOfPoint, else if you want to use the pickup, use OnPlayerPickUpPickup. Your choice