09.05.2018, 20:05
Yes it's very possible, everything is possible in coding!
You just need arrays instead of macros which are constants and you cannot change constants.
Here is a relative example: (note: i haven't used mysql in a while, syntax can be different in latest version)
You just need arrays instead of macros which are constants and you cannot change constants.
Here is a relative example: (note: i haven't used mysql in a while, syntax can be different in latest version)
PHP код:
#define MAX_MESSAGES 10
#define MAX_MESSAGE_SIZE 144
new myMessages[MAX_MESSAGES][MAX_MESSAGE_SIZE];
public OnGameModeInit() {
new mySQL = mysql_connect(...);
mysql_tquery(mySQL,
"SELECT * FROM your_table LIMIT "#MAX_MESSAGS"",
"OnMessagesLoad", "\1"
);
}
forward OnMessageLoad();
public OnMessageLoad() {
for (new i = 0; i < cache_get_row_count(); i++) {
cache_get_field_content(i, "field_name", myMessages[i], MAX_MESSAGE_SIZE);
}
// now you have all messages saved in your array "myMessages"
// to access them, say print a message at index 5
printf("message 5: %s", myMessage[5]);
}