From 44126503711988abb08efd4281c266da915d47a7 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 13:31:44 +0100 Subject: [PATCH 1/9] vehicle dealership spawn location fixes --- .../cnr/features/vehicles/vdealership.pwn | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn b/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn index f3ceddb..bc1b3c8 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vdealership.pwn @@ -250,8 +250,8 @@ hook OnScriptInit( ) g_VehicleDealerCP[ 2 ] = CreateDynamicCP( 540.7507, -1299.1378, 17.2859, 1.0, -1, -1, -1, 25.0 ); CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, -1867.9092, -646.3469, 1002.1284, 20.0 ); - CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, 540.7507, -1299.1378, 17.2859, 20.0 ); CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, -126.2794, 117.3427, 1004.7233, 20.0 ); + CreateDynamic3DTextLabel( "[PURCHASE VEHICLE]", COLOR_GOLD, 540.7507, -1299.1378, 17.2859, 20.0 ); return 1; } @@ -323,24 +323,25 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) new Float: X, Float: Y, Float: Z, Float: fA; // set teleport vehicle location - if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 0 ] ) ) // LV? + + if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 0 ] ) ) // SF { - if ( IsBoatVehicle( model ) ) X = 1633.71860, Y = 563.73600, Z = -0.0579, fA = 90.00000; + if ( IsBoatVehicle( model ) ) X = -2686.6484, Y = -938.5189, Z = -0.1212, fA = 109.4955; + else if ( IsAirVehicle( model ) ) X = -1666.2905, Y = -173.4397, Z = 15.0692, fA = 314.6289; + else X = -2518.9045, Y = -614.8578, Z = 132.302, fA = 267.8874; + } + else if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 1 ] ) ) // LS + { + if ( IsBoatVehicle( model ) ) X = 728.4574, Y = -1516.2633, Z = 0.3122, fA = 178.5724; + else if ( IsAirVehicle( model ) ) X = 2048.7910, Y = -2493.8928, Z = 14.4686, fA = 90.00000; + else X = 560.9333, Y = -1267.5469, Z = 16.9957, fA = 17.2539; + } + else if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 2 ] ) ) // LV? + { + if ( IsBoatVehicle( model ) ) X = 1633.71860, Y = 563.73600, Z = -0.0579, fA = 90.00000; else if ( IsAirVehicle( model ) ) X = 1477.43920, Y = 1761.4778, Z = 11.2735, fA = 180.9139; else X = 1986.85240, Y = 2049.2278, Z = 10.8203, fA = 132.5364; } - else if ( IsPlayerInDynamicCP( playerid, g_VehicleDealerCP[ 1 ] ) ) // LS? - { - if ( IsBoatVehicle( model ) ) X = 728.4574, Y = -1516.2633, Z = 0.3122, fA = 178.5724; - else if ( IsAirVehicle( model ) ) X = 2048.7910, Y = -2493.8928, Z = 14.4686, fA = 90.00000; - else X = 560.9333, Y = -1267.5469, Z = 16.9957, fA = 17.2539; - } - else // SF - { - if ( IsBoatVehicle( model ) ) X = -2686.6484, Y = -938.5189, Z = -0.1212, fA = 109.4955; - else if ( IsAirVehicle( model ) ) X = -1666.2905, Y = -173.4397, Z = 15.0692, fA = 314.6289; - else X = -2518.9045, Y = -614.8578, Z = 132.302, fA = 267.8874; - } SetPlayerInterior( playerid, 0 ); SetPlayerVirtualWorld( playerid, 0 ); From 9187922b287655878d4754d8d728416634bd85a0 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 13:37:20 +0100 Subject: [PATCH 2/9] adds blown jail, blown vaults, hit's completed and fires in /highscore --- gamemodes/sf-cnr.pwn | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 1a0c41b..f6acb61 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -5338,7 +5338,7 @@ CMD:irresistiblecoins( playerid, params[ ] ) CMD:top( playerid, params[ ] ) return cmd_highscores( playerid, params ); CMD:highscores( playerid, params[ ] ) { - ShowPlayerDialog( playerid, DIALOG_HIGHSCORES, DIALOG_STYLE_LIST, "{FFFFFF}Highscores", "Seasonal Rank\nTotal Score\nTotal Kills\nTotal Arrests\nTotal Robberies", "Select", "Close" ); + ShowPlayerDialog( playerid, DIALOG_HIGHSCORES, DIALOG_STYLE_LIST, "{FFFFFF}Highscores", "Seasonal Rank\nTotal Score\nTotal Kills\nTotal Arrests\nTotal Robberies\nHits Completed\nFires Extinguished\nBurglaries\nBlown Jails\nBlown Vaults", "Select", "Close" ); return 1; } @@ -14352,10 +14352,25 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) // total robberies case 4: mysql_function_query( dbHandle, "SELECT `NAME`, `ROBBERIES` as `SCORE_VAL` FROM `USERS` ORDER BY `ROBBERIES` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 4 ); + // hits completed + case 5: mysql_function_query( dbHandle, "SELECT `NAME`, `CONTRACTS` as `SCORE_VAL` FROM `USERS` ORDER BY `CONTRACTS` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 5 ); + + // fires + case 6: mysql_function_query( dbHandle, "SELECT `NAME`, `FIRES` as `SCORE_VAL` FROM `USERS` ORDER BY `FIRES` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 6 ); + + // burglaries + case 7: mysql_function_query( dbHandle, "SELECT `NAME`, `BURGLARIES` as `SCORE_VAL` FROM `USERS` ORDER BY `BURGLARIES` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 7 ); + + // blown jails + case 8: mysql_function_query( dbHandle, "SELECT `NAME`, `BLEW_JAILS` as `SCORE_VAL` FROM `USERS` ORDER BY `BLEW_JAILS` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 8 ); + + // blown vaults + case 9: mysql_function_query( dbHandle, "SELECT `NAME`, `BLEW_VAULT` as `SCORE_VAL` FROM `USERS` ORDER BY `BLEW_VAULT` DESC LIMIT 25", true, "OnHighScoreCheck", "ii", playerid, 9 ); + } } if ( dialogid == DIALOG_HIGHSCORES_BACK && ! response ) { - return ShowPlayerDialog( playerid, DIALOG_HIGHSCORES, DIALOG_STYLE_LIST, "{FFFFFF}Highscores", "Seasonal Rank\nTotal Score\nTotal Kills\nTotal Arrests\nTotal Robberies", "Select", "Close" ); + return ShowPlayerDialog( playerid, DIALOG_HIGHSCORES, DIALOG_STYLE_LIST, "{FFFFFF}Highscores", "Seasonal Rank\nTotal Score\nTotal Kills\nTotal Arrests\nTotal Robberies\nHits Completed\nFires Extinguished\nBurglaries\nBlown Jails\nBlown Vaults", "Select", "Close" ); } return 1; } @@ -14381,6 +14396,11 @@ thread OnHighScoreCheck( playerid, highscore_item ) case 2: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Kills\n", szSmallString = "Top 25 Kills"; case 3: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Arrests\n", szSmallString = "Top 25 Arrests"; case 4: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Robberies\n", szSmallString = "Top 25 Robberies"; + case 5: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Contracts\n", szSmallString = "Top 25 Hits Completed"; + case 6: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Fires\n", szSmallString = "Top 25 Fires Extinguished"; + case 7: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Burglaries\n", szSmallString = "Top 25 Burglaries"; + case 8: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Jailes\n", szSmallString = "Top 25 Blown Jails"; + case 9: szLargeString = ""COL_GOLD"Player\t"COL_GOLD"Vaults\n", szSmallString = "Top 25 Blown Vaults"; } for ( new row = 0; row < rows; row ++ ) From 0f6e2a18a03a40c22db448fa40cb3c29620f6aa2 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 13:43:40 +0100 Subject: [PATCH 3/9] re-worded the attacking turf message --- gamemodes/sf-cnr.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index f6acb61..23b97a8 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -8870,7 +8870,7 @@ CMD:takeover( playerid, params[ ] ) GetZoneFromCoordinates( szLocation, min_x, min_y ); - SendClientMessageToGang( g_gangTurfData[ z ] [ E_OWNER ], g_gangData[ g_gangTurfData[ z ] [ E_OWNER ] ] [ E_COLOR ], "[GANG]{FFFFFF} Our territory at %s is being attacked by "COL_GREY"%s"COL_WHITE", defend it!", g_gangData[ g_gangzoneAttacker[ z ] ] [ E_NAME ] ); + SendClientMessageToGang( g_gangTurfData[ z ] [ E_OWNER ], g_gangData[ g_gangTurfData[ z ] [ E_OWNER ] ] [ E_COLOR ], "[GANG]"COL_WHITE" Our territory is being attacked by "COL_GREY"%s"COL_WHITE" in %s, defend it!", g_gangData[ g_gangzoneAttacker[ z ] ] [ E_NAME ], szLocation ); } } else From d1f4ab1ecb2e08eb4e6ca01430c57456fdc3b004 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 13:58:52 +0100 Subject: [PATCH 4/9] reformatted paintball edit dialog added a chat toggle option to enable/disable pb chat --- .../irresistible/cnr/features/paintball.pwn | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/paintball.pwn b/gamemodes/irresistible/cnr/features/paintball.pwn index 1606de8..1b47c9b 100644 --- a/gamemodes/irresistible/cnr/features/paintball.pwn +++ b/gamemodes/irresistible/cnr/features/paintball.pwn @@ -24,7 +24,7 @@ enum E_PAINTBALL_DATA E_LIMIT, E_WEAPONS[ 3 ], E_PLAYERS, E_ARENA, Float: E_ARMOUR, Float: E_HEALTH, bool: E_ACTIVE, bool: E_PASSWORDED, bool: E_REFILLER, - E_CD_TIMER, bool: E_HEADSHOT + E_CD_TIMER, bool: E_HEADSHOT, bool: E_CHAT }; enum E_PAINTBALL_ARENAS @@ -178,6 +178,13 @@ hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) SendClientMessageToPaintball( iLobby, -1, ""COL_GREY"[PAINTBALL]"COL_WHITE" Headshot mode has been %s.", g_paintballData[ iLobby ] [ E_HEADSHOT ] == false ? ( "un-toggled" ) : ( "toggled" ) ); showPaintBallLobbyData( playerid, iLobby ); } + case 11: + { + new iLobby = p_PaintBallArena{ playerid }; + g_paintballData[ iLobby ] [ E_CHAT ] = !g_paintballData[ iLobby ] [ E_CHAT ]; + SendClientMessageToPaintball( iLobby, -1, ""COL_GREY"[PAINTBALL]"COL_WHITE" Upon death, armour and/or health will%s be restored.", g_paintballData[ iLobby ] [ E_CHAT ] == false ? ( " not" ) : ( "" ) ); + showPaintBallLobbyData( playerid, iLobby ); + } } } else @@ -417,12 +424,21 @@ stock listPaintBallLobbies( playerid ) stock showPaintBallLobbyData( playerid, id, second_button[ ] = "Join Game" ) { - format( szLargeString, sizeof( szLargeString ), "Lobby Name\t\t"COL_GREY"%s"COL_WHITE"\nLobby Password\t%s"COL_WHITE"\nPlayer Capacity\t\t"COL_GREY"%d"COL_WHITE"\nHealth\t\t\t"COL_GREY"%0.2f%%"COL_WHITE"\nArmour\t\t\t"COL_GREY"%0.2f%%"COL_WHITE"\nRefill Health/Armour\t%s"COL_WHITE"\nArena\t\t\t"COL_GREY"%s"COL_WHITE"\nPrimary Weapon\t"COL_GREY"%s"COL_WHITE"\nSecondary Weapon\t"COL_GREY"%s"COL_WHITE"\nTertiary Weapon\t"COL_GREY"%s"COL_WHITE"\nHeadshot Mode\t"COL_GREY"%s", - g_paintballData[ id ] [ E_NAME ], g_paintballData[ id ] [ E_PASSWORDED ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ), g_paintballData[ id ] [ E_LIMIT ], g_paintballData[ id ] [ E_HEALTH ], g_paintballData[ id ] [ E_ARMOUR ], g_paintballData[ id ] [ E_REFILLER ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ), g_paintballArenaData[ g_paintballData[ id ] [ E_ARENA ] ] [ E_NAME ], - ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 0 ] ), ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 1 ] ), ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 2 ] ), - g_paintballData[ id ] [ E_HEADSHOT ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ) + format( szLargeString, sizeof( szLargeString ), "Lobby Name\t"COL_GREY"%s"COL_WHITE"\nLobby Password\t%s"COL_WHITE"\nPlayer Capacity\t"COL_GREY"%d"COL_WHITE"\nHealth\t"COL_GREY"%0.2f%%"COL_WHITE"\nArmour\t"COL_GREY"%0.2f%%"COL_WHITE"\nRefill Health/Armour\t%s"COL_WHITE"\nArena\t"COL_GREY"%s"COL_WHITE"\nPrimary Weapon\t"COL_GREY"%s"COL_WHITE"\nSecondary Weapon\t"COL_GREY"%s"COL_WHITE"\nTertiary Weapon\t"COL_GREY"%s"COL_WHITE"\nHeadshot Mode\t"COL_GREY"%s"COL_WHITE"\nChat\t"COL_GREY"%s", + g_paintballData[ id ] [ E_NAME ], + g_paintballData[ id ] [ E_PASSWORDED ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ), + g_paintballData[ id ] [ E_LIMIT ], + g_paintballData[ id ] [ E_HEALTH ], + g_paintballData[ id ] [ E_ARMOUR ], + g_paintballData[ id ] [ E_REFILLER ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ), + g_paintballArenaData[ g_paintballData[ id ] [ E_ARENA ] ] [ E_NAME ], + ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 0 ] ), + ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 1 ] ), + ReturnWeaponName( g_paintballData[ id ] [ E_WEAPONS ] [ 2 ] ), + g_paintballData[ id ] [ E_HEADSHOT ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ), + g_paintballData[ id ] [ E_CHAT ] == true ? ( ""COL_GREEN"ENABLED" ) : ( ""COL_RED"DISABLED" ) ); - ShowPlayerDialog( playerid, DIALOG_PAINTBALL_EDIT, DIALOG_STYLE_LIST, "{FFFFFF}Paintball - Lobby Settings", szLargeString, "Change", second_button ); + ShowPlayerDialog( playerid, DIALOG_PAINTBALL_EDIT, DIALOG_STYLE_TABLIST, "{FFFFFF}Paintball - Lobby Settings", szLargeString, "Change", second_button ); } stock ShowPlayerPaintballArenas( playerid ) @@ -644,6 +660,7 @@ CMD:p( playerid, params[ ] ) if ( sscanf( params, "s[90]", msg ) ) return SendUsage( playerid, "/p [MESSAGE]" ); else if ( textContainsIP( msg ) ) return SendServerMessage( playerid, "Please do not advertise." ); + else if ( !g_paintballData[ id ] [ E_CHAT ] ) return SendError( playerid, "Paintball chat is disabled in this lobby." ); else { SendClientMessageToPaintball( id, -1, ""COL_GREY" %s(%d):"COL_WHITE" %s", ReturnPlayerName( playerid ), playerid, msg ); From 5f300a6cd22a5d1f1ea6bb15fbbaa073945b6c92 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 20:26:33 +0100 Subject: [PATCH 5/9] LEO's can't MMB to taze/cuff/arrest whie they have spawn protection active --- gamemodes/sf-cnr.pwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 4ac6765..aa002ca 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1463,6 +1463,8 @@ public OnPlayerEditDynamicObject( playerid, objectid, response, Float:x, Float:y ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" ); } } + + return 1; } @@ -11415,7 +11417,7 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) // taze mechanism else if ( PRESSED( KEY_LOOK_BEHIND ) ) { - if ( p_Class[ playerid ] == CLASS_POLICE ) + if ( p_Class[ playerid ] == CLASS_POLICE && p_AntiSpawnKillEnabled{ playerid }) { new closestid = GetClosestPlayer( playerid ); From 108fc055a6525eb18be1afff66e488bd11faf26e Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 20:53:05 +0100 Subject: [PATCH 6/9] adds /smoke into animations --- gamemodes/irresistible/cnr/features/animations.pwn | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/animations.pwn b/gamemodes/irresistible/cnr/features/animations.pwn index 803c045..0140153 100644 --- a/gamemodes/irresistible/cnr/features/animations.pwn +++ b/gamemodes/irresistible/cnr/features/animations.pwn @@ -89,6 +89,7 @@ hook OnPlayerFirstSpawn( playerid ) PreloadAnimationLibrary( playerid, "INT_HOUSE" ); PreloadAnimationLibrary( playerid, "MISC" ); PreloadAnimationLibrary( playerid, "POOL" ); + PreloadAnimationLibrary( playerid, "SMOKING" ); return 1; } @@ -275,6 +276,12 @@ CMD:handsup( playerid, params[ ] ) return 1; } +CMD:smoke( playerid, params[ ] ) +{ + CreateLoopingAnimation( playerid, "SMOKING", "M_smk_in", 4.0, 1, 0, 0, 0, 0 ); + return 1; +} + CMD:cower( playerid, params[ ] ) { CreateLoopingAnimation( playerid, "PED", "COWER", 4.0, 1, 0, 0, 0, 0 ); From 09a8cfe1aff1d7a2d4e2e6c9ab66e4e3a46b2d7e Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 20:58:49 +0100 Subject: [PATCH 7/9] change to firefighter into different homes http://forum.sfcnr.com/showthread.php?48467-Fires-amp-Burglary-system-in-LS-amp-LV --- gamemodes/sf-cnr.pwn | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index aa002ca..94b2549 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -15814,7 +15814,7 @@ stock GetRandomCreatedHouse( ) return -1; } - static szCity[ MAX_ZONE_NAME ]; + //static szCity[ MAX_ZONE_NAME ]; new ignoredHomes[ MAX_HOUSES ] = { -1, ... }; // first find homes to ignore @@ -15833,11 +15833,11 @@ stock GetRandomCreatedHouse( ) } // San Fierro only - Get2DCity( szCity, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] ); - if ( ! strmatch( szCity, "San Fierro" ) ) { - ignoredHomes[ i ] = i; - continue; - } + // Get2DCity( szCity, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] ); + // if ( ! strmatch( szCity, "San Fierro" ) ) { + // ignoredHomes[ i ] = i; + // continue; + // } } new From 41b8c22061e238e7f99786a65f37ed49e0b04a6b Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 21:47:10 +0100 Subject: [PATCH 8/9] adds burglary checkpoint and vehicles in other cities LS and LV --- gamemodes/sf-cnr.pwn | 47 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 94b2549..9bde163 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -9888,15 +9888,54 @@ public OnPlayerDriveVehicle( playerid, vehicleid ) format( szSmallString, sizeof( szSmallString ), "vburg_%d_items", vehicleid ); if ( GetGVarInt( szSmallString ) > 0 ) { + new + Float: X, Float: Y, Float: Z, + Float: pX, Float: pY, Float: pZ; + + GetPlayerPos( playerid, pX, pY, pZ ); + Beep( playerid ); GameTextForPlayer( playerid, "Go to the truck blip on your radar for money!", 3000, 1 ); SendServerMessage( playerid, "Note! You have %d stolen goods that you can export for money!", GetGVarInt( szSmallString ) ); - static aPlayer[ 1 ]; aPlayer[ 0 ] = playerid; - DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] ); - p_PawnStoreMapIcon[ playerid ] = CreateDynamicMapIconEx( -2480.2461, 6.0720, 25.6172, 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); + static + szCity[ MAX_ZONE_NAME ], + aPlayer[ 1 ]; - p_PawnStoreExport[ playerid ] = CreateDynamicRaceCP( 1, -2480.2461, 6.0720, 25.6172, 0.0, 0.0, 0.0, 4.0, -1, -1, playerid ); + aPlayer[ 0 ] = playerid; + DestroyDynamicMapIcon( p_PawnStoreMapIcon[ playerid ] ); + + //static ; + // San Fierro only + // Get2DCity( szCity, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] ); + // if ( ! strmatch( szCity, "San Fierro" ) ) { + // ignoredHomes[ i ] = i; + // continue; + // } + + Get2DCity( szCity, pX, pY, pZ ); + + if ( strmatch( szCity, "San Fierro" ) ) + { + X = -2480.2461; + Y = 6.0720; + Z = 25.6172; + } + else if ( strmatch( szCity, "Los Santos" ) ) + { + X = 2522.1677; + Y = -1717.4137; + Z = 13.6086; + } + else if ( strmatch( szCity, "Las Venturas" ) ) + { + X = 2481.6812; + Y = 1315.8477; + Z = 10.6797; + } + + p_PawnStoreMapIcon[ playerid ] = CreateDynamicMapIconEx( X, Y, Z, 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); + p_PawnStoreExport[ playerid ] = CreateDynamicRaceCP( 1, X, Y, Z, 0.0, 0.0, 0.0, 4.0, -1, -1, playerid ); } } From e33c2c3efb4acf954ee759a9164804faf59504a6 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Mon, 8 Oct 2018 22:41:29 +0100 Subject: [PATCH 9/9] adds a option to preview a garage component before buying --- gamemodes/irresistible/cnr/dialog_ids.pwn | 99 +++--- .../cnr/features/vehicles/vmodifications.pwn | 285 ++++++++++++++---- 2 files changed, 276 insertions(+), 108 deletions(-) diff --git a/gamemodes/irresistible/cnr/dialog_ids.pwn b/gamemodes/irresistible/cnr/dialog_ids.pwn index 10957de..f1ff9d5 100644 --- a/gamemodes/irresistible/cnr/dialog_ids.pwn +++ b/gamemodes/irresistible/cnr/dialog_ids.pwn @@ -126,55 +126,56 @@ #define DIALOG_COMPONENT_EDIT 1115 #define DIALOG_COMPONENT_EDIT_MENU 1116 #define DIALOG_COMPONENT_MENU 1117 -#define DIALOG_DONATED_DIAGOLD 1118 -#define DIALOG_LATEST_DONOR 1119 -#define DIALOG_FINISHED_DONATING 1120 -#define DIALOG_MODIFY_HITSOUND 1121 -#define DIALOG_VIP_NOTE 1122 -#define DIALOG_REGISTER_QUIT 1123 -#define DIALOG_LOGIN_QUIT 1124 -#define DIALOG_WEAPON_LOCKER 1125 -#define DIALOG_WEAPON_LOCKER_BUY 1126 -#define DIALOG_FEEDBACK 1127 -#define DIALOG_IC_MARKET_2 1128 -#define DIALOG_BUSINESS_CAR 1129 -#define DIALOG_BUSINESS_HELI 1130 -#define DIALOG_ACC_GUARD 1131 -#define DIALOG_ACC_GUARD_EMAIL 1132 -#define DIALOG_ACC_GUARD_MODE 1133 -#define DIALOG_ACC_GUARD_CONFIRM 1134 -#define DIALOG_ACC_GUARD_DEL_CANCEL 1135 -#define DIALOG_RACE 1136 -#define DIALOG_RACE_MODE 1137 -#define DIALOG_RACE_FEE 1138 -#define DIALOG_RACE_POS 1139 -#define DIALOG_RACE_DISTANCE 1140 -#define DIALOG_RACE_KICK 1141 -#define DIALOG_RACE_DEST 1142 -#define DIALOG_RACE_PRESELECT 1143 -#define DIALOG_RACE_CUSTOM_DEST 1144 -#define DIALOG_BUSINESS_SELL 1145 -#define DIALOG_BUSINESS_NAME 1146 -#define DIALOG_BUSINESS_ADD_MEMBER 1147 -#define DIALOG_BUSINESS_MEMBERS 1148 -#define DIALOG_BUSINESS_WITHDRAW 1149 -#define DIALOG_BUSINESS_UPGRADES 1150 -#define DIALOG_BUSINESSES 1151 -#define DIALOG_CASINO_REWARDS 1152 -#define DIALOG_AIRPORT 1153 -#define DIALOG_CASINO_BAR 1154 -#define DIALOG_ACC_EMAIL 1155 -#define DIALOG_BUSINESS_SECURITY 1156 -#define DIALOG_FACILITY_SPAWN 1157 -#define DIALOG_IC_MARKET_3 1158 -#define DIALOG_BUY_VIP 1159 -#define DIALOG_TOYS_COLOR 1160 -#define DIALOG_HIGHSCORES 1161 -#define DIALOG_HIGHSCORES_BACK 1162 -#define DIALOG_CROWDFUNDS 1163 -#define DIALOG_CROWDFUND_OPTIONS 1164 -#define DIALOG_CROWDFUND_INFO 1165 -#define DIALOG_CROWDFUND_DONATE 1166 +#define DIALOG_COMPONENTS_RESPONSE 1118 +#define DIALOG_DONATED_DIAGOLD 1119 +#define DIALOG_LATEST_DONOR 1120 +#define DIALOG_FINISHED_DONATING 1121 +#define DIALOG_MODIFY_HITSOUND 1123 +#define DIALOG_VIP_NOTE 1124 +#define DIALOG_REGISTER_QUIT 1125 +#define DIALOG_LOGIN_QUIT 1126 +#define DIALOG_WEAPON_LOCKER 1127 +#define DIALOG_WEAPON_LOCKER_BUY 1128 +#define DIALOG_FEEDBACK 1129 +#define DIALOG_IC_MARKET_2 1130 +#define DIALOG_BUSINESS_CAR 1131 +#define DIALOG_BUSINESS_HELI 1132 +#define DIALOG_ACC_GUARD 1133 +#define DIALOG_ACC_GUARD_EMAIL 1134 +#define DIALOG_ACC_GUARD_MODE 1135 +#define DIALOG_ACC_GUARD_CONFIRM 1136 +#define DIALOG_ACC_GUARD_DEL_CANCEL 1137 +#define DIALOG_RACE 1138 +#define DIALOG_RACE_MODE 1139 +#define DIALOG_RACE_FEE 1140 +#define DIALOG_RACE_POS 1141 +#define DIALOG_RACE_DISTANCE 1142 +#define DIALOG_RACE_KICK 1143 +#define DIALOG_RACE_DEST 1144 +#define DIALOG_RACE_PRESELECT 1145 +#define DIALOG_RACE_CUSTOM_DEST 1146 +#define DIALOG_BUSINESS_SELL 1147 +#define DIALOG_BUSINESS_NAME 1148 +#define DIALOG_BUSINESS_ADD_MEMBER 1149 +#define DIALOG_BUSINESS_MEMBERS 1150 +#define DIALOG_BUSINESS_WITHDRAW 1151 +#define DIALOG_BUSINESS_UPGRADES 1152 +#define DIALOG_BUSINESSES 1153 +#define DIALOG_CASINO_REWARDS 1154 +#define DIALOG_AIRPORT 1155 +#define DIALOG_CASINO_BAR 1156 +#define DIALOG_ACC_EMAIL 1157 +#define DIALOG_BUSINESS_SECURITY 1158 +#define DIALOG_FACILITY_SPAWN 1159 +#define DIALOG_IC_MARKET_3 1160 +#define DIALOG_BUY_VIP 1161 +#define DIALOG_TOYS_COLOR 1162 +#define DIALOG_HIGHSCORES 1163 +#define DIALOG_HIGHSCORES_BACK 1164 +#define DIALOG_CROWDFUNDS 1165 +#define DIALOG_CROWDFUND_OPTIONS 1166 +#define DIALOG_CROWDFUND_INFO 1167 +#define DIALOG_CROWDFUND_DONATE 1168 /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) diff --git a/gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn b/gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn index fa3525f..94f73a2 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vmodifications.pwn @@ -328,83 +328,217 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) return ShowPlayerVehicleComponents( playerid, listitem ); } else if ( dialogid == DIALOG_COMPONENTS ) + { + SetPVarInt( playerid, "components_item", listitem ); + if ( response ) + { + ShowPlayerDialog(playerid, DIALOG_COMPONENTS_RESPONSE, DIALOG_STYLE_LIST, ""COL_WHITE"Pimp My Ride", "Purchase Component\nPreview Component", "Select", "Back" ); + } + else + { + return cmd_garage( playerid, "vehicle pimp" ); + } + } + + else if ( dialogid == DIALOG_COMPONENTS_RESPONSE ) { new + iItem = GetPVarInt( playerid, "components_item" ), iComponent = GetPVarInt( playerid, "components_category" ); if ( response ) { - for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent ) + switch( listitem ) { - if ( listitem == x++ ) + case 0: { - if ( !IsPlayerInAnyVehicle( playerid ) ) - return SendError( playerid, "You need to be in a vehicle to use this command." ); - - if ( GetPlayerCash( playerid ) < g_vehicleComponentsData[ i ] [ E_PRICE ] ) - return SendError( playerid, "You need %s to purchase this vehicle component.", cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) ); - - if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) - return SendError( playerid, "You need to be a driver to use this command." ); - - new - ownerid = INVALID_PLAYER_ID, - vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid ) - ; - - if ( vehicleid == -1 ) - return SendError( playerid, "This vehicle isn't a buyable vehicle." ); - - if ( playerid != ownerid ) - return SendError( playerid, "This vehicle does not belong to you." ); - - if ( GetVehicleCustomComponents( ownerid, vehicleid ) >= GetPlayerPimpVehicleSlots( ownerid ) ) - return SendError( playerid, "You cannot purchase more than %d vehicle components.", GetPlayerPimpVehicleSlots( ownerid ) ); - - new - slotid = GetVehicleComponentSlot( ownerid, vehicleid ); - - if ( slotid == -1 ) - return SendError( playerid, "You cannot add more than %d components to your vehicle.", MAX_PIMPS ); - - // make sure the person is above the limit - if ( g_vehicleComponentsData[ i ] [ E_LIMIT ] != 0 ) + for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent ) { - new - instances = 0; + if ( iItem == x++ ) + { + if ( !IsPlayerInAnyVehicle( playerid ) ) + return SendError( playerid, "You need to be in a vehicle to use this command." ); - for( new p = 0; p < MAX_PIMPS; p++ ) - if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ p ] && g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_MODEL ] [ p ] == g_vehicleComponentsData[ i ] [ E_MODEL_ID ] ) - instances ++; + if ( GetPlayerCash( playerid ) < g_vehicleComponentsData[ i ] [ E_PRICE ] ) + return SendError( playerid, "You need %s to purchase this vehicle component.", cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) ); - if ( instances >= g_vehicleComponentsData[ i ] [ E_LIMIT ] ) - return SendError( playerid, "You can place a %s a maximum of %d time(s).", g_vehicleComponentsData[ i ] [ E_NAME ], g_vehicleComponentsData[ i ] [ E_LIMIT ] ); + if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) + return SendError( playerid, "You need to be a driver to use this command." ); + + new + ownerid = INVALID_PLAYER_ID, + vehicleid = getVehicleSlotFromID( GetPlayerVehicleID( playerid ), ownerid ) + ; + + if ( vehicleid == -1 ) + return SendError( playerid, "This vehicle isn't a buyable vehicle." ); + + if ( playerid != ownerid ) + return SendError( playerid, "This vehicle does not belong to you." ); + + if ( GetVehicleCustomComponents( ownerid, vehicleid ) >= GetPlayerPimpVehicleSlots( ownerid ) ) + return SendError( playerid, "You cannot purchase more than %d vehicle components.", GetPlayerPimpVehicleSlots( ownerid ) ); + + new + slotid = GetVehicleComponentSlot( ownerid, vehicleid ); + + if ( slotid == -1 ) + return SendError( playerid, "You cannot add more than %d components to your vehicle.", MAX_PIMPS ); + + // make sure the person is above the limit + if ( g_vehicleComponentsData[ i ] [ E_LIMIT ] != 0 ) + { + new + instances = 0; + + for( new p = 0; p < MAX_PIMPS; p++ ) + if ( g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_CREATED ] [ p ] && g_vehiclePimpData[ playerid ] [ vehicleid ] [ E_MODEL ] [ p ] == g_vehicleComponentsData[ i ] [ E_MODEL_ID ] ) + instances ++; + + if ( instances >= g_vehicleComponentsData[ i ] [ E_LIMIT ] ) + return SendError( playerid, "You can place a %s a maximum of %d time(s).", g_vehicleComponentsData[ i ] [ E_NAME ], g_vehicleComponentsData[ i ] [ E_LIMIT ] ); + } + + new + Float: X, Float: Y, Float: Z; + + GivePlayerCash( playerid, -g_vehicleComponentsData[ i ] [ E_PRICE ] ); + + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ slotid ] = true; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ slotid ] = false; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ slotid ] = g_vehicleComponentsData[ i ] [ E_MODEL_ID ]; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ slotid ] = 0.0; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ slotid ] = 0.0; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ slotid ] = 1.0; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ slotid ] = 0.0; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ slotid ] = 0.0; + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ slotid ] = 0.0; + + format( szNormalString, sizeof( szNormalString ), "INSERT INTO `COMPONENTS` (`VEHICLE_ID`,`MODEL`,`X`,`Y`,`Z`,`RX`,`RY`,`RZ`) VALUES (%d,%d,0.0,0.0,1.0,0.0,0.0,0.0)", g_vehicleData[ ownerid ] [ vehicleid ] [ E_SQL_ID ], g_vehicleComponentsData[ i ] [ E_MODEL_ID ] ); + mysql_function_query( dbHandle, szNormalString, true, "OnPlayerCreateVehicleComponent", "ddd", playerid, vehicleid, slotid ); + + GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z ); + SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 ); + + g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehicleComponentsData[ i ] [ E_MODEL_ID ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .worldid = GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ]) ); + AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ], g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 ); + return SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_vehicleComponentsData[ i ] [ E_NAME ], cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) ); + } + } + } + case 1: + { + new model = -1; + + for( new i = 0, x = 0; i < sizeof( g_vehicleComponentsData ); i++ ) if ( g_vehicleComponentsData[ i ] [ E_CATEGORY ] == iComponent ) + { + if ( iItem == x++ ) + { + model = g_vehicleComponentsData[ i ] [ E_MODEL_ID ]; + } } - new - Float: X, Float: Y, Float: Z; + p_VehiclePreviewTD[ 0 ] = CreatePlayerTextDraw(playerid,289.000000, 230.000000, "preview 2"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 0 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 0 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 0 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 0 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 0 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 0 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 0 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 0 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 0 ], -16.000000, 0.000000, 0.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 0 ], 0); - GivePlayerCash( playerid, -g_vehicleComponentsData[ i ] [ E_PRICE ] ); + p_VehiclePreviewTD[ 1 ] = CreatePlayerTextDraw(playerid,358.000000, 160.000000, "preview 3"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 1 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 1 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 1 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 1 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 1 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 1 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 1 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 1 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 1 ], -16.000000, 0.000000, 270.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 1 ], 0); - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_CREATED ] [ slotid ] = true; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_DISABLED ] [ slotid ] = false; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_MODEL ] [ slotid ] = g_vehicleComponentsData[ i ] [ E_MODEL_ID ]; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_X ] [ slotid ] = 0.0; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Y ] [ slotid ] = 0.0; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_Z ] [ slotid ] = 1.0; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RX ] [ slotid ] = 0.0; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RY ] [ slotid ] = 0.0; - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_RZ ] [ slotid ] = 0.0; + p_VehiclePreviewTD[ 2 ] = CreatePlayerTextDraw(playerid,358.000000, 230.000000, "preview 4"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 2 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 2 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 2 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 2 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 2 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 2 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 2 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 2 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 2 ], -16.000000, 0.000000, 90.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 2 ], 0); - format( szNormalString, sizeof( szNormalString ), "INSERT INTO `COMPONENTS` (`VEHICLE_ID`,`MODEL`,`X`,`Y`,`Z`,`RX`,`RY`,`RZ`) VALUES (%d,%d,0.0,0.0,1.0,0.0,0.0,0.0)", g_vehicleData[ ownerid ] [ vehicleid ] [ E_SQL_ID ], g_vehicleComponentsData[ i ] [ E_MODEL_ID ] ); - mysql_function_query( dbHandle, szNormalString, true, "OnPlayerCreateVehicleComponent", "ddd", playerid, vehicleid, slotid ); + p_VehiclePreviewTD[ 3 ] = CreatePlayerTextDraw(playerid,428.000000, 160.000000, "preview 4"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 3 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 3 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 3 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 3 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 3 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 3 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 3 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 3 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 3 ], 270.000000, 0.000000, 0.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 3 ], 0); - GetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z ); - SetVehiclePos( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], X, Y, Z + 0.05 ); + p_VehiclePreviewTD[ 4 ] = CreatePlayerTextDraw(playerid,428.000000, 230.000000, "preview 5"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 4 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 4 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 4 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 4 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 4 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 4 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 4 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 4 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 4 ], 90.000000, 0.000000, 0.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 4 ], 0); - g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ] = CreateDynamicObject( g_vehicleComponentsData[ i ] [ E_MODEL_ID ], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, .worldid = GetVehicleVirtualWorld( g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ]) ); - AttachDynamicObjectToVehicle( g_vehiclePimpData[ ownerid ] [ vehicleid ] [ E_OBJECT ] [ slotid ], g_vehicleData[ ownerid ] [ vehicleid ] [ E_VEHICLE_ID ], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 ); - return SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_vehicleComponentsData[ i ] [ E_NAME ], cash_format( g_vehicleComponentsData[ i ] [ E_PRICE ] ) ); + p_VehiclePreviewTD[ 5 ] = CreatePlayerTextDraw(playerid,150.000000, 160.000000, "big preview"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 5 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 5 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 5 ], 0.500000, 1.000000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 5 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 5 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 5 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 5 ], 130.000000, 130.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 5 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 5 ], -16.000000, 0.000000, 45.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid,p_VehiclePreviewTD[ 5 ], 0); + + p_VehiclePreviewTD[ 6 ] = CreatePlayerTextDraw(playerid,289.000000, 160.000000, "preview 6"); + PlayerTextDrawBackgroundColor(playerid,p_VehiclePreviewTD[ 6 ], 112); + PlayerTextDrawFont(playerid,p_VehiclePreviewTD[ 6 ], 5); + PlayerTextDrawLetterSize(playerid,p_VehiclePreviewTD[ 6 ], 0.500000, 4.400000); + PlayerTextDrawColor(playerid,p_VehiclePreviewTD[ 6 ], -1); + PlayerTextDrawUseBox(playerid,p_VehiclePreviewTD[ 6 ], 1); + PlayerTextDrawBoxColor(playerid,p_VehiclePreviewTD[ 6 ], 0); + PlayerTextDrawTextSize(playerid,p_VehiclePreviewTD[ 6 ], 60.000000, 60.000000); + PlayerTextDrawSetPreviewModel(playerid, p_VehiclePreviewTD[ 6 ], model); + PlayerTextDrawSetPreviewRot(playerid, p_VehiclePreviewTD[ 6 ], -16.000000, 0.000000, 180.000000, 1.000000); + PlayerTextDrawSetSelectable(playerid, p_VehiclePreviewTD[ 6 ], 0); + + TextDrawShowForPlayer( playerid, g_VehiclePreviewBoxTD ); + TextDrawSetString( g_VehiclePreviewTxtTD, "Component Preview" ); + TextDrawShowForPlayer( playerid, g_VehiclePreviewTxtTD ); + TextDrawShowForPlayer( playerid, p_VehiclePreviewCloseTD ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 0 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 1 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 2 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 3 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 4 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 5 ] ); + PlayerTextDrawShow( playerid, p_VehiclePreviewTD[ 6 ] ); + + p_inMovieMode{ playerid } = false; + cmd_moviemode( playerid, "" ); // Hide textdraws :3 + + SelectTextDraw( playerid, COLOR_RED ); + SetPVarInt( playerid, "viewing_component", 1 ); } } } @@ -690,3 +824,36 @@ stock ShowVehicleComponentCategories( playerid ) } return ShowPlayerDialog( playerid, DIALOG_COMPONENTS_CATEGORY, DIALOG_STYLE_LIST, "Pimp My Ride - Categories", szCategory, "Select", "Cancel" ); } + + +hook OnPlayerClickTextDraw(playerid, Text: clickedid) +{ + // Pressed ESC + if ( clickedid == Text: INVALID_TEXT_DRAW ) { + if ( GetPVarInt( playerid, "recently_previewed" ) < GetTickCount( ) && GetPVarInt( playerid, "viewing_component" ) ) + return CancelComponentView( playerid, 0 ); + } + return 1; +} + + +stock CancelComponentView( playerid, cancel = 1 ) +{ + if ( cancel ) + CancelSelectTextDraw( playerid ); + + TextDrawHideForPlayer( playerid, g_VehiclePreviewBoxTD ); + TextDrawHideForPlayer( playerid, g_VehiclePreviewTxtTD ); + TextDrawHideForPlayer( playerid, p_VehiclePreviewCloseTD ); + + for( new i; i < sizeof p_VehiclePreviewTD; i++ ) + PlayerTextDrawDestroy( playerid, p_VehiclePreviewTD[ i ] ); + + cmd_moviemode( playerid, "" ); // Show textdraws :3 + + DeletePVar( playerid, "viewing_component" ); + SetPVarInt( playerid, "recently_previewed", GetTickCount( ) + 100 ); + + SendServerMessage( playerid, "You have finished looking at this vehicle modification preview." ); + return ShowPlayerDialog(playerid, DIALOG_COMPONENTS_RESPONSE, DIALOG_STYLE_LIST, ""COL_WHITE"Pimp My Ride", "Purchase Component\nPreview Component", "Select", "Back" ); +} \ No newline at end of file