Player Near Pickup
#1

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 ?
Reply
#2

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.
Reply
#3

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

 }
}
Reply
#4

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.
Reply
#5

So This is OnPlayerPickUpPickup
or
IsPlayerInRangeOfPoint
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)