19.12.2016, 15:10
So the problem is this that my loop for gate works only for one id. Can someone help me?
PHP код:
forward GateCheck();
public GateCheck()
{
foreach(Player, i) if(pInfo[i][gTeam] != ROBBERS || pInfo[i][pLevel] >= 2)
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 6.0, 1544.68457, -1630.92615, 13.12690))
{
if(pInfo[i][gTeam] != LSPD) continue;
if(pInfo[i][gTeam] == LSPD)
{
if(gStatus == false)
{
SetObjectRot(pgate, -4.26000, 1.49999, 90.00000);
gStatus = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 1544.68457, -1630.92615, 13.12690))
{
if(gStatus == true)
{
SetObjectRot(pgate, 0.24000, 90.24000, 90.00000);
gStatus = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 1587.3921,-1637.1376,13.3828))
{
if(pInfo[i][gTeam] != LSPD) continue;
if(pInfo[i][gTeam] == LSPD)
{
if(gStatus21 == false)
{
MoveObject(pgate2, 1580.91174, -1637.88550, 15.04516,2.9);
gStatus21 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 1587.3921,-1637.1376,13.3828))
{
if(gStatus21 == true)
{
MoveObject(pgate2, 1582.39185, -1637.88367, 15.0422,2.9);
gStatus21 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 1596.15857, -1637.88367, 15.23570))
{
if(pInfo[i][gTeam] != LSPD) continue;
if(pInfo[i][gTeam] == LSPD)
{
if(gStatus22 == false)
{
MoveObject(pgate3, 1596.15857, -1637.88367, 9.59650,2.9);
gStatus22 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 1596.15857, -1637.88367, 15.23570))
{
if(gStatus22 == true)
{
MoveObject(pgate3, 1596.15857, -1637.88367, 15.23570,2.9);
gStatus22 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 1262.8844,-2047.8555,59.3449))
{
if(pInfo[i][pLevel] < 2) continue;
if(pInfo[i][pLevel] >= 2)
{
if(gStatus11 == false)
{
MoveObject(adgate, 1264.16260, -2048.58862, 55.25351,2.9);
gStatus11 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 1262.8844,-2047.8555,59.3449))
{
if(gStatus11 == true)
{
MoveObject(adgate, 1264.16260, -2048.58862, 60.83170,2.9);
gStatus11 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 1133.2192,-2080.8923,69.5591))
{
if(pInfo[i][pLevel] < 2) continue;
if(pInfo[i][pLevel] >= 2)
{
if(gStatus12 == false)
{
MoveObject(adgate2, 1133.51819, -2081.30493, 65.25336,2.9);
gStatus12 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 11133.2192,-2080.8923,69.5591))
{
if(gStatus12 == true)
{
MoveObject(adgate2, 1133.51819, -2081.30493, 70.72000,2.9);
gStatus12 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 2606.91016, -2401.92139, 15.22000))
{
if(pInfo[i][gTeam] != Army) continue;
if(pInfo[i][gTeam] == Army)
{
if(gStatus3 == false)
{
MoveObject(agate, 2606.91016, -2401.92139, 20.68000,2.9);
gStatus3 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0,2606.91016, -2401.92139, 15.22000))
{
if(gStatus3 == true)
{
MoveObject(agate, 2606.91016, -2401.92139, 15.22000,2.9);
gStatus3 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 2666.26099, -2504.07373, 15.24000))
{
if(pInfo[i][gTeam] != Army) continue;
if(pInfo[i][gTeam] == Army)
{
if(gStatus20 == false)
{
MoveObject(agate2, 2666.26099, -2504.07373, 20.68000,2.9);
gStatus20 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0,2666.26099, -2504.07373, 15.24000))
{
if(gStatus20 == true)
{
MoveObject(agate2, 2666.26099, -2504.07373, 15.24000,2.9);
gStatus20 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0,1027.43433, -368.46509, 75.28000))
{
if(pInfo[i][gTeam] != SWAT) continue;
if(pInfo[i][gTeam] == SWAT)
{
if(gStatus4 == false)
{
MoveObject(sgate, 1027.43433, -368.46509, 80.76000,2.9);
gStatus4 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0,1027.43433, -368.46509, 75.28000))
{
if(gStatus4 == true)
{
MoveObject(sgate, 1027.43433, -368.46509, 75.28000,2.9);
gStatus4 = false;
}
}
if(IsPlayerInRangeOfPoint(i, 6.0, 2440.59521, -969.13348, 80.70480))
{
if(pInfo[i][gTeam] != Terrorist) continue;
if(pInfo[i][gTeam] == Terrorist)
{
if(gStatus6 == false)
{
MoveObject(tgate, 2440.59521, -969.13348, 86.16000,2.9);
gStatus6 = true;
}
}
}
if(!IsPlayerInRangeOfPoint(i, 6.0, 2440.59521, -969.13348, 80.70480))
{
if(gStatus6 == true)
{
MoveObject(tgate, 2440.59521, -969.13348, 80.70480,2.9);
gStatus6 = false;
}
}
}
return 1;
}