[OFF TOPIC]Like title says I don't want people who don't know what their talking about giving dumb answers.[/OFF TOPIC]
[ON TOPIC]
Ok so what I want to know is which method is better for reading and speed.
Say you want to store two or more values per user that have to do with the same thing. What would be a better way of storing it. (Explained in detail below)
1) 2D array with player ID first then split into two or three
2) 2D array split in two or three then into player IDs
3) 2 or more different arrays of just player IDs
Method #1: 2D array Player first
(Code then diagram attached)
Code:
// [PLAYER][0] = how many kills
// [PALYER][1] = how many deaths
new g_PlayerStuff[33][2]
//....
console_print(id , "You have %d kills and %d deaths" , g_PlayerStuff[id][0] , g_PlayerStuff[id][1])
//... Or would this be better
new kills = g_PlayerStuff[id][0]
new deaths = g_PlayerStuff[id][1]
console_print(id , "You have %d kills and %d deaths" , kills , deaths)
Method #2: 2D array split first
(Code then diagram attached)
Code:
// [0][PLAYER] = how many kills
// [1][PLAYER] = how many deaths
new g_PlayerStuff[2][33]
//....
console_print(id , "You have %d kills and %d deaths" , g_PlayerStuff[0][id] , g_PlayerStuff[1][id])
//... Or would this be better
new kills = g_PlayerStuff[0][id]
new deaths = g_PlayerStuff[1][id]
console_print(id , "You have %d kills and %d deaths" , kills , deaths)
Method #3: 2 arrays
(Code then diagram attached)
Code:
new g_PlayerKills[33]
new g_PlayerDeaths[33]
//...
console_print(id , "You have %d kills and %d deaths" , g_PlayerKills[id] , g_PlayerDeaths[id])
Keep in mind that I'm not talking about just saving kills and deaths that was just the first things that came to mind when typing this for an example.