12.10.2017, 11:23
Quote:
Problems
Код:
C:\Users\khalid7\Desktop\race.pwn(122) : error 032: array index out of bounds (variable "Checkpoint") C:\Users\khalid7\Desktop\race.pwn(124) : error 001: expected token: ";", but found "return" Код:
#include <a_samp> #include <streamer> new Checkpoint [1]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" FROM SKY TO GROUND (RACE)"); print("----------------------------------\n"); } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("FROM SKY TO GROUND (RACE)"); //Classes AddPlayerClass(1,170.6894,1665.2310,295.6057,260.0966,0,0,0,0,0,0); // //Mappings CreateObject(7630, 195.00990, 1684.66467, 297.28705, 0.00000, 0.00000, 353.81628); CreateObject(10542, 287.78363, 1671.41089, 304.83661, 0.00000, 0.00000, 352.54187); CreateObject(16357, 579.67780, 1609.96753, 319.42230, 0.00000, 0.00000, 353.58395); CreateObject(18802, 591.36194, 1609.87939, 318.46005, 0.00000, 0.00000, 351.71613); CreateObject(11011, 616.92389, 1604.78040, 324.13315, 0.00000, 0.00000, 260.63559); CreateObject(10458, 746.75555, 1584.27161, 327.22955, 0.00000, 0.00000, 350.80423); CreateObject(11539, 1004.38165, 1247.09119, 299.22968, 0.00000, 0.00000, 226.82663); CreateObject(11539, 914.42944, 1517.11731, 299.22968, 0.00000, 0.00000, 302.82449); CreateObject(11539, 1003.56219, 1405.77234, 299.22968, 0.00000, 0.00000, 266.46228); CreateObject(18812, 951.59033, 1120.77783, 300.16574, 0.00000, 0.00000, 0.00000); CreateObject(11539, 1004.69995, 1247.98230, 299.22968, 0.00000, 0.00000, 226.92664); CreateObject(8080, 1029.39697, 1027.95569, 119.52229, 0.00000, 0.00000, 0.14166); CreateObject(8214, 1304.61450, 1170.21362, 114.26676, 0.00000, 0.00000, 205.22849); CreateObject(8214, 1179.13574, 1064.23987, 116.78378, 0.00000, 0.00000, 177.60768); CreateObject(5799, 1388.79712, 1333.67993, 104.95651, 0.00000, 0.00000, 158.57266); CreateObject(5799, 1364.68616, 1273.51379, 110.89490, 0.00000, 0.00000, 158.57266); CreateObject(18789, 1426.61780, 1459.16821, 47.64363, 0.00000, 30.00000, 68.94209); CreateObject(18789, 1416.95349, 1434.74670, 63.51707, 0.00000, 30.00000, 68.94209); CreateObject(18789, 1435.60535, 1427.12842, 63.51707, 0.00000, 30.00000, 68.94209); CreateObject(18789, 1445.57373, 1452.75403, 47.33453, 0.00000, 30.00000, 68.94209); CreateObject(10769, 1429.59863, 1540.26807, 16.52456, 0.00000, 0.00000, 202.11963); CreateObject(621, 967.12518, 1020.13629, 119.54744, 0.00000, 0.00000, 359.17862); CreateObject(621, 951.82544, 1034.87549, 119.54744, 0.00000, 0.00000, 0.00000); CreateObject(621, 953.36053, 1030.49170, 119.54744, 0.00000, 0.00000, 0.00000); CreateObject(621, 955.60968, 1027.22876, 119.54744, 0.00000, 0.00000, 0.00000); CreateObject(621, 959.23132, 1023.88605, 119.54744, 0.00000, 0.00000, 359.89999); CreateObject(621, 963.32123, 1021.62042, 119.54744, 0.00000, 0.00000, 359.89999); CreateObject(8038, 1074.03821, 1005.58301, 136.63242, 0.00000, 0.00000, 90.05946); CreateObject(8038, 1009.23474, 1005.46082, 136.63242, 0.00000, 0.00000, 90.05946); CreateObject(7676, 823.89807, 1587.38306, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 816.98834, 1556.08777, 330.41928, 0.00000, 0.00000, 350.37714); CreateObject(7676, 721.94952, 1605.55579, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 775.36060, 1595.92395, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 669.74829, 1614.14136, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 661.04987, 1583.28296, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 713.48926, 1573.93701, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(7676, 767.02893, 1564.54004, 330.41928, 0.00000, 0.00000, 349.86700); CreateObject(5012, 534.52936, 1661.96570, 319.67410, 0.00000, 0.00000, 173.02711); CreateObject(5012, 524.84546, 1571.33545, 319.67410, 0.00000, 0.00000, 354.11435); CreateObject(5012, 450.99847, 1670.07849, 319.67410, 0.00000, 0.00000, 173.02711); CreateObject(5012, 431.55783, 1580.33789, 319.67410, 0.00000, 0.00000, 354.11435); CreateObject(16357, 443.56567, 1623.86743, 319.42230, 0.00000, 0.00000, 353.58395); CreateObject(8841, 911.72144, 1535.70544, 330.19717, 0.00000, 0.00000, 52.64609); CreateObject(16302, 972.75549, 1485.30127, 331.93646, 0.00000, 0.00000, 0.00000); CreateObject(18245, 1030.10144, 1408.33594, 334.60480, 0.00000, 0.00000, 290.70731); CreateObject(10013, 1073.99670, 1359.83960, 324.01538, 0.00000, 0.00000, 277.52328); CreateObject(10046, 1062.05054, 1288.71692, 341.83090, 0.00000, 0.00000, 352.08386); CreateObject(4890, 1059.96838, 1201.78870, 320.45041, 0.00000, 0.00000, 247.17352); CreateObject(18783, 971.01660, 1088.19397, 173.30241, 0.00000, 0.00000, 359.62064); CreateObject(18783, 945.63354, 1121.41882, 247.72575, 0.00000, 0.00000, 0.00000); CreateObject(11083, 990.16504, 1115.63379, 122.45980, 0.00000, 0.00000, 180.68539); CreateObject(18783, 946.21985, 1087.57996, 199.39830, 0.00000, 0.00000, 359.62064); CreateObject(18783, 1024.51648, 1028.87280, 119.40350, 0.00000, 22.00000, 182.27490); CreateObject(16302, 1234.68408, 1110.98840, 122.13088, 0.00000, 0.00000, 359.89999); CreateObject(16302, 1233.20789, 1062.90710, 122.13088, 0.00000, 0.00000, 0.00000); CreateObject(16302, 1245.34058, 1070.66150, 122.13088, 0.00000, 0.00000, 0.00000); CreateObject(16302, 1258.59546, 1080.00586, 122.13088, 0.00000, 0.00000, 0.00000); CreateObject(16302, 1214.01465, 1096.34937, 122.13088, 0.00000, 0.00000, 359.89999); CreateObject(16302, 1223.89868, 1103.57336, 122.13088, 0.00000, 0.00000, 359.89999); CreateObject(4602, 1118.63794, 1059.95142, 120.55473, 0.00000, 0.00000, 11.63037); CreateObject(8214, 1179.13574, 1064.23987, 116.78378, 0.00000, 0.00000, 177.60768); CreateObject(4602, 1045.93616, 1058.06396, 120.55473, 0.00000, 0.00000, 0.00000); CreateObject(4602, 1079.49609, 1057.76685, 120.55473, 0.00000, 0.00000, 0.00000); CreateObject(8411, 1357.84705, 1203.75916, 106.73174, 0.00000, 0.00000, 242.88773); CreateObject(8411, 1316.61560, 1225.10950, 106.97115, 0.00000, 0.00000, 61.83709); CreateObject(969, 1454.18298, 1515.03467, 12.40023, 0.00000, 0.00000, 339.52145); CreateObject(3426, 227.95462, 1676.75513, 299.63708, 0.00000, 0.00000, 171.38361); CreateObject(3426, 264.03271, 1713.81775, 300.59317, 0.00000, 0.00000, 72.19189); CreateObject(3426, 246.48228, 1710.85205, 300.59317, 0.00000, 0.00000, 117.16326); CreateObject(3426, 232.50693, 1696.50964, 300.59317, 0.00000, 0.00000, 164.63281); CreateObject(3244, 251.93610, 1654.77820, 301.82269, 0.00000, 0.00000, 0.00000); CreateObject(3244, 256.58624, 1685.33997, 302.02371, 0.00000, 0.00000, 0.00000); CreateObject(3244, 254.78705, 1671.32141, 301.82269, 0.00000, 0.00000, 0.00000); CreateObject(9237, 292.05429, 1652.67761, 317.40405, 0.00000, 0.00000, 0.00000); CreateObject(9237, 276.29819, 1704.57324, 309.19547, 0.00000, 0.00000, 0.00000); CreateObject(9237, 279.23453, 1688.85974, 309.19547, 0.00000, 0.00000, 0.00000); CreateObject(9237, 277.97220, 1674.43396, 309.19547, 0.00000, 0.00000, 0.00000); CreateObject(9237, 276.48624, 1658.46765, 313.79074, 0.00000, 0.00000, 0.00000); CreateObject(984, 184.23752, 1678.56873, 294.90707, 0.00000, 0.00000, 354.85669); CreateObject(984, 185.50653, 1691.51379, 295.31317, 0.00000, 0.00000, 353.38916); CreateObject(1225, 186.76323, 1699.69067, 295.02396, 0.00000, 0.00000, 0.00000); CreateObject(984, 180.56090, 1645.18628, 294.99323, 0.00000, 0.00000, 355.98105); CreateObject(984, 177.84917, 1684.72375, 294.91815, 0.00000, 0.00000, 264.32080); // Checkpoints Checkpoint[1]CreateDynamicCP(541,642.5018,1601.4012,327, 2, -1, -1, -1, 100) return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 170.6894,1665.2310,295.6057); SetPlayerCameraPos(playerid, 180.7728,1663.3257,295.6057); SetPlayerCameraLookAt(playerid, 180.7728,1663.3257,295.6057); return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerEnterCheckpoint(playerid) { SetPlayerScore(playerid,1); GivePlayerMoney(playerid,1000); return 1; } public OnPlayerEnterDynamicCP(playerid, checkpointid) { if(checkpointid == Checkpoint[0]) //This checks what checkpoint it is before it continues { GameTextForPlayer(playerid, "You have entered this checkpoint", 4000, 5); //It will show this if a player steps in the checkpoint } } |
The highest array ID you can use is whatever you have defined it as minus 1.
So if you had done Checkpoint[5]
You could access index 0,1,2,3,4 but NOT 5.
So to fix your issues:
Change Checkpoint[1]CreateDynamicCP to Checkpoint[0] = CreateDynamicCP
Also you must also make sure you have a ; at the end of that line.
Also I see you have done (541,642)
Because they are co-ordinates, co-ordinates are floats, so a float requires a decimal point.
So you must do 541.0
Like this:
Checkpoint[0] = CreateDynamicCP(541.0,642.5018,1601.4012,327, 2, -1, -1, -1, 100);