Why does this only work for the highest player ID?
#1

pawn Код:
if (gTeam[i] == LSPD1 || gTeam[i] == LSPD2 || gTeam[i] == SWAT || gTeam[i] == FBI || gTeam[i] == CIA || gTeam[i] == ARMY)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 1590.1999511719, -1638.0999755859, 15.300000190735)) //If they are near the point
                {
                    if(IsLSPDGateOpen == false)
                    {
                    MoveObject(LSPDGate, 1598.1999511719, -1637.9000244141, 15.300000190735, 5.0); //Open Position
                    IsLSPDGateOpen = true;
                    }
                }
                else
                {
                    if(IsLSPDGateOpen == true)
                    {
                    MoveObject(LSPDGate, 1590.1999511719, -1638.0999755859, 15.300000190735, 5.0); //Back to closed position
                    IsLSPDGateOpen = false;
                    }
                }
            }
Reply
#2

I can't see anything weird in this code, rather show us some code which shows the loop line
Reply
#3

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (gTeam[i] == LSPD1 || gTeam[i] == LSPD2 || gTeam[i] == SWAT || gTeam[i] == FBI || gTeam[i] == CIA || gTeam[i] == ARMY)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 1590.1999511719, -1638.0999755859, 15.300000190735)) //If they are near the point
                {
                    if(IsLSPDGateOpen == false)
                    {
                    MoveObject(LSPDGate, 1598.1999511719, -1637.9000244141, 15.300000190735, 5.0); //Open Position
                    IsLSPDGateOpen = true;
                    }
                }
                else
                {
                    if(IsLSPDGateOpen == true)
                    {
                    MoveObject(LSPDGate, 1590.1999511719, -1638.0999755859, 15.300000190735, 5.0); //Back to closed position
                    IsLSPDGateOpen = false;
                    }
                }
            }
}
Reply
#4

That is my loop line, I also gave it a try using foreach. Same thing.

for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
Reply
#5

Is this a command or a gatecheck timer?
also, by saying this only works for the highest player is it so that if you have 3 players, (0) Bob, (1) Hank, (2) Will
and these 3 are all in the LSPD1 team, it only works for Will?
Reply
#6

Yes it only works for will. It is a onesecond timer under which I do everything I need to have with a timer.
Reply
#7

You know I've seen glitches where it only works for id 0, but the highest player? Is there anything in your script that detects the highest playerid? Maybe that interferes.. if you don't know, I'm affraid you'll have to post your entire timer...
Reply
#8

