/enter and /exit again
#1

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

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

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

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

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

Anyone? Please help
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)