rendered paste body#include <a_samp>
forward Timer();
forward SetPlayerPosWithObjects(playerid,Float:x,Float:y,Float:z);
/*
SetPlayerPosWithObjects usage in your gamemode:
CallRemoteFunction("SetPlayerPosWithObjects","ifff",playerid,newx,newy,newz);
*/
//------------------------------------------------------------------------------
enum object_info
{
modelid,
Float:ox,
Float:oy,
Float:oz,
Float:orx,
Float:ory,
Float:orz,
Float:viewdist
}
new Objects[][object_info] = {
{1391,1566.492920,1498.965942,42.365685,0.0,0.0,45.0,200.0},
{12956,1438.828003,1639.709106,13.641217,0.0,0.0,0.0,200.0},
{13590,1330.183472,1338.939819,12.196156,0.0,0.0,180.0,200.0},
{13638,1410.989868,1450.632324,17.742737,0.0,0.0,0.0,200.0},
{13636,1434.875244,1395.834717,12.100704,0.0,0.0,0.0,200.0},
{18367,1449.551392,1444.459473,11.027264,0.0,0.0,270.0,200.0},
{1632,1449.399048,1444.685669,11.120424,0.0,0.0,90.0001,200.0},
{3269,1572.757935,1177.852417,10.635645,0.0,0.0,326.2500,200.0},
{3270,1647.471558,1502.667236,21.715006,0.0,0.0,90.0001,200.0},
{3665,1523.291504,1595.971924,11.801905,0.0,0.0,0.0,200.0},
{8375,1519.603271,1595.906494,11.808588,0.0,0.0,0.0,200.0},
{8375,1525.593262,1595.879761,11.818272,0.0,0.0,0.0,200.0},
{13641,1429.262207,1567.475342,11.539557,0.0,0.0,270.0,200.0},
{13641,1430.215088,1535.601318,11.539557,0.0,0.0,90.0,200.0},
{1245,1532.807373,1599.594727,15.284703,0.0,0.0,90.0,200.0},
{1245,1529.623779,1599.830811,15.273852,0.0,0.0,90.0,200.0},
{1245,1526.369751,1599.868042,15.275141,0.0,0.0,90.0,200.0},
{1245,1523.384888,1599.584839,15.284699,0.0,0.0,90.0,200.0},
{1245,1520.322754,1599.552002,15.266522,0.0,0.0,90.0001,200.0},
{1245,1517.309937,1599.732666,15.275074,0.0,0.0,90.0001,200.0},
{1245,1514.345337,1599.562500,15.286158,0.0,0.0,90.0001,200.0},
{1245,1511.357178,1599.654053,15.281665,0.0,0.0,90.0,200.0},
{1245,1508.394287,1599.565063,15.276538,0.0,0.0,90.0,200.0},
{1245,1506.250610,1599.501709,15.235857,0.0,0.0,90.0,200.0},
{1245,1508.955444,1592.610107,15.280536,0.0,0.0,270.0,200.0},
{1245,1511.951416,1592.675415,15.274016,0.0,0.0,270.0,200.0},
{1245,1515.044189,1592.587891,15.290219,0.0,0.0,270.0,200.0},
{1245,1517.992432,1592.565186,15.271573,0.0,0.0,270.0,200.0},
{1245,1520.866577,1592.632324,15.266521,0.0,0.0,270.0,200.0},
{1245,1523.849731,1592.637939,15.281304,0.0,0.0,270.0,200.0},
{1245,1526.805664,1592.558838,15.271569,0.0,0.0,270.0,200.0},
{1245,1529.854492,1592.846802,15.273852,0.0,0.0,270.0,200.0},
{1245,1532.135986,1592.924072,15.281446,0.0,0.0,270.0,200.0},
{1245,1534.904419,1592.639648,15.281306,0.0,0.0,270.0,200.0},
{1633,1501.254883,1234.839722,11.112791,0.0,0.0,247.5001,200.0},
{1633,1503.028564,1238.628662,11.112791,0.0,0.0,247.5000,200.0},
{1655,1570.963013,1354.677368,11.161556,0.0,0.0,315.0,200.0},
{1697,1505.937378,1237.240234,12.517612,0.0,0.0,67.5000,200.0},
{1697,1504.310913,1233.806519,12.408297,0.0,0.0,67.5000,200.0},
{1697,1507.994751,1236.346802,13.806725,0.0,0.0,67.5000,200.0},
{1697,1506.239868,1232.602783,13.764389,0.0,0.0,67.5000,200.0},
{3363,1480.479126,1643.966919,9.847856,0.0,0.0,0.0,200.0},
{3364,1446.026123,1523.479248,9.976334,0.0,0.0,0.0,200.0},
{3625,1389.698975,1537.363037,12.647676,0.0,0.0,90.0,200.0},
{6052,1480.923706,1341.184326,12.567952,0.0,0.0,191.2500,200.0},
{6052,1459.648560,1355.342896,12.567952,0.0,0.0,11.2501,200.0},
{6052,1476.979736,1358.980713,12.575763,0.0,0.0,281.2500,200.0},
{6052,1462.791382,1337.764648,12.567952,0.0,0.0,101.2501,200.0},
{7979,1614.202515,1401.789185,25.165537,0.0,0.0,315.0,200.0},
{16401,1636.386597,1427.989014,26.290367,0.0,0.0,78.7500,200.0},
{13640,1607.160522,1451.102539,33.368774,0.0,0.0,0.0,200.0},
{13641,1608.366455,1444.789673,34.023041,0.0,0.0,180.0,200.0},
{16302,1587.943604,1187.356323,43.351513,0.0,0.0,0.0,200.0},
{16303,1588.934326,1223.367676,32.109673,0.0,0.0,101.2501,200.0},
{18367,1571.915894,1223.375000,36.486126,0.0,0.0,180.0,200.0},
{18367,1571.972778,1254.453247,39.384045,0.0,0.0,180.0,200.0},
{18367,1594.514404,1438.977783,33.854900,0.0,0.0,270.0,200.0},
{18451,1564.203125,1439.031128,38.181099,0.0,0.0,78.7500,200.0},
{18451,1570.500244,1284.553589,43.653351,0.0,0.0,11.2500,200.0},
{1503,1478.840088,1331.972778,10.214430,0.0,0.0,33.7500,200.0},
{1503,1460.483276,1362.342896,10.214430,0.0,0.0,213.7500,200.0},
{1503,1453.760498,1337.786743,10.207096,0.0,0.0,303.7500,200.0},
{1503,1480.221313,1354.239502,10.214430,0.0,0.0,112.5001,200.0},
{18609,1441.857788,1465.394287,10.992801,0.0,0.0,0.0,200.0},
{1631,1410.921021,1463.366821,23.848225,0.0,0.0,337.5000,200.0},
{1632,1282.094727,1392.894287,11.120424,0.0,0.0,168.7500,200.0},
{13590,1348.637207,1571.045166,12.196156,0.0,0.0,56.2500,200.0},
{13593,1358.061035,1675.503174,10.563171,0.0,0.0,22.5000,200.0},
{13604,1476.368164,1791.301270,11.520517,0.0,0.0,0.0,200.0},
{13636,1522.477051,1392.984131,12.151333,0.0,0.0,0.0,200.0},
{1458,1479.280640,1510.199463,10.073894,0.0,0.0,33.7500,200.0},
{12919,1555.318481,1580.301025,9.814196,0.0,0.0,236.2500,200.0},
{1503,1561.354858,1565.050293,10.214430,0.0,0.0,45.0,200.0},
{1632,1563.766235,1592.711426,12.870266,0.0,0.0,326.2500,200.0},
{1632,1587.418823,1675.414185,20.527832,0.0,0.0,90.0,200.0},
{16084,1645.787354,1678.927734,9.820313,0.0,0.0,11.2500,200.0},
{13645,1650.326294,1678.774048,16.943005,0.0,0.0,270.0,200.0},
{13645,1635.018311,1678.361816,17.150955,0.0,0.0,90.0,200.0},
{16401,1603.264526,1619.875977,9.814201,0.0,0.0,67.5000,200.0},
{13593,1330.418579,1355.261719,10.563171,0.0,0.0,180.0,200.0},
{13645,1362.370239,1561.821167,10.563171,0.0,0.0,56.2500,200.0},
{4828,1392.120728,1798.320190,25.424541,0.0,0.0,0.0,200.0},
{8550,1538.785400,1457.102051,14.079216,0.0,0.0,0.0,200.0},
{10757,1296.365112,1607.078979,21.254953,0.0,0.0,78.7500,200.0},
{16098,1613.245483,1269.058594,15.052503,0.0,0.0,0.0,200.0},
{1681,1605.294312,1252.689209,12.790525,0.0,0.0,90.0,200.0},
{1681,1608.636230,1286.112061,12.789661,0.0,0.0,78.7500,200.0},
{1681,1664.361206,1447.183228,29.300192,0.0,0.0,270.0,200.0},
{8841,1278.112793,1344.211914,13.146553,0.0,0.0,270.0,200.0},
{13592,1405.617798,1235.722046,19.841829,0.0,0.0,0.0,200.0},
{13666,1333.873535,1261.212646,23.092812,0.0,0.0,11.2500,200.0},
{13642,1430.421631,1685.769775,12.248458,0.0,0.0,0.0,200.0},
{13642,1428.675293,1683.212280,12.248458,0.0,0.0,0.0,200.0},
{13603,1396.704712,1349.926147,9.255030,0.0,0.0,0.0,200.0},
{1634,1413.806396,1398.688721,11.110296,0.0,0.0,180.0,200.0},
{1634,1394.800293,1398.459839,11.117630,0.0,0.0,180.0,200.0},
{1634,1377.280884,1397.102539,11.117630,0.0,0.0,180.0,200.0},
{3363,1393.836304,1344.252075,13.207513,0.0,0.0,45.0,200.0},
{7617,1543.721191,1748.812134,21.757954,0.0,0.0,180.0,200.0},
{1634,1231.313721,1451.186279,7.039310,0.0,0.0,270.0,200.0},
{14826,1286.927002,1365.105347,10.584691,0.0,0.0,180.0,200.0},
{17054,1320.193481,1430.997925,9.808537,0.0,0.0,0.0,200.0},
{1697,1318.827026,1418.745361,11.422192,0.0,0.0,180.0,200.0},
{1697,1326.718506,1418.628296,11.422192,0.0,0.0,180.0,200.0},
{1697,1322.581177,1418.639282,11.422192,0.0,0.0,180.0,200.0},
{1697,1314.882690,1419.042847,11.422192,0.0,0.0,180.0,200.0},
{1697,1312.520020,1419.050659,11.422192,0.0,0.0,180.0,200.0},
{1697,1323.105835,1442.970703,11.414858,0.0,0.0,0.0,200.0},
{1697,1327.600708,1442.887695,11.414858,0.0,0.0,0.0,200.0},
{1697,1318.624634,1443.122192,11.414858,0.0,0.0,0.0,200.0},
{1697,1314.091431,1443.218994,11.414857,0.0,0.0,0.0,200.0},
{1655,1399.577759,1232.092163,11.417362,0.0,0.0,90.0,200.0},
{18451,262.540192,-1830.958496,3.261151,0.0,0.0,78.7500,200.0},
{13641,214.034668,-1816.679565,5.010491,0.0,0.0,0.0,200.0},
{13641,231.403183,-1815.559570,4.952097,0.0,0.0,0.0,200.0},
{13641,255.582932,-1814.597412,4.921548,0.0,0.0,180.0,200.0},
{13641,343.954559,-1841.445557,4.305564,0.0,0.0,0.0,200.0},
{13640,315.962341,-1859.951538,3.106721,0.0,0.0,90.0,200.0},
{13640,312.263794,-1859.905884,3.087724,0.0,0.0,90.0,200.0},
{13640,308.692657,-1859.938599,3.071126,0.0,0.0,90.0,200.0},
{3363,266.550476,-1856.574219,2.113329,0.0,0.0,0.0,200.0},
{3363,326.909424,-1800.337891,3.697496,0.0,0.0,0.0,200.0},
{3364,272.811035,-1876.874146,1.407019,0.0,0.0,0.0,200.0},
{3364,246.188751,-1799.093628,3.554681,0.0,0.0,0.0,200.0},
{3625,199.477539,-1843.530884,5.408857,0.0,0.0,0.0,200.0},
{3665,466.434204,-1856.054565,4.534953,0.0,0.0,270.0,200.0},
{7979,526.833801,-1880.385620,7.202157,0.0,0.0,180.0,200.0},
{16401,492.819977,-1821.431274,4.568703,0.0,0.0,258.7500,200.0},
{12956,589.738220,-1867.453735,7.397460,0.0,0.0,0.0,200.0},
{13590,517.707642,-1852.633789,5.684564,0.0,0.0,90.0,200.0},
{13636,619.981995,-1894.235962,4.788984,0.0,0.0,0.0,200.0},
{13641,689.529114,-1896.497314,4.084540,0.0,0.0,0.0,200.0},
{13641,426.155121,-1839.947998,4.845819,0.0,0.0,180.0,200.0},
{13643,283.523010,-1783.595947,4.646321,0.0,0.0,0.0,200.0},
{13643,369.906128,-2028.210815,7.967891,0.0,0.0,270.0,200.0},
{13641,369.829590,-1997.688721,8.391119,0.0,0.0,90.0,200.0},
{13641,368.901276,-1970.084106,8.391119,0.0,0.0,270.0,200.0},
{13641,368.624634,-1946.419922,8.391123,0.0,0.0,270.0,200.0},
{13647,317.136078,-1831.145020,2.858854,0.0,0.0,0.0,200.0},
{13647,455.508972,-1826.749512,4.213486,0.0,0.0,0.0,200.0},
{16367,437.741394,-1859.081543,4.107788,0.0,0.0,0.0,200.0},
{18568,475.246399,-1875.973633,2.883051,0.0,0.0,0.0,200.0},
{1632,525.992249,-1959.991821,1.280555,0.0,0.0,146.2500,200.0},
{1655,406.191711,-2000.932739,1.305619,0.0,0.0,90.0,200.0},
{1655,342.689941,-2011.077393,1.304739,0.0,0.0,270.0,200.0},
{3665,492.282043,-2037.717529,1.868690,0.0,0.0,270.0,200.0},
{3665,492.364563,-2033.842285,2.071968,0.0,0.0,270.0,200.0},
{3665,492.442627,-2061.055908,1.985298,0.0,0.0,270.0,200.0},
{3665,492.420593,-2065.183838,1.980745,0.0,0.0,270.0,200.0},
{3665,558.046631,-2007.590942,2.016487,0.0,0.0,326.2500,200.0},
{3665,553.822815,-2005.030884,2.020981,0.0,0.0,326.2500,200.0},
{7979,491.653473,-1980.256836,4.609889,0.0,0.0,112.5000,200.0},
{16401,541.743286,-2063.397705,0.113537,0.0,0.0,292.5000,200.0},
{13604,564.200134,-2053.414551,1.723955,0.0,0.0,0.0,200.0},
{13640,598.570984,-2024.213501,0.999978,0.0,0.0,0.0,200.0},
{13641,570.496460,-1957.025757,1.711162,0.0,0.0,348.7500,200.0},
{13641,448.258240,-2072.046631,1.787143,0.0,0.0,90.0,200.0},
{13641,448.563354,-2043.785400,1.794347,0.0,0.0,258.7500,200.0},
{13641,278.857208,-1996.069336,1.679985,0.0,0.0,180.0,200.0},
{1631,351.640564,-1966.785278,0.629827,0.0,0.0,0.0,200.0},
{1655,168.642365,-1924.416138,1.334277,0.0,0.0,90.0,200.0},
{1655,132.586700,-1916.981201,1.338189,0.0,0.0,270.0,200.0},
{1631,468.810852,-2068.044678,-0.472766,0.0,0.0,0.0,200.0},
{1632,319.945618,-1949.104980,1.254583,0.0,0.0,157.5000,200.0},
{1612,242.132767,-2045.890503,10.208589,0.0,0.0,270.0,200.0},
{13642,649.697632,-1903.918701,4.609004,0.0,0.0,191.2500,200.0},
{5706,664.480774,-2051.875244,5.719706,0.0,0.0,0.0,200.0},
{1655,666.298584,-2018.147339,1.230698,0.0,0.0,180.0,200.0},
{1655,665.403809,-2081.237549,1.319165,0.0,0.0,0.0,200.0},
{17063,180.588562,-2062.381592,-4.062707,0.0,0.0,0.0,200.0},
{17063,243.607941,-1965.820313,-3.682564,0.0,0.0,0.0,200.0},
{1634,-2230.005371,-1742.540771,481.169159,0.0,0.0,213.7500,200.0},
{12956,-2048.680664,-174.966400,38.148552,0.0,0.0,0.0,200.0},
{13590,-2080.529297,-221.972351,36.696156,0.0,0.0,0.0,200.0},
{13604,-2049.382080,-237.678268,36.028332,0.0,0.0,0.0,200.0},
{13640,-2058.208252,-250.067703,35.340584,0.0,0.0,0.0,200.0},
{18451,-2085.802734,-252.842712,34.832741,0.0,0.0,180.0,200.0},
{1632,-2083.973145,-171.239105,35.620426,0.0,0.0,0.0,200.0},
{1632,-2046.574707,-97.805237,35.464176,0.0,0.0,180.0,200.0},
{1632,-2042.546631,-97.718201,35.464176,0.0,0.0,180.0,200.0},
{13642,-1751.581177,-147.014221,4.982834,0.0,0.0,67.5000,200.0}
};
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("---\nStunt Objects Loaded\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 SetPlayerPosWithObjects(playerid,Float:x,Float:y,Float:z)
{
for(new i = 0; i < sizeof(Objects); i++)
{
if(!Player[playerid][view][i])
{
if(IsInReach(x,y,z,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(x,y,z,Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][viewdist]))
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
SetPlayerPos(playerid,Float:x,Float:y,Float:z);
}
public OnPlayerSpawn(playerid)
PlayerObjectUpdate(playerid);