Gates Problem -
wilko1995 - 18.05.2012
Код:
new FBIgate1, FBIgate2, FBIgate3;
new g1o, g2o, g3o, g1c, g2c, g3c;
FilterScriptInit_FBI()
{
CreateObject(987, 1583.73, -1313.23, 16.07, 0.00, 0.00, 180.33);
CreateObject(987, 1571.79, -1313.26, 16.08, 0.00, 0.00, -180.12);
CreateObject(987, 1559.81, -1313.21, 15.35, 0.00, 0.00, -179.88);
CreateObject(987, 1547.85, -1313.27, 14.77, 0.00, 0.00, 179.48);
CreateObject(987, 1535.87, -1313.23, 14.25, 0.00, 0.00, 179.65);
CreateObject(987, 1523.82, -1313.15, 13.85, 0.00, 0.00, 179.74);
CreateObject(987, 1503.73, -1313.20, 13.15, 0.00, 0.00, 178.27);
CreateObject(987, 1594.86, -1308.91, 16.10, 0.00, 0.00, 201.71);
CreateObject(987, 1594.87, -1324.58, 16.45, 0.00, 0.00, 69.57);
CreateObject(987, 1594.65, -1336.58, 16.47, 0.00, 0.00, 89.28);
CreateObject(987, 1594.18, -1348.52, 15.59, 0.00, 0.00, 87.66);
CreateObject(987, 1593.77, -1360.45, 14.69, 0.00, 0.00, 87.71);
CreateObject(987, 1593.09, -1372.38, 13.82, 0.00, 0.00, 86.51);
CreateObject(987, 1593.00, -1384.30, 13.43, 0.00, 0.00, 89.58);
CreateObject(987, 1585.03, -1393.15, 13.16, 0.00, 0.00, 48.06);
CreateObject(987, 1569.65, -1405.59, 12.95, 0.00, 0.00, 33.40);
FBIgate3 = CreateObject(986, 1582.39, -1396.11, 14.65, 0.00, 0.00, -132.18);
FBIgate2 = CreateObject(986, 1507.83, -1312.95, 14.56, 0.00, 0.00, 359.25);
FBIgate1 = CreateObject(986, 1594.76, -1313.24, 18.07, 0.00, 0.00, 310.74);
SetTimer("Point", 10, true);
g1o = 0;
g1c = 1;
g2o = 0;
g2c = 1;
g3o = 0;
g3c = 1;
}
forward Point(playerid);
public Point(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 30.0, 1582.05, -1396.40, 13.01))
{
if(g3c == 1)
{
MoveObject(FBIgate3, 1581.88, -1390.51, 14.65, 5, 0.0, 0.0, 137.96);
g3o = 1;
g3c = 0;
}
}
if(GetPlayerDistanceFromPoint(i, 1582.05, -1396.40, 13.01) >= 30.0)
{
if(g3o == 1)
{
MoveObject(FBIgate3, 1582.39, -1396.11, 14.65, 5, 0.00, 0.00, -132.18);
g3o = 0;
g3c = 1;
}
}
if(GetPlayerDistanceFromPoint(i, 1507.85, -1312.98, 13.74) >= 30.0)
{
if(g2o == 1)
{
MoveObject(FBIgate2, 1507.83, -1312.95, 14.56, 5, 0.00, 0.00, 359.25);
g2o = 0;
g2c = 1;
}
}
if(IsPlayerInRangeOfPoint(i, 30.0, 1507.85, -1312.98, 13.74))
{
if(g2c == 1)
{
MoveObject(FBIgate2, 1503.47, -1316.99, 14.56, 5, 0.0, 0.0, 264.33);
g2o = 1;
g2c = 0;
}
}
if(IsPlayerInRangeOfPoint(i, 30.0, 1594.55, -1313.20, 16.45))
{
if(g1c == 1)
{
MoveObject(FBIgate1, 1588.82, -1312.25, 18.07, 5, 0.0, 0.0, 206.24);
g1o = 1;
g1c = 0;
}
}
if(GetPlayerDistanceFromPoint(i, 1594.55, -1313.20, 16.45) >= 30.0)
{
if(g1o == 1)
{
MoveObject(FBIgate1, 1594.76, -1313.24, 18.07, 5, 0.00, 0.00, 310.74);
g1o = 0;
g1c = 1;
}
}
}
return 1;
}
My problem is that it doesnt open for everyone, only one person... please help
Re: Gates Problem -
milanosie - 18.05.2012
Kinda obvious,
Why do you even use a loop trough all players?
Re: Gates Problem -
wilko1995 - 18.05.2012
i had it as playerid, but it was same problem
Re: Gates Problem -
milanosie - 18.05.2012
dont use the if(IsDistanceto Point thingy
Re: Gates Problem -
wilko1995 - 18.05.2012
Код:
new FBIgate1, FBIgate2, FBIgate3;
FilterScriptInit_FBI()
{
CreateObject(987, 1583.73, -1313.23, 16.07, 0.00, 0.00, 180.33);
CreateObject(987, 1571.79, -1313.26, 16.08, 0.00, 0.00, -180.12);
CreateObject(987, 1559.81, -1313.21, 15.35, 0.00, 0.00, -179.88);
CreateObject(987, 1547.85, -1313.27, 14.77, 0.00, 0.00, 179.48);
CreateObject(987, 1535.87, -1313.23, 14.25, 0.00, 0.00, 179.65);
CreateObject(987, 1523.82, -1313.15, 13.85, 0.00, 0.00, 179.74);
CreateObject(987, 1503.73, -1313.20, 13.15, 0.00, 0.00, 178.27);
CreateObject(987, 1594.86, -1308.91, 16.10, 0.00, 0.00, 201.71);
CreateObject(987, 1594.87, -1324.58, 16.45, 0.00, 0.00, 69.57);
CreateObject(987, 1594.65, -1336.58, 16.47, 0.00, 0.00, 89.28);
CreateObject(987, 1594.18, -1348.52, 15.59, 0.00, 0.00, 87.66);
CreateObject(987, 1593.77, -1360.45, 14.69, 0.00, 0.00, 87.71);
CreateObject(987, 1593.09, -1372.38, 13.82, 0.00, 0.00, 86.51);
CreateObject(987, 1593.00, -1384.30, 13.43, 0.00, 0.00, 89.58);
CreateObject(987, 1585.03, -1393.15, 13.16, 0.00, 0.00, 48.06);
CreateObject(987, 1569.65, -1405.59, 12.95, 0.00, 0.00, 33.40);
FBIgate3 = CreateObject(986, 1582.39, -1396.11, 14.65, 0.00, 0.00, -132.18);
FBIgate2 = CreateObject(986, 1507.83, -1312.95, 14.56, 0.00, 0.00, 359.25);
FBIgate1 = CreateObject(986, 1594.76, -1313.24, 18.07, 0.00, 0.00, 310.74);
SetTimer("Point", 10, true);
}
forward Point(playerid);
public Point(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1582.05, -1396.40, 13.01))
{
MoveObject(FBIgate3, 1581.88, -1390.51, 14.65, 5, 0.0, 0.0, 137.96);
}
else
{
MoveObject(FBIgate3, 1582.39, -1396.11, 14.65, 5, 0.00, 0.00, -132.18);
}
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1507.85, -1312.98, 13.74))
{
MoveObject(FBIgate2, 1503.47, -1316.99, 14.56, 5, 0.0, 0.0, 264.33);
}
else
{
MoveObject(FBIgate2, 1507.83, -1312.95, 14.56, 5, 0.00, 0.00, 359.25);
}
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1594.55, -1313.20, 16.45))
{
MoveObject(FBIgate1, 1588.82, -1312.25, 18.07, 5, 0.0, 0.0, 206.24);
}
else
{
MoveObject(FBIgate1, 1594.76, -1313.24, 18.07, 5, 0.00, 0.00, 310.74);
}
return 1;
}
i have this now
Re: Gates Problem -
milanosie - 18.05.2012
Better add the
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1582.05, -1396.40, 13.01))
{
MoveObject(FBIgate3, 1581.88, -1390.51, 14.65, 5, 0.0, 0.0, 137.96);
}
else
{
MoveObject(FBIgate3, 1582.39, -1396.11, 14.65, 5, 0.00, 0.00, -132.18);
}
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1507.85, -1312.98, 13.74))
{
MoveObject(FBIgate2, 1503.47, -1316.99, 14.56, 5, 0.0, 0.0, 264.33);
}
else
{
MoveObject(FBIgate2, 1507.83, -1312.95, 14.56, 5, 0.00, 0.00, 359.25);
}
if(IsPlayerInRangeOfPoint(playerid, 30.0, 1594.55, -1313.20, 16.45))
{
MoveObject(FBIgate1, 1588.82, -1312.25, 18.07, 5, 0.0, 0.0, 206.24);
}
else
{
MoveObject(FBIgate1, 1594.76, -1313.24, 18.07, 5, 0.00, 0.00, 310.74);
}
return 1;
At a TimerEx instead of a global timer
Re: Gates Problem -
wilko1995 - 18.05.2012
TimerEx, do you mean SetTimerEx? and dont they both have to be public
Re: Gates Problem -
milanosie - 18.05.2012
SetTimerEx is playerbased (in most cases)
And since your public point uses playerid your better of using a timerEx for every single player
Re: Gates Problem -
wilko1995 - 18.05.2012
but where do i call the timer? and do i do SetTimerEx("Point", 10, true, "d", playerid); ?
Re: Gates Problem -
milanosie - 18.05.2012
After I thought about it, its better you place it at OnPlayerUpdate instead of a timer,
And use a variable to check it the gates are already openned or not