01.03.2017, 23:41
Quote:
Hello. I'm wondering if it's not better to make a gameode with only include.
Example: - MainFolder -- Players --- VariablesSaveLoading --- Other -- Vehicle ... And all of them included in one gamemode. |
Code:
- {Name of Project} (Folder) - Config ( Core ) - base.pwn ( Global Definitions, MySQL, Server Settings ) - macros.pwn ( Global Macros for shortcuts like FUNCTION: and PUBLIC: ) - plugins.pwn ( Global Plugin Definitions ) - Player ( Module ) // The Prefix will be PD for PLAYER_DATA the name of the ENUM ( E_PLAYER_DATA ) - init.pwn ( Includes, Initialize and Deinitialize functions ) - config.pwn ( Enums, Definitions, Variables ) - functions.pwn ( IsPlayerLoggedIn, etc ) - database.pwn ( DB Functions / Threaded Query ) - callbacks.pwn ( Prefixed Names, PD_OnPlayerConnect ) - dialogs.pwn ( Functions / Responses ) - textdraws.pwn ( Functions / Callbacks ) - commands.pwn ( Player / Admin Commands ) // You can just add a file for each section, pickups / objects, etc bootstrap.pwn // includes all modules and core files, so main gamemode only needs to include this file.
As for your mysql idea I find this to be a better way.
Code:
#define ENVIORNMENT ( 0 ) // 0 - Production, 1 - Local Development, 2 - Remote Development #define MYSQL_REMOTE_HOST "xxx.xxx.xxx.xxxx" #define MYSQL_REMOTE_USER "server_name" #define MYSQL_REMOTE_PASS "server_password" #define MYSQL_REMOTE_TABLE "server_table" #define MYSQL_LOCAL_HOST "xxx.xxx.xxx.xxxx" #define MYSQL_LOCAL_USER "server_name" #define MYSQL_LOCAL_PASS "server_password" #define MYSQL_LOCAL_TABLE "server_table" #define MYSQL_PRODUCTION_HOST "xxx.xxx.xxx.xxxx" #define MYSQL_PRODUCTION_USER "server_name" #define MYSQL_PRODUCTION_PASS "server_password" #define MYSQL_PRODUCTION_TABLE "server_table" // Now depending on how much you care, not that it makes much difference that you should, you can either use #if and #endif // or you can a switch statment, I prefer swtich as it looks cleaner, and I love clean code. new database_connection ; stock mysql_connect_ex() { switch( ENVIORNMENT ) { case 0: database_connection = mysql_connect( MYSQL_PRODUCTION_HOST, MYSQL_PRODUCTION_USER, MYSQL_PRODUCTION_PASS, MYSQL_PRODUCTION_TABLE ); case 1: database_connection = mysql_connect( MYSQL_LOCAL_HOST, MYSQL_LOCAL_USER, MYSQL_LOCAL_PASS, MYSQL_LOCAL_TABLE ); case 2: database_connection = mysql_connect( MYSQL_REMOTE_HOST, MYSQL_REMOTE_USER, MYSQL_REMOTE_PASS, MYSQL_REMOTE_TABLE ); } return database_connection; }