//Route 101 has 14 stops
enum RouteData {Float:x, Float:y, Float:z}
new Route101[13][RouteData];
stock BusMissionsInit()
{
new i;
Route101[i][x] = 169.3567; Route101[i][y] = -1739.3060; Route101[i][z] = 4.4763; i++;
Route101[i][x] = 1196.5941; Route101[i][y] = -1855.5844; Route101[i][z] = 13.4955; i++;
Route101[i][x] = 1826.2672; Route101[i][y] = -2100.1414; Route101[i][z] = 13.4835; i++;
Route101[i][x] = 1964.9810; Route101[i][y] = -1768.8596; Route101[i][z] = 13.4783; i++;
Route101[i][x] = 2357.9417; Route101[i][y] = -1752.7144; Route101[i][z] = 13.4793; i++;
Route101[i][x] = 2639.3540; Route101[i][y] = -1771.4929; Route101[i][z] = 10.8091; i++;
Route101[i][x] = 2710.5073; Route101[i][y] = -2021.2656; Route101[i][z] = 13.4003; i++;
Route101[i][x] = 2861.2561; Route101[i][y] = -1911.4941; Route101[i][z] = 11.0386; i++;
Route101[i][x] = 2514.9006; Route101[i][y] = 45.1526; Route101[i][z] = 26.4297; i++;
Route101[i][x] = 1047.5758; Route101[i][y] = -949.7613; Route101[i][z] = 42.7522; i++;
Route101[i][x] = 218.2735; Route101[i][y] = -1361.7000; Route101[i][z] = 50.7355; i++;
Route101[i][x] = 752.9525; Route101[i][y] = -1583.7092; Route101[i][z] = 13.8202; i++;
Route101[i][x] = 403.8641; Route101[i][y] = -1655.8706; Route101[i][z] = 29.5599; i++;
Route101[i][x] = -132.1000; Route101[i][y] = -1650.4924; Route101[i][z] = 3.4956;
print("Bus Route: 101 --------------");
printf("Route101: %i stops created", i+1);
print("-----------------------------");
i = 0;
}
stop = pMission[playerid][busstop];
SetPlayerRaceCheckpoint(playerid, 0, Route101[stop][x], Route101[stop][y], Route101[stop][z], Route101[stop+1][x], Route101[stop+1][y], Route101[stop+1][z], C_SIZE);
new Route101[14][RouteData];
should be
pawn Код:
|
Numbering starts at 0 - and so 0 to 13 is 14 different integers
|
Numbering starts at 0 - and so 0 to 13 is 14 different integers
|
New XXX[5][]
XXX[0][] =
XXX[1][] =
XXX[2][] =
XXX[3][] =
XXX[4][] =
indeed, 0 to 13 are 14 values.
however, for dimension sizes you need to add one more to pawn. If your array size is supposed to hold 15 integers, you need to define 16. It's a fail I know, blame pawn. PS: I see you added i++; Compiler does not see i as a value, therefore it will not validate the dimension size and cause no error upon compiling. If you would replace every i with a non-var number, it will error on the last dimension as your code is. |
Correct,but pawn doesn't count the number you put in the brackets.
For example,if you want to have 5 diffrent arguments,then: PHP код:
PHP код:
it always does: -1<X<Y When X is the name of the argument (in your case: Route101) and Y is the number of arguments you want to have Got it? |
i++ is the same as doing i + 1 ? (Incrementing the value)
i is an integer variable + I never said it was erroring', i stated "not working" As i said... I think i have sorted it now anyway, i think my "busstop" variable wasn't getting assigned correctly - i haven't actually tested it yet as i am no longer at my house, however it is what i am thinking (i have all my scripts on a remote network so i can access them from anywhere ![]() |
i++ is the same as doing i + 1 ? (Incrementing the value)
i is an integer variable + I never said it was erroring', i stated "not working" As i said... I think i have sorted it now anyway, i think my "busstop" variable wasn't getting assigned correctly - i haven't actually tested it yet as i am no longer at my house, however it is what i am thinking (i have all my scripts on a remote network so i can access them from anywhere ![]() |
i++;
//as you said, i++ does assign original value +1 to i. does work as it is a standard part of usually any scripting/programming language.