SA-MP Forums Archive
/enter and /exit again - 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: /enter and /exit again (/showthread.php?tid=75349)



/enter and /exit again - kevin13 - 01.05.2009

How can i do this that i don't have do write /enter do go in a house, i just go near the door and it automatically goes in? and if i go near the door inside the house it goes outside again


Re: /enter and /exit again - HB - 01.05.2009

I'd advise you to do that with pickups. Requires alot of work though.


Re: /enter and /exit again - kevin13 - 01.05.2009

But can you do the code or something how do start with it?
I have no idea how to do that right now


Re: /enter and /exit again - [SaRp]Ryder - 01.05.2009

try an easy command with not so much variables .. like

if(strcmp(cmd,"/enter",true ) == 0 ) }
if(playertopoint bla bla ) {
SetPlayerPos(bla bla
SetPlayerInterior
}
if(playertopoint bla bla ) {
SetPlayerPos(bla bla
SetPlayerInterior
return 1; }

try to make it work because i just gave you an ideea ... i used this many times for my server and it was great


Re: /enter and /exit again - afei - 01.05.2009

Quote:
Originally Posted by [SaRp
Ryder ]
try an easy command with not so much variables .. like

if(strcmp(cmd,"/enter",true ) == 0 ) }
if(playertopoint bla bla ) {
SetPlayerPos(bla bla
SetPlayerInterior
}
if(playertopoint bla bla ) {
SetPlayerPos(bla bla
SetPlayerInterior
return 1; }

try to make it work because i just gave you an ideea ... i used this many times for my server and it was great
Thought he wants it to work without typing a command.
Create a timer which checks whether a player is at a house door or not. If the player is change his interior, his pos and w/e you also want to be changed.


Re: /enter and /exit again - kevin13 - 01.05.2009

Anyone? Please help


Re: /enter and /exit again - Bearfist - 01.05.2009

Put this on top:

Код:
new EnterHouse;
forward AreaCheck(playerid);
This in On Gamemode Init:
Код:
EnterHouse = SetPlayerTimer("AreaCheck",1000,1);
This in OnGamemodeExit
Код:
Killtimer(AreaCheck);
An this out of a Function:
Код:
IsPlayerInArea(playerid, Float:X1, Float:X2, Float:Y1, Float:Y2)
{
	new Float:X, Float:Y, Float:Z;
	if(X1 > X2) { X = X2; X2 = X1; X1 = X; }
	if(Y1 > Y1) { Y = Y2; Y2 = Y1; Y1 = Y; }
	GetPlayerPos(playerid, X, Y, Z);
	if((X1 < X && X < X2) && (Y1 < Y && Y < Y2)) return 1;
	return 0;
}

public AreaCheck(playerid)
{
	for(new i=0; i<MAX_PLAYERS; i++ )
	{
		if(!IsPlayerConnected(i)) continue;
		if(IsPlayerInArea(i, 1923.388, 2847.478,-1930.57,-1492.37)) // here put in your coords it works like XMIN, XMAX,YMIN,YMAX
		{
		//Put here what the player have to do ... in your way a enter command ...but i don't know it
		}
	}
}
Bearfist