[Pawn] Getting the size of an array - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Getting the size of an array (/showthread.php?tid=1889) |
Getting the size of an array - Torque - 2021-04-16 I have a multi-dimensional array, and I want to get the size of each line. Code: new BusRoutes[][] = { Code: new const MaxStops[] = sizeof(BusRoutes[]); Code: format(sStops, sizeof(sStops), "Stops: 0/%d", MaxStops[vRoute]); If vRoute = 0, it works fine, but if it equals 1, the function crashes and it doesn't continue running the rest of the function. Something is wrong with MaxStops[vRoute] if vRoute equals anything other than 0. What am I doing wrong? RE: Getting the size of an array - Torque - 2021-04-16 For now I've had to do this... Code: new MaxStops[] = {11, 11}; It works but not really how I wanted to do it. RE: Getting the size of an array - Radical - 2021-04-16 Code: new const MaxStops[sizeof(BusRoutes)] = {11, 11}; RE: Getting the size of an array - Torque - 2021-04-16 (2021-04-16, 08:03 PM)Radical Wrote: That's kinda useless really. |