SA-MP Forums Archive
Auto gate close. - 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: Auto gate close. (/showthread.php?tid=94978)



Auto gate close. - balisticore - 02.09.2009

Okay i;ve look in the Search, i've looked at the auto gate topic on wiki.. and yet it still does not make sence to me, so can sum one please help me..

here my code to open the gate.. i need sum one to tell me how to set it up so after 5 seconds it will auto close....

Код:
 if (strcmp("/hqopen", cmdtext, true, 10) == 0) // OPENS GATE
  		{
  		if (PlayerToPoint(20.00, playerid, 785.547, -1152.5, 25.3229))
  		{
  		MoveObject(gate1,785.547, -1152.5, 31.1229, 2.0);
  		SendClientMessage(playerid, 0xFFFFFFAA, "Tea House Gate Is Now Opening");
	}
		else
	{
  		SendClientMessage(playerid, 0xf01818FF, "Sorry, To Far Away To Open Tea House Gate");
	}
  	return 1;
	}



Re: Auto gate close. - Battleman93 - 17.11.2009

All about the timer<

Код:
//on top of your script
forward CloseGate();

//on OnPlayerCommandText
if (strcmp("/hqopen", cmdtext, true, 10) == 0) // OPENS GATE
{
  	if (PlayerToPoint(20.00, playerid, 785.547, -1152.5, 25.3229))
  	{
  		MoveObject(gate1,785.547, -1152.5, 31.1229, 2.0);
  		SendClientMessage(playerid, 0xFFFFFFAA, "Tea House Gate Is Now Opening");
         SetTimer("CloseGate", 5000, false);

	}
	else
	{
  		SendClientMessage(playerid, 0xf01818FF, "Sorry, To Far Away To Open Tea House Gate");
	}
  	return 1;
}

// At a place in your script..
public CloseGate()
{
	MoveObject(gate1, X,Y,Z, 2.0); // gate close pos
	return 1;
}



Re: Auto gate close. - Stefan-Holland - 28.02.2010

what include?