From 039452310df2de68ab10a709ac03c7bd8a0f4229 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 13:58:21 +1000 Subject: [PATCH] move garage code to module --- .../irresistible/cnr/features/vehicles/garages.pwn | 12 ++++++++++++ gamemodes/sf-cnr.pwn | 5 +---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/vehicles/garages.pwn b/gamemodes/irresistible/cnr/features/vehicles/garages.pwn index bf3d0ad..2b046aa 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/garages.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/garages.pwn @@ -53,6 +53,18 @@ new ; /* ** Hooks ** */ +hook OnScriptInit( ) +{ + // format garage interior list + for( new i = 0; i < sizeof( g_garageInteriorData ); i++ ) { + format( szg_garageInteriors, sizeof( szg_garageInteriors ), "%s"COL_GREY"%d Vehicle Slots"COL_WHITE"\t%s\n", szg_garageInteriors, g_garageInteriorData[ i ] [ E_VEHICLE_CAPACITY ], g_garageInteriorData[ i ] [ E_NAME ] ); + } + + // load all garages + mysql_function_query( dbHandle, "SELECT * FROM `GARAGES`", true, "OnGaragesLoad", "" ); + return 1; +} + hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { if ( dialogid == DIALOG_GARAGE_INTERIORS ) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 0390cea..8ee4a02 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1270,9 +1270,6 @@ public OnGameModeInit() initializeActors( ); /* ** Loading default string values - Makes it efficient. ** */ - for( new i = 0; i < sizeof( g_garageInteriorData ); i++ ) - format( szg_garageInteriors, sizeof( szg_garageInteriors ), "%s"COL_GREY"%d Vehicle Slots"COL_WHITE"\t%s\n", szg_garageInteriors, g_garageInteriorData[ i ] [ E_VEHICLE_CAPACITY ], g_garageInteriorData[ i ] [ E_NAME ] ); - for( new i = 0; i < sizeof( g_informationPickupsData ); i++ ) { g_informationPickupsData[ i ] [ E_PICKUP_ID ] = CreateDynamicPickup( 1239, 2, g_informationPickupsData[ i ] [ E_X ], g_informationPickupsData[ i ] [ E_Y ], g_informationPickupsData[ i ] [ E_Z ] ); @@ -6072,7 +6069,7 @@ CMD:business( playerid, params[ ] ) new iBusiness = p_InBusiness[ playerid ]; - + if ( strmatch( params, "production" ) ) { new