rendered paste body#include <a_samp>
forward Timer();
//------------------------------------------------------------------------------
enum object_info
{
modelid,
Float:ox,
Float:oy,
Float:oz,
Float:orx,
Float:ory,
Float:orz,
Float:viewdist
}
new Objects[110][object_info] = {
(4701, 4417.441895, -1805.114258, 0.307399, 0, 0, 270, 100.0, 100),//Hell
(4702, 4427.800293, -1731.163940, 0.262680, 0, 0, 270, 100.0, 100),//Hell
(4702, 4435.081543, -1660.793335, 0.204991, 0, 0, 258.75, 100.0, 100),//Hell
(4813, 4410.933105, -1688.920532, 4.124721, 0, 0, 180, 100.0, 100),//Hell
(4813, 4428.646973, -1777.819092, 3.711504, 0, 0, 9.5312, 100.0, 100),//Hell
(4811, 4450.635742, -1692.095825, 2.750333, 0, 0, 337.5, 100.0, 100),//Hell
(4811, 4445.785645, -1639.922363, 3.523746, 0, 0, 0, 100.0, 100),//Hell
(4811, 4376.297852, -1767.920288, 8.162205, 0, 0, 146.25, 100.0, 100),//Hell
(4813, 4432.013184, -1820.747925, 3.766191, 0, 0, 258.75, 100.0, 100),//Hell
(10985, 4428.711914, -1817.338257, 1.309746, 0, 0, 348.75, 100.0, 100),//Hell
(10986, 4395.808105, -1828.463989, 1.192159, 0, 0, 90, 100.0, 100),//Hell
(11428, 4429.191895, -1733.813843, 6.072400, 0, 0, 0, 100.0, 100),//Hell
(11441, 4419.681641, -1692.716187, 0.343834, 0, 0, 0, 100.0, 100),//Hell
(11442, 4416.481934, -1704.616577, 0.342682, 0, 0, 0, 100.0, 100),//Hell
(11443, 4392.847168, -1732.421875, 0.340676, 0, 0, 90, 100.0, 100),//Hell
(11445, 4393.161133, -1720.982056, 0.340676, 0, 0, 269.9999, 100.0, 100),//Hell
(11446, 4393.307129, -1754.554077, 0.343834, 0, 0, 0, 100.0, 100),//Hell
(3866, 4418.223633, -1782.094238, 8.036589, 0, 0, 90, 100.0, 100),//Hell
(6865, 4413.933105, -1711.868896, 19.473412, 34.4813, 314.4499, 57.8915, 100.0, 100),//Hell Skull
(1362, 4408.650391, -1794.118408, 0.796508, 0, 0, 0, 100.0, 100),//Hell
(3529, 4407.892090, -1775.183472, 7.157484, 0, 0, 0, 100.0, 100),//Hell
(18253, 4415.982910, -1641.261353, 2.917651, 0, 0, 90, 100.0, 100),//Hell
(1499, 4413.414063, -1645.202148, 0.659970, 0, 0, 0, 100.0, 100),//Hell
(686, 4405.498047, -1654.460815, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(686, 4404.975098, -1665.968262, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(686, 4421.971680, -1665.139526, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(686, 4423.272949, -1654.380005, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(686, 4404.516113, -1674.130127, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(686, 4421.105469, -1673.279419, 0.170709, 0, 0, 0, 100.0, 100),//Hell
(1346, -661.588135, 2827.077148, 87.443428, 0, 0, 0, 100.0, 100),//phone booth in desert
(16110, -128.610168, 2252.302490, 27.137642, 0, 341.9518, 225, 100.0, 100),//Rock over body bags
(1654, -133.335785, 2251.039063, 32.733070, 325.6225, 359.1406, 303.75, 100.0, 100),//Dynomite 1
(1654, -129.697327, 2247.645752, 33.142242, 323.9037, 0, 337.6546, 100.0, 100),//Dynomite 2
(1654, -126.833992, 2246.059082, 32.637146, 319.6065, 2.5783, 352.2651, 100.0, 100),// Dynomite 3
(758, -133.770905, 2223.869629, 30.538462, 0, 0, 33.75, 100.0, 100),// Rock to hige behind
(3414, -236.182922, 2362.113525, 110.415894, 358.2811, 1.7189, 99.5311, 100.0, 100),//Crazyfurie's Hide out
(3415, -264.859222, 2382.660889, 109.084320, 359.1406, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(971, -252.824005, 2256.693359, 110.909561, 1.7189, 359.1406, 342.734, 100.0, 100),//Crazyfurie's Hide out (Gate)
(16444, -266.538116, 2358.992920, 108.407120, 3.4377, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(16444, -263.994598, 2357.616699, 108.165779, 0, 0, 281.25, 100.0, 100),//Crazyfurie's Hide out
(16444, -263.536346, 2360.777344, 108.390594, 4.2972, 5.1566, 315, 100.0, 100),//Crazyfurie's Hide out
(16444, -260.798187, 2358.479248, 108.142036, 4.2972, 0, 348.75, 100.0, 100),//Crazyfurie's Hide out
(1497, -251.635162, 2261.793213, 108.016464, 0, 0, 337.5, 100.0, 100),//Crazyfurie's Hide out
(971, -246.511429, 2263.741699, 111.512306, 0, 0, 213.75, 100.0, 100),//Crazyfurie's Hide out
(971, -254.084015, 2265.502930, 111.056374, 0, 0, 123.75, 100.0, 100),//Crazyfurie's Hide out
(2600, -262.144012, 2418.059326, 108.112312, 0, 0, 180, 100.0, 100),//Crazyfurie's Hide out
(1810, -262.393219, 2417.084961, 107.385918, 0, 0, 180, 100.0, 100),//Crazyfurie's Hide out
(1810, -265.660370, 2417.632813, 107.281181, 0, 0, 168.75, 100.0, 100),//Crazyfurie's Hide out
(2096, -240.379883, 2362.596924, 108.052284, 10.3132, 0, 292.5, 100.0, 100),//Crazyfurie's Hide out
(933, -267.311584, 2417.821045, 107.230988, 356.5623, 0.8594, 15.4699, 100.0, 100),//Crazyfurie's Hide out
(2036, -266.577820, 2417.916504, 108.275772, 0, 0, 67.5, 100.0, 100),//Crazyfurie's Hide out
(9766, -334.251495, 2169.364990, 86.518906, 35.2369, 6.8755, 254.4529, 100.0, 100),//Crazyfurie's Hide out
(9766, -377.143036, 2181.903564, 48.259567, 37.8152, 9.4538, 254.4529, 100.0, 100),//Crazyfurie's Hide out
(1451, -300.203644, 2341.601807, 111.071091, 359.1406, 354.8434, 122.0311, 100.0, 100),//Crazyfurie's Hide out
(3282, -295.070984, 2335.679688, 109.971809, 0, 0, 225, 100.0, 100),//Crazyfurie's Hide out
(3282, -303.212067, 2343.830322, 110.690079, 0, 0, 38.9839, 100.0, 100),//Crazyfurie's Hide out
(3282, -295.091095, 2343.433594, 110.254066, 358.2811, 5.1566, 315, 100.0, 100),//Crazyfurie's Hide out
(3282, -303.728302, 2336.534180, 110.253067, 0, 0, 315, 100.0, 100),//Crazyfurie's Hide out
(3282, -302.838135, 2335.662354, 110.023003, 0, 0, 315, 100.0, 100),//Crazyfurie's Hide out
(3092, -301.057129, 2338.615967, 110.497055, 85.0842, 0, 252.6566, 100.0, 100),//Crazyfurie's Hide out
(2803, -298.068420, 2348.592529, 111.107262, 0, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(2804, -300.274475, 2341.490234, 110.645622, 0, 0, 270, 100.0, 100),//Crazyfurie's Hide out
(2805, -261.762634, 2382.830322, 109.971054, 0, 0, 270, 100.0, 100),//Crazyfurie's Hide out
(2597, -261.540894, 2382.792480, 109.942062, 0, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(2589, -272.551147, 2315.828857, 114.265327, 0, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(13206, -276.417572, 2320.916748, 108.836800, 0, 0, 326.25, 100.0, 100),//Crazyfurie's Hide out
(1793, -236.202499, 2365.288086, 108.175598, 0, 0, 11.25, 100.0, 100),//Crazyfurie's Hide out
(2361, -269.024597, 2383.127930, 109.052910, 0, 0, 269.1406, 100.0, 100),//Crazyfurie's Hide out
(2804, -268.844940, 2382.352783, 109.436348, 18.0482, 357.4217, 17.1887, 100.0, 100),//Crazyfurie's Hide out
(2806, -268.954224, 2383.022217, 109.422920, 0, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(933, -238.251633, 2367.118896, 108.065674, 0, 0, 0, 100.0, 100),//Crazyfurie's Hide out
(1781, -238.034378, 2366.843506, 109.074181, 0, 0, 11.25, 100.0, 100),//Crazyfurie's Hide out
(2044, -237.362915, 2367.197510, 109.106895, 0, 0, 56.25, 100.0, 100),//Crazyfurie's Hide out
(2718, -238.443115, 2357.953369, 110.481255, 0, 0, 281.25, 100.0, 100),//Crazyfurie's Hide out
(1810, -238.021454, 2363.880127, 108.173012, 0, 0, 191.2501, 100.0, 100),//Crazyfurie's Hide out
(2590, -264.640533, 2384.181396, 112.809952, 0, 0, 177.585, 100.0, 100),//Crazyfurie's Hide out
(2590, -262.768646, 2383.364502, 112.747116, 0, 0, 90, 100.0, 100),//Crazyfurie's Hide out
(976, -2809.272949, -1532.853149, 138.450974, 21.4859, 0, 181.3415, 100),//Azurehobo's hut
(2047, -2815.573486, -1531.625000, 143.524353, 0, 0, 0, 100),//Azurehobo's hut
(3265, -2791.912598, -1526.999756, 138.288986, 0, 0, 73.9115, 100),//Azurehobo's hut
(14467, -2800.715088, -1536.627930, 141.081879, 0, 0, 0, 100),//Azurehobo's hut
(1369, -2820.236816, -1452.292969, 135.566986, 0, 0, 0, 100),//Azurehobo's hut
(1736, -2816.509766, -1515.502808, 142.416534, 0, 358.2811, 0, 100),//Azurehobo's hut
(1771, -2813.001709, -1527.885376, 140.477417, 0, 0, 0, 100),//Azurehobo's hut
(1829, -2820.278320, -1516.171997, 140.308273, 0, 0, 0, 100),//Azurehobo's hut
(2224, -2813.088135, -1516.878662, 139.839508, 0, 1.7189, 314.5538, 100),//Azurehobo's hut
(2360, -2818.034180, -1515.921265, 139.842667, 0, 0, 0, 100),//Azurehobo's hut
(2514, -2819.727051, -1529.885864, 139.842957, 0, 0, 175.3251, 100),//Azurehobo's hut
(2718, -2816.227783, -1530.979614, 142.285370, 0, 0, 182.0965, 100),//Azurehobo's hut
(2841, -2817.993164, -1524.656494, 139.843750, 0, 0, 0, 100),//Azurehobo's hut
(16444, -2800.380127, -1539.241943, 138.865936, 0, 0, 0, 100),//Azurehobo's hut
(2053, -2799.171631, -1537.317993, 138.449326, 0, 0, 0, 100),//Azurehobo's hut
(1272, -2808.949951, -1528.948120, 140.038223, 0, 0, 0, 100),//Azurehobo's hut
(18249, -2776.053711, -1468.484131, 139.299347, 0, 0.8594, 1.7189, 100),//Azurehobo's hut
(3594, -2793.188721, -1500.020508, 138.336685, 0, 0, 0, 100),//Azurehobo's hut
(3593, -2789.116943, -1499.891846, 137.965576, 356.5623, 0, 335.9358, 100),//Azurehobo's hut
(1415, -2777.775391, -1483.315918, 136.186569, 0, 0, 0, 100),//Azurehobo's hut
(3795, -2800.982910, -1501.700684, 138.630066, 0, 0, 0, 100),//Azurehobo's hut
(3795, -2801.523682, -1503.525513, 138.630066, 0, 0, 0, 100),//Azurehobo's hut
(3791, -2804.001221, -1500.309204, 138.753738, 0, 0, 0, 100),//Azurehobo's hut
(3092, -2796.658936, -1785.122192, 144.412277, 0, 0, 268.0403, 100),//Azurehobo's hut
(3092, -2805.043945, -1794.797852, 145.470276, 0, 0, 268.0403, 100),//Azurehobo's hut
(3092, -2811.553955, -1782.740601, 146.661255, 0, 0, 180.3777, 100),//Azurehobo's hut
(2985, -2808.708008, -1531.296021, 139.875259, 0, 0, 301.5583, 100),//Azurehobo's hut
(2985, -2775.029053, -1468.647461, 145.693130, 0, 0, 274.9158, 100),//Azurehobo's hut
(16641, -2335.765625, -1655.467285, 484.457977, 0, 0, 0, 100),//Azurehobo's hut
(976, -2276.775146, -1725.171631, 470.653046, 0, 0, 160.7147, 100),//Azurehobo's hut
(16303, -2236.068604, -1722.463745, 475.237122, 0, 0, 0, 100),//Azurehobo's hut
(5986, -2323.028809, -1640.423340, 498.615875, 0, 0, 0, 100),//Azurehobo's hut
(748, -2294.321533, -1636.116211, 482.848480, 0, 0, 0, 100)//Azurehobo's hut
// {modelid,x,y,z,rotx,roty,rotz,viewdistance}
// all params are same as create object, except there is an additional viewdistance parameter. This is the distance
// a player should be to see the object
};
enum player_info
{
objid[sizeof(Objects)],
bool:view[sizeof(Objects)]
}
new Player[MAX_PLAYERS][player_info];
//------------------------------------------------------------------------------
bool:IsInReach(Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:z2,Float:dist)
{
x = (x > x2) ? x - x2 : x2 - x;
if(x > dist) return false;
y = (y > y2) ? y - y2 : y2 - y;
if(y > dist) return false;
z = (z > z2) ? z - z2 : z2 - z;
if(z > dist) return false;
return true;
}
//------------------------------------------------------------------------------
new timer;
public OnFilterScriptInit()
{
print("---\nLoaded xObjects by Boylett\n---");
timer = SetTimer("Timer",500,1);
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new o = 0; o < sizeof(Objects); o++)
{
if(Player[i][view][o])
{
Player[i][view][o] = false;
DestroyPlayerObject(i,Player[i][objid][o]);
}
}
}
KillTimer(timer);
}
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
for(new i = 0; i < sizeof(Objects); i++) Player[playerid][view][i] = false;
}
public OnPlayerDisconnect(playerid)
{
for(new i = 0; i < sizeof(Objects); i++)
{
if(Player[playerid][view][i])
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
}
//------------------------------------------------------------------------------
public Timer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
PlayerObjectUpdate(i);
}
PlayerObjectUpdate(playerid)
{
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
for(new i = 0; i < sizeof(Objects); i++)
{
if(!Player[playerid][view][i])
{
if(IsInReach(pos[0],pos[1],pos[2],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][viewdist]))
{
Player[playerid][view][i] = true;
Player[playerid][objid][i] = CreatePlayerObject(playerid,Objects[i][modelid],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][orx],Objects[i][ory],Objects[i][orz]);
}
} else if(!IsInReach(pos[0],pos[1],pos[2],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][viewdist]))
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
}
public OnPlayerSpawn(playerid)
PlayerObjectUpdate(playerid);