29.03.2016, 20:28
Hi!
I hope this is that what you want.
I hope this is that what you want.
PHP код:
//global:
new object,bool:gateOpen;
//OnGameModeInit:
object = CreateObject(985,1545.1000000,-1627.6000000,14.1000000,0.0000000,0.0000000,90.000 0000);
//OnGameModeInit:
SetTimer("OpenGateAuto",1000,1);
//callback #1:
forward OpenGateAuto();
public OpenGateAuto()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i))continue;
if(SpielerInfo[i][Fraction] != 1 || SpielerInfo[i][Fraction] != 2)continue;//fraction query; you can optimized this
if(gateOpen == true)break;
MoveObject(object, 1545.1000000, -1620.1000000, 14.1000000, 1.0);
gateOpen = true;
SetTimer("CloseGateAuto",1000,1);
}
return 1;
}
//callback #2:
forward CloseGateAuto();
public CloseGateAuto()
{
MoveObject(object, 1545.1000000,-1627.6000000,14.1000000, 1.0);
gateOpen = false;
return 1;
}