As far as I am aware no there is not. I never had a reason to add that.
pawn Код:
forward Timex();
public Timex()
{
   foreach(Player, i)
    {
            //Gates Start
      if (gTeam[i] == LSPD1 || gTeam[i] == LSPD2 || gTeam[i] == SWAT || gTeam[i] == FBI || gTeam[i] == CIA || gTeam[i] == ARMY)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 1590.1999511719, -1638.0999755859, 15.300000190735)) //If they are near the point
                {
                    if(IsLSPDGateOpen == false)
                    {
                    MoveObject(LSPDGate, 1598.1999511719, -1637.9000244141, 15.300000190735, 5.0); //Open Position
                    IsLSPDGateOpen = true;
                    }
                }
                else
                {
                    if(IsLSPDGateOpen == true)
                    {
                    MoveObject(LSPDGate, 1590.1999511719, -1638.0999755859, 15.300000190735, 5.0); //Back to closed position
                    IsLSPDGateOpen = false;
                    }
                }
       }
            if (gTeam[i] == CIA)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 320.79998779297, -1487.9000244141, 28.200000762939)) //If they are near the point
                {
                    if(IsCIAGateOpen == false)
                    {
                    MoveObject(CIAGate, 314, -1482.8000488281, 28.200000762939, 5.0); //Open Position
                    IsCIAGateOpen = true;
                    }
                }
                else
                {
                    if(IsCIAGateOpen == true)
                    {
                    MoveObject(CIAGate, 320.79998779297, -1487.9000244141, 28.200000762939, 5.0); //Back to closed position
                    IsCIAGateOpen = false;
                    }
                }
            }
            if (gTeam[i] == CIA)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 282.79998779297, -1542.5999755859, 28.200000762939)) //If they are near the point
                {
                    if(IsCIAGate2Open == false)
                    {
                    MoveObject(CIAGate2, 275.60000610352, -1538.0999755859, 28.200000762939, 5.0); //Open Position
                    IsCIAGate2Open = true;
                    }
                }
                else
                {
                    if(IsCIAGate2Open == true)
                    {
                    MoveObject(CIAGate2, 282.79998779297, -1542.5999755859, 28.200000762939, 5.0); //Back to closed position
                    IsCIAGate2Open = false;
                    }
                }
            }
            if (gTeam[i] == ARMY)
            {
                if(IsPlayerInRangeOfPoint(i, 10, 2720, -2409.6000976563, 12.5)) //If they are near the point
                {
                    if(IsARMYGateOpen == false)
                    {
                    MoveObject(ARMYGate, 2719.6000976563, -2401.3999023438, 12.5, 5.0); //Open Position
                    IsARMYGateOpen = true;
                    }
                }
                else
                {
                    if(IsARMYGateOpen == true)
                    {
                    MoveObject(ARMYGate, 2720, -2409.6000976563, 12.5, 5.0); //Back to closed position
                    IsARMYGateOpen = false;
                    }
                }
            }
            if (gTeam[i] == ARMY)
            {
                if(IsPlayerInRangeOfPoint(i, 10, 2720, -2508.3000488281, 12.5)) //If they are near the point
                {
                    if(IsARMYGate2Open == false)
                    {
                    MoveObject(ARMYGate2, 2719.8000488281, -2499.6000976563, 12.5, 5.0); //Open Position
                    IsARMYGate2Open = true;
                    }
                }
                else
                {
                    if(IsARMYGate2Open == true)
                    {
                    MoveObject(ARMYGate2, 2720, -2508.3000488281, 12.5, 5.0); //Back to closed position
                    IsARMYGate2Open = false;
                    }
                }
            }
            if (gTeam[i] == SWAT)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 1287.3000488281, -1650.0999755859, 15.300000190735)) //If they are near the point
                {
                    if(IsSWATGateOpen == false)
                    {
                    MoveObject(SWATGate, 1286.8000488281, -1638.8000488281, 15.300000190735, 5.0); //Open Position
                    IsSWATGateOpen = true;
                    }
                }
                else
                {
                    if(IsSWATGateOpen == true)
                    {
                    MoveObject(SWATGate, 1287.3000488281, -1650.0999755859, 15.300000190735, 5.0); //Back to closed position
                    IsSWATGateOpen = false;
                    }
                }
            }
            if (gTeam[i] == FBI)
            {
                if(IsPlayerInRangeOfPoint(i, 15, 1534.3000488281, -1451.6999511719, 15.199999809265)) //If they are near the point
                {
                    if(IsFBIGateOpen == false)
                    {
                    MoveObject(FBIGate, 1545.8000488281, -1451.5, 15.199999809265, 5.0); //Open Position
                    IsFBIGateOpen = true;
                    }
                }
                else
                {
                    if(IsFBIGateOpen == true)
                    {
                    MoveObject(FBIGate, 1534.3000488281, -1451.6999511719, 15.199999809265, 5.0); //Back to closed position
                    IsFBIGateOpen = false;
                    }
                }
            }
            //Gates End
    }
    return 1;
}
Reply
#9

oh god, please post it in [code] or [pawn] format, i will edit my post once you done that with a further message.
Reply
#10

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
oh god, please post it in [code] or [pawn] format, i will edit my post once you done that with a further message.
My apologies, missed the closing /pawn
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)