Advertisement
Johurt

[FNC] CoordsInWater & ObjectInWater

Sep 29th, 2014
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 20.91 KB | None | 0 0
  1. /*
  2.     By Johurt, 2014/09/23
  3. */
  4. #define MAX_WATER_AREAS 303
  5. // not by default
  6.     {-1088.00000, 2544.00000, -1040.00000, 2800.00000, -69.0, 40.5}, // not by default
  7.     {-1040.00000, 2544.00000, -832.00000, 2760.00000, -69.0, 40.5}, // not by default
  8.     {-1088.00000, 2416.00000, -832.00000, 2544.00000, -69.0, 40.5}, // not by default
  9.     {-1040.00000, 2304.00000, -864.00000, 2416.00000, -69.0, 40.5}, // not by default
  10.     {-1024.00000, 2144.00000, -864.00000, 2304.00000, -69.0, 40.5}, // not by default
  11.     {-1072.00000, 2152.00000, -1024.00000, 2264.00000, -69.0, 40.5}, // not by default
  12.     {-1200.00000, 2114.00000, -1072.00000, 2242.00000, -69.0, 40.5}, // not by default
  13.     {-976.00000, 2016.00000, -848.00000, 2144.00000, -69.0, 40.5}, // not by default
  14.     {-864.00000, 2144.00000, -448.00000, 2272.00000, -69.0, 40.5}, // not by default
  15.     {-700.00000, 2272.00000, -484.00000, 2320.00000, -69.0, 40.5}, // not by default
  16.     {-608.00000, 2320.00000, -528.00000, 2352.00000, -69.0, 40.5}, // not by default
  17.     {-848.00000, 2044.00000, -816.00000, 2144.00000, -69.0, 40.5}, // not by default
  18.     {-816.00000, 2060.00000, -496.00000, 2144.00000, -69.0, 40.5}, // not by default
  19.     {-604.00000, 2036.00000, -484.00000, 2060.00000, -69.0, 40.5}, // not by default
  20.     {2376.00000, -3000.00000, 3000.00000, -2688.00000, -69.0, 0.0},
  21.     {2520.00000, -2688.00000, 3000.00000, -2560.00000, -69.0, 0.0},
  22.     {-1328.00000, 2082.00000, -1200.00000, 2210.00000, -69.0, 40.5}, // not by default
  23.     {-1400.00000, 2074.00000, -1328.00000, 2150.00000, -69.0, 40.5}, // not by default
  24.     {-1248.00000, -144.00000, -992.00000, 208.00000, -69.0, 0.0},
  25.     {-1176.00000, -432.00000, -992.00000, -144.00000, -69.0, 0.0},
  26.     {-1792.00000, -592.00000, -1728.00000, -144.00000, -69.0, 0.0},
  27.     {-1792.00000, 170.00000, -1600.00000, 274.00000, -69.0, 0.0},
  28.     {-1600.00000, 168.00000, -1256.00000, 208.00000, -69.0, 0.0},
  29.     {-1574.00000, -44.00000, -1550.00000, 108.00000, -69.0, 0.0},
  30.     {1928.00000, -1222.00000, 2012.00000, -1178.00000, 16.0, 17.81}, // not by default
  31.     {-464.00000, -1908.00000, -280.00000, -1832.00000, -69.0, 0.0},
  32.     {2248.00000, -1182.00000, 2260.00000, -1170.00000, -99.0, -99.0}, // not used | interior
  33.     {2292.00000, -1432.00000, 2328.00000, -1400.00000, 20.0, 21.97}, // not by default
  34.     {1888.00000, 1468.00000, 2036.00000, 1700.00000, 0.0, 8.4}, // not by default
  35.     {2090.00000, 1670.00000, 2146.00000, 1694.00000, -99.0, -99.0}, // not used
  36.     {2110.00000, 1234.00000, 2178.00000, 1330.00000, 6.5, 7.64}, // not by default
  37.     {2108.00000, 1084.00000, 2180.00000, 1172.00000, 6.5, 7.64}, // not by default
  38.     {2506.00000, 1546.00000, 2554.00000, 1586.00000, 6.5, 8.77}, // not by default
  39.     {1270.00000, -812.00000, 1290.00000, -800.00000, 85.0, 86.48}, // not by default
  40.     {1084.00000, -684.00000, 1104.00000, -660.00000, 110.0, 111.81}, // not by default
  41.     {502.00000, -1114.00000, 522.00000, -1098.00000, -99.0, -99.0}, // not used
  42.     {214.00000, -1208.00000, 246.00000, -1180.00000, 72.0, 73.81}, // not by default
  43.     {218.00000, -1180.00000, 238.00000, -1172.00000, 72.0, 73.81}, // not by default
  44.     {178.00000, -1244.00000, 206.00000, -1216.00000, 76.0, 76.86}, // not by default
  45.     {1744.00000, 2780.00000, 1792.00000, 2868.00000, -99.0, -99.0}, // not used
  46.     {-2832.00000, 2888.00000, 3000.00000, 3000.00000, -69.0, 0.0},
  47.     {-2778.00000, -522.00000, -2662.00000, -414.00000, -23.0, 2.6}, // not by default
  48.     {1520.00000, -252.00000, 1572.00000, -208.00000, -69.0, 0.0},
  49.     {2922.00000, 752.00000, 3000.00000, 2888.00000, -69.0, 0.0},
  50.     {-3000.00000, -446.00000, -2910.00000, 354.00000, -69.0, 0.0},
  51.     {-2434.00000, 2224.00000, -2294.00000, 2340.00000, -69.0, 0.0},
  52.     {-2294.00000, 2224.00000, -2208.00000, 2312.00000, -69.0, 0.0},
  53.     {2058.00000, 1868.00000, 2110.00000, 1964.00000, 7.4, 9.43}, // not by default
  54.     {-3000.00000, 2942.00000, -2832.00000, 3000.00000, -69.0, 0.0},
  55.     {-550.00000, 2004.00000, -494.00000, 2036.00000, -69.0, 40.5}, // not by default
  56.     {-896.00000, 842.00000, -776.00000, 954.00000, -69.0, 0.0},
  57.     {-2240.00000, 1336.00000, -2088.00000, 1432.00000, -69.0, 0.0},
  58.     {-3000.00000, -822.00000, -2930.00000, -446.00000, -69.0, 0.0},
  59.     {-2660.00000, 2224.00000, -2520.00000, 2264.00000, -69.0, 0.0},
  60.     {-378.00000, -460.00000, -138.00000, -400.00000, -69.0, 0.0},
  61.     {1836.00000, 1468.00000, 1888.00000, 1568.00000, 7.1, 8.4}, // not by default
  62.     {890.00000, -1106.00000, 902.00000, -1098.00000, -99.0, -99.0}, // not used
  63.     {1202.00000, -2414.00000, 1278.00000, -2334.00000, 0.0, 8.67}, // not by default
  64.     {1072.00000, -2412.00000, 1128.00000, -2372.00000, -69.0, 0.0},
  65.     {-848.00000, -2082.00000, -664.00000, -1866.00000, 2.2, 5.08}, // not by default
  66.     {-664.00000, -1924.00000, -464.00000, -1864.00000, 2.2, 5.08}, // not by default
  67.     {-1484.00000, 784.00000, -1424.00000, 840.00000, -69.0, 0.0},
  68.     {-496.00000, 566.00000, -432.00000, 642.00000, -69.0, 0.0},
  69.     {250.00000, 2808.00000, 818.00000, 2888.00000, -69.0, 0.0},
  70.     {2502.00000, -2240.00000, 2670.00000, -2120.00000, -69.0, 0.0},
  71.     {1270.00000, -780.00000, 1290.00000, -768.00000, -99.0, -99.0}, // not used | interior
  72.     {88.00000, 544.00000, 120.00000, 572.00000, -69.0, 0.0},
  73.     {1856.00000, -202.00000, 1888.00000, -158.00000, -69.0, 0.0},
  74.     {-2048.00000, -962.00000, -2004.00000, -758.00000, -99.0, -99.0}, // not used
  75.     {2564.00000, 2370.00000, 2604.00000, 2398.00000, 15.6, 16.2}, // not by default
  76.     {-2522.00000, -310.00000, -2382.00000, -234.00000, -99.0, -99.0}, // not used
  77.     {2872.00000, -2136.00000, 2888.00000, -2120.00000, -69.0, 0.0},
  78.     {2760.00000, -2240.00000, 2776.00000, -2232.00000, -69.0, 0.0},
  79.     {-912.00000, -150.02799, -717.08660, 208.00000, -69.0, 0.0},
  80.     {-1728.00000, -222.00000, -1361.66967, 170.00000, -69.0, 0.0}
  81. };
  82.  
  83. stock CoordsInWater(Float:x, Float:y, Float:z)
  84. {
  85.     for(new w; w < MAX_WATER_AREAS; w++)
  86.     {
  87.         if(!(wAreas[w][4] == -99.0 && wAreas[w][5] == -99.0))
  88.         {
  89.             if((wAreas[w][0] <= x <= wAreas[w][2]) && (wAreas[w][1] <= y <= wAreas[w][3]) && (wAreas[w][4] <= z <= wAreas[w][5])) return 1;
  90.         }
  91.     }
  92.     return 0;
  93. }
  94.  
  95. stock ObjectInWater(type, objectid)
  96. {
  97.     new Float:oPos[3];
  98.     switch(type)
  99.     {
  100.         case 1: GetPlayerPos(objectid, oPos[0], oPos[1], oPos[2]);
  101.         case 2: GetVehiclePos(objectid, oPos[0], oPos[1], oPos[2]);
  102.         case 3: GetObjectPos(objectid, oPos[0], oPos[1], oPos[2]);
  103.         //case 4: GetDynamicObjectPos(objectid, oPos[0], oPos[1], oPos[2]); // need Incognito streamer
  104.     }
  105.     for(new w; w < MAX_WATER_AREAS; w++)
  106.     {
  107.         if(!(wAreas[w][4] == -99.0 && wAreas[w][5] == -99.0))
  108.         {
  109.         if((wAreas[w][0] <= oPos[0] <= wAreas[w][2]) && (wAreas[w][1] <= oPos[1] <= wAreas[w][3]) && (wAreas[w][4] <= oPos[2] <= wAreas[w][5])) return 1;
  110.         }
  111.     }
  112.     return 0;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement