SA-MP Forums Archive
How to script a HQ/EnterableHouse. {Give A Tutorial Please} - 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: How to script a HQ/EnterableHouse. {Give A Tutorial Please} (/showthread.php?tid=155578)



How to script a HQ/EnterableHouse. {Give A Tutorial Please} - watzab - 19.06.2010

Hello, i got a roleplay server. i want script an HQ, not a buyable house. Just a icon when i press enter it enters the house
Please help me, please tell how i do this, Thank you.



Re: How to script a HQ/EnterableHouse. {Give A Tutorial Please} - Ihsan_Cingisiz - 19.06.2010

Quote:
Originally Posted by watzab
Hello, i got a roleplay server. i want script an HQ, not a buyable house. Just a icon when i press enter it enters the house
Please help me, please tell how i do this, Thank you.
Here you go.

First we make a PickUp in the front of the door.
Quote:

CreatePickup(1239, 2, [HQ Door Position], -1);

And we make a /enter command to enter if the player is near the door.
Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, [Position])
SetPlayerInterior(playerid, [Interior of the HQ]);
SetPlayerPos(playerid, [Player Position in the HQ]);
return 1;
}
return SendClientMessage(playerid, COLOR_GREY, "* There is no door in range to enter.");
}

And a little /exit command for you.
Quote:

if(strcmp("/exit", cmdtext, true, 6) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, [By the door Inside the HQ position])) {
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, [Position for in front of the door out of the HQ]);
return 1;
}
return SendClientMessage(playerid, COLOR_GREY, "* There is no door in range to exit.");
}

I hope this will help you