Entering Buildings
#1

Dose anyone mind explaining this script?!



Code:
if(strcmp(cmd, "/enter", true) == 0)
	{
	if(PlayerToPoint(5.0,playerid, x,y,z) || PlayerToPoint(5.0,playerid, x,y,z) || PlayerToPoint(5.0,playerid, x,y,z))
	{
	  SetPlayerPos(playerid, interior:x,interior:y,interior:z);
	}
	else
	{
		SendClientMessage(playerid, COLOR_BLUE,"You must be at a house entrance to enter.");
	}
	return 1;
	}
Reply
#2

you should use isplayerinarea
Reply
#3

pawn Code:
if(strcmp(cmd, "/enter", true) == 0)  // Checks if the string "cmd" is equal to "/enter".
{
  if(PlayerToPoint(5.0,playerid, x,y,z) || PlayerToPoint(5.0,playerid, x,y,z) || PlayerToPoint(5.0,playerid, x,y,z))   // A custom function to get the distance between a player and a coordinate.
  {
    SetPlayerPos(playerid, interior:x,interior:y,interior:z); // Sets a players position because he is close enough to the above coordinate
  }
  else
  {
    SendClientMessage(playerid, COLOR_BLUE,"You must be at a house entrance to enter.");  // Sends the player a message to inform them they are not close enough
  }
  return 1;  // Tells the script to end the function here
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)