Skip to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Multidimensional array

Alloah, ben gisteren begonnen met het maken van een filterscript, alleen nu heb ik een multidimensional array gedefinieerd maar zodra ik die oproep in een functie krijg ik deze error:

C:\Program Files\Rockstar Games\GTA San Andreas\0.3a server\filterscripts\PilotLicense.pwn(131) : error 032: array index out of bounds (variable "FlyTestCP")

Define van de array:

new Float:FlyTestCP[20][3] = {
   {257.1651,2508.2122,16.5047},
   {-127.0627,2517.6953,46.9269},
   {-547.6826,2556.5046,184.3824},
   {-919.9048,2302.9580,184.9747},
   {-749.1210,1695.7488,116.3763},
   {-1218.6206,1892.7733,125.4685},
   {-1379.3143,1706.3347,147.4738},
   {-1321.4351,1271.2864,86.0102},
   {-1229.5548,1007.7960,22.6440},
   {-1255.9113,766.3859,21.0479},
   {-740.1656,689.8198,76.5668},
   {-496.8089,1020.9858,138.1212},
   {-445.8265,1571.4210,107.3225},
   {-82.9444,2028.1719,115.5062},
   {904.9605,2121.4063,104.8068},
   {1422.8862,2230.7278,106.8927},
   {1497.1420,2453.4663,118.2686},
   {1261.9971,2505.5671,128.4034},
   {77.1831,2504.8533,17.0651},
   {291.4622,2539.2800,17.5359}
};

Regel van de error:

SetPlayerRaceCheckpoint(playerid, 0, FlyTestCP[1][1], FlyTestCP[1][2], FlyTestCP[1][3], FlyTestCP[2][1], FlyTestCP[2][2], FlyTestCP[2][3], 10.0);

Ik snap de error wel maar ik zie de fout dus niet. Heb al gekeken in pawn-lang.pdf maar daar word ik ook niet wijzer van :7

Featured Replies

Als je een slot van 3 gebruikt, is slot nr 3 invalid. Volgens de SA:MP wiki zou je server er zelfs door kunnen crashen, als je het voor elkaar krijgt het te compilen. Als je een array maakt van 3 groot, zijn de getallen 0, 1, en 2 beschikbaar. Daarom zou je dus je error regel iets moeten aanpassen.

SetPlayerRaceCheckpoint(playerid, 0, FlyTestCP[1][0], FlyTestCP[1][1], FlyTestCP[1][2], FlyTestCP[2][0], FlyTestCP[2][1], FlyTestCP[2][2], 10.0);

  • Author

Hmm raar. Maar goed het werkt nu wel in ieder geval. Maar kan je wel multidimensionale arrays maken van 4 of meer slots dan, en dat gaat zeker zo [1][0], [1][1], [1][2], [1][3]?

Edited by JayKay

new array[3];

Zal de volgende slots hebben:

0 1 2

En:

new array[4];
0 1 2 3

new array[5];
0 1 2 3 4

Enzovoort.

  • Author

Ja ik zie dat ik niet echt duidelijk ben geweest, bedoelde een multidimensionale array (sorry :$) :7

(zie edit vorige post ;) )

Edited by JayKay

Met

new array[5][3];

Zijn de volgende slots te gebruiken:

[0][0]
[0][1]
[0][2]
[1][0]
[1][1]
[1][2]
[2][0]
[2][1]
[2][2]
[3][0]
[3][1]
[3][2]
[4][0]
[4][1]
[4][2]

5 x 3 = 15 slots in totaal dus.

Edited by Sandra
Klein typfoutje gecorrigeerd in laatse array

  • Author

Juist! Weer iets geleerd! Bedankt, nu kan ik weer lekker door ^_^ (hier krijg je tenminste lekker snel antwoord, op het SA:MP forum duurt het meestal wel een dag of 2 :7)

Edited by JayKay

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.