Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Example of a 3D array made by BigETIĀ©
- //This time we want to store float values into the 3D array
- new SituationID; //Lets make a situation like example Race Map ID
- enum ArrayInfos //Start with enum to use them later to get more easier the values from the array field
- {
- Float:CPINFO_X,
- Float:CPINFO_Y,
- Float:CPINFO_Z,
- }
- new array[][][ArrayInfos] = //our array variable
- {
- {
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,}, // The amount of 1D arrays (look left) should be the same as the ones below
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,} //
- }, //<-- Important! Use comma if you want to add another 2D array field
- {
- {2.00, 5.00, 11.05,}, //
- {123.40, 0.20, 0.04,}, //
- {12.00, 0.01, 0.30,}, // Same Here but as we see we can write another values inside the array field.
- {-12.00, 0.60, 0.99,}, //
- {2.50, 0.00, 10.99,} //
- }, //<-- still the same as above..
- //Add here more if you want...
- {
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,}, // Just the same as above
- {0.00, 0.00, 0.00,}, //
- {0.00, 0.00, 0.00,} //
- } //<-- Here you shouldn't use a comma if you don't want to add another 2D array field below.
- }; //<-- End!
- //Somewhere in your script..
- //Lets just create a CP
- SetPVarInt(playerid, "CPID", GetPVarInt(playerid, "CPID")+1);
- SetPlayerRaceCheckpoint(playerid, 0, array[SituationID][GetPVarInt(playerid, "CPID")][CPINFO_X],
- array[SituationID][GetPVarInt(playerid, "CPID")][CPINFO_Y],
- array[SituationID][GetPVarInt(playerid, "CPID")][CPINFO_Z],
- array[SituationID][GetPVarInt(playerid, "CPID")+1][CPINFO_X],
- array[SituationID][GetPVarInt(playerid, "CPID")+1][CPINFO_Y],
- array[SituationID][GetPVarInt(playerid, "CPID")+1][CPINFO_Z]);
- //Hope this one helped you how to create and use 3D arrays
Advertisement
Add Comment
Please, Sign In to add comment