From 97d4c8a40aab7acce2cbc247b19da838f6971ee0 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 10 Oct 2018 14:50:16 +1100 Subject: [PATCH] modulize information pickups --- .../irresistible/cnr/features/_features.pwn | 1 + .../cnr/features/info_pickups.pwn | 54 +++++++++++++++++++ gamemodes/sf-cnr.pwn | 34 ------------ 3 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 gamemodes/irresistible/cnr/features/info_pickups.pwn diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index bc760ca..5e9183e 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -34,6 +34,7 @@ #include "irresistible\cnr\features\perks.pwn" #include "irresistible\cnr\features\weapon_locker.pwn" #include "irresistible\cnr\features\bribes.pwn" +#include "irresistible\cnr\features\info_pickups.pwn" // disabled // #include "irresistible\cnr\features\eastereggs.pwn" diff --git a/gamemodes/irresistible/cnr/features/info_pickups.pwn b/gamemodes/irresistible/cnr/features/info_pickups.pwn new file mode 100644 index 0000000..e7560f1 --- /dev/null +++ b/gamemodes/irresistible/cnr/features/info_pickups.pwn @@ -0,0 +1,54 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by Lorenc Pekaj + * Module: cnr\features\info_pickups.pwn + * Purpose: informational pickups located between features + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Variables ** */ +enum E_INFO_PICKUP_DATA +{ + Float: E_X, Float: E_Y, Float: E_Z, + E_PICKUP_ID, E_TEXT[ 128 ] +}; + +static stock + g_informationPickupsData [ ] [ E_INFO_PICKUP_DATA ] = + { + { -2118.1787, -77.9626, 35.3203, 0xFFFF, "{FFFFFF}Over here, you are able to complete trucking missions by attaching a trailer to your truck then going to /work!" }, // Trucking + { -2025.9523, -136.965, 35.2906, 0xFFFF, "{FFFFFF}Ever felt like breaking bad? Enter an RV as a passenger and begin to produce meth! Make sure you have the materials!" }, // Meth + { -1497.1375, 914.6858, 7.18750, 0xFFFF, "{FFFFFF}All civilians should bank their money, for their own protection and to save some money from tax!" }, // Bank + { -2450.2261, 752.2170, 35.1719, 0xFFFF, "{FFFFFF}Buy materials that can help you complete missions such as meth production, or buy other neccessary items!" }, // Supa + { -1589.4668, 115.8173, 3.54950, 0xFFFF, "{FFFFFF}Dirty Mechanics can export vehicles and receive money based on the material that can be taken from a vehicle!" }, // Car Jacker + { -2767.3765, 1257.077, 11.7703, 0xFFFF, "{FFFFFF}You can mine ores and store your ores in dunes for exportation! Grab the spade and hit the ore!" }, // Mining + { 1954.71890, 1038.251, 992.859, 0xFFFF, "{FFFFFF}Test out your luck on the slot machines, maybe you might win the mega jackpot!" }, // Slots + { 1955.69070, 1005.167, 992.468, 0xFFFF, "{FFFFFF}Roulette can payout up to $3.5M! Single bets return 35x your money whereas outside bets can return 2x to 3x!" }, // Roulette + { 2085.5896, 1239.4589, 414.745, 0xFFFF, "{FFFFFF}Buy materials at a co-nvience store and cook meth! Aim and shoot each ingredient to add them as you /meth cook!" } // Meth Cook + } +; + +/* ** Hooks ** */ +hook OnScriptInit( ) +{ + 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 ] ); + + // dont need map icons for interior infos + if ( g_informationPickupsData[ i ] [ E_Z ] < 800.0 ) { + CreateDynamicMapIcon( g_informationPickupsData[ i ] [ E_X ], g_informationPickupsData[ i ] [ E_Y ], g_informationPickupsData[ i ] [ E_Z ], 37, 0, -1, -1, -1, 50.0 ); + } + } + return 1; +} + +hook OnPlayerPickUpDynPickup( playerid, pickupid ) +{ + for( new i = 0; i < sizeof( g_informationPickupsData ); i++ ) if ( g_informationPickupsData[ i ] [ E_PICKUP_ID ] == pickupid ) { + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Area Information", g_informationPickupsData[ i ] [ E_TEXT ], "Okay", "" ), Y_HOOKS_BREAK_RETURN_1; + } + return 1; +} diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 43a011e..b2e9707 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -392,28 +392,6 @@ new g_alcatrazTimestamp = 0 ; -/* ** Information System ** */ -enum E_INFO_PICKUP_DATA -{ - Float: E_X, Float: E_Y, Float: E_Z, - E_PICKUP_ID, E_TEXT[ 128 ] -}; - -new - g_informationPickupsData [ ] [ E_INFO_PICKUP_DATA ] = - { - { -2118.1787, -77.9626, 35.3203, 0xFFFF, "{FFFFFF}Over here, you are able to complete trucking missions by attaching a trailer to your truck then going to /work!" }, // Trucking - { -2025.9523, -136.965, 35.2906, 0xFFFF, "{FFFFFF}Ever felt like breaking bad? Enter an RV as a passenger and begin to produce meth! Make sure you have the materials!" }, // Meth - { -1497.1375, 914.6858, 7.18750, 0xFFFF, "{FFFFFF}All civilians should bank their money, for their own protection and to save some money from tax!" }, // Bank - { -2450.2261, 752.2170, 35.1719, 0xFFFF, "{FFFFFF}Buy materials that can help you complete missions such as meth production, or buy other neccessary items!" }, // Supa - { -1589.4668, 115.8173, 3.54950, 0xFFFF, "{FFFFFF}Dirty Mechanics can export vehicles and receive money based on the material that can be taken from a vehicle!" }, // Car Jacker - { -2767.3765, 1257.077, 11.7703, 0xFFFF, "{FFFFFF}You can mine ores and store your ores in dunes for exportation! Grab the spade and hit the ore!" }, // Mining - { 1954.71890, 1038.251, 992.859, 0xFFFF, "{FFFFFF}Test out your luck on the slot machines, maybe you might win the mega jackpot!" }, // Slots - { 1955.69070, 1005.167, 992.468, 0xFFFF, "{FFFFFF}Roulette can payout up to $3.5M! Single bets return 35x your money whereas outside bets can return 2x to 3x!" }, // Roulette - { 2085.5896, 1239.4589, 414.745, 0xFFFF, "{FFFFFF}Buy materials at a co-nvience store and cook meth! Aim and shoot each ingredient to add them as you /meth cook!" } // Meth Cook - } -; - /* ** Rank System ** */ enum E_RANK_DATA { @@ -565,16 +543,6 @@ public OnGameModeInit() initializeObjects( ); initializeActors( ); - /* ** Loading default string values - Makes it efficient. ** */ - 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 ] ); - - // dont need map icons for interior infos - if ( g_informationPickupsData[ i ] [ E_Z ] < 800.0 ) - CreateDynamicMapIcon( g_informationPickupsData[ i ] [ E_X ], g_informationPickupsData[ i ] [ E_Y ], g_informationPickupsData[ i ] [ E_Z ], 37, 0, -1, -1, -1, 50.0 ); - } - /* ** Server Variables ** */ AddServerVariable( "taxtime", "0", GLOBAL_VARTYPE_INT ); AddServerVariable( "taxrate", "1.0", GLOBAL_VARTYPE_FLOAT ); @@ -10212,8 +10180,6 @@ public OnPlayerPickUpDynamicPickup( playerid, pickupid ) GetPlayerPos( playerid, p_LastPickupPos[ playerid ] [ 0 ], p_LastPickupPos[ playerid ] [ 1 ], p_LastPickupPos[ playerid ] [ 2 ] ); // Information Pickups - for( new i = 0; i < sizeof( g_informationPickupsData ); i++ ) if ( g_informationPickupsData[ i ] [ E_PICKUP_ID ] == pickupid ) - return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{FFFFFF}Area Information", g_informationPickupsData[ i ] [ E_TEXT ], "Okay", "" ); // Money bag from atms if ( p_Class[ playerid ] != CLASS_POLICE ) {