SA-MP Forums Archive
how to do opening of gate from 2 points. - 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: how to do opening of gate from 2 points. (/showthread.php?tid=129005)



how to do opening of gate from 2 points. - gringoo - 20.02.2010

there are 2 points with coordinates which a gate must be opened from:
1 point) -2127.4292, -80.0525, 35.3081
2 point) -2140.1570, -75.0254, 38.0045


it opening from a 1 point
------------------------------------
if(IsPlayerInSphere(i, -2127.4292, -80.0525, 35.3081,)
{
if (Gates12[i] == 1)
{
MoveDynamicObject(Gatesid1, -2136.3835, -80.5887, 35.3203,4);
MoveDynamicObject(Gatesid2, -2118.3835, -80.5887, 35.3203,4);
Gates12[i] = 0;
}
else
{
MoveDynamicObject(Gatesid1, -2131.3835, -80.5887, 35.3203,1);
MoveDynamicObject(Gatesid2, -2123.3835, -80.5887, 35.3203,1);
}
}
else
{
Gates12[i] = 1;
}
================================================
but as to do that was a gate opened and from 1 and from 2 points?



Re: how to do opening of gate from 2 points. - Daren_Jacobson - 20.02.2010

pawn Код:
if(IsPlayerInRangeOfPoint(i, 8.0, -2127.4292, -80.0525, 35.3081,) || IsPlayerInRangeOfPoint(i, 8.0, -2140.1570, -75.0254, 38.0045))
     {
     if (Gates12 == 1)
      {
      MoveDynamicObject(Gatesid1, -2136.3835, -80.5887, 35.3203,4);  
      MoveDynamicObject(Gatesid2, -2118.3835, -80.5887, 35.3203,4);
      Gates12 = 0;
      }
     else
       {
       MoveDynamicObject(Gatesid1, -2131.3835, -80.5887, 35.3203,1);
       MoveDynamicObject(Gatesid2, -2123.3835, -80.5887, 35.3203,1);
       }
     }
   else
     {
     Gates12 = 1;
     }



Re: how to do opening of gate from 2 points. - DiMeNsIoN© - 20.02.2010

pawn Код:
if(PlayerToPoint(15, i, -2127.4292, -80.0525, 35.3081) || PlayerToPoint(15, i, -2140.1570, -75.0254, 38.0045))
    {
        if (Gates12 == 1)
        {
            MoveDynamicObject(Gatesid1, -2136.3835, -80.5887, 35.3203,4);
        MoveDynamicObject(Gatesid2, -2118.3835, -80.5887, 35.3203,4);
        Gates12 = 0;
        }
        else
        {
            MoveDynamicObject(Gatesid1, -2131.3835, -80.5887, 35.3203,1);
        MoveDynamicObject(Gatesid2, -2123.3835, -80.5887, 35.3203,1);
        }
    }
    else
    {
        Gates12 = 1;
    }



Re: how to do opening of gate from 2 points. - Daren_Jacobson - 20.02.2010

PlayerToPoint is old and slow.


Re: how to do opening of gate from 2 points. - DiMeNsIoN© - 20.02.2010

Quote:
Originally Posted by Daren_Jacobson
PlayerToPoint is old and slow.
True


Re: how to do opening of gate from 2 points. - Joe Staff - 20.02.2010

You're also moving your gates inappropriately. The method you're doing will only allow the gate to work for the last connected player. (assuming IsPlayerConnected is being used, if not, the only player id 500 can open it)


Re: how to do opening of gate from 2 points. - gringoo - 20.02.2010

no, required only Isplayerinsphere.

is it whew possible?
---------------------

if(IsPlayerInSphere(i, 8.0, -2127.4292, -80.0525, 35.3081,) || IsPlayerInSphere(i, 8.0, -2140.1570, -75.0254, 38.0045))
{
if (Gates12 == 1)
{
MoveDynamicObject(Gatesid1, -2136.3835, -80.5887, 35.3203,4);
MoveDynamicObject(Gatesid2, -2118.3835, -80.5887, 35.3203,4);
Gates12 = 0;
}
else
{
MoveDynamicObject(Gatesid1, -2131.3835, -80.5887, 35.3203,1);
MoveDynamicObject(Gatesid2, -2123.3835, -80.5887, 35.3203,1);
}
}
else
{
Gates12 = 1;
}