Entering Buildings - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Entering Buildings (
/showthread.php?tid=89685)
Entering Buildings -
Sal_Kings - 03.08.2009
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;
}
Re: Entering Buildings -
xCoder - 03.08.2009
you should use isplayerinarea
Re: Entering Buildings -
WrathOfGenesis - 03.08.2009
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
}