From d4b6900fa4416e493c8ab72f4649985270510009 Mon Sep 17 00:00:00 2001 From: Dusan Date: Thu, 6 Jun 2019 21:24:52 +0200 Subject: [PATCH 1/3] Fixes - Destroy boombox if player dies, or gets jailed - Added boombox to stats - Add message about boombox to Stephanie --- .../irresistible/cnr/features/boom_box.pwn | 20 ++++++++++++++++++- .../cnr/features/random_messages.pwn | 3 ++- gamemodes/sf-cnr.pwn | 5 +++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index ca39bdf..6e127c9 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -32,6 +32,24 @@ hook OnPlayerDisconnect( playerid, reason ) return 1; } +#if defined AC_INCLUDED +hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart ) +#else +hook OnPlayerDeath( playerid, killerid, reason ) +#endif +{ + p_UsingBoombox{ playerid } = false; + Boombox_Destroy( playerid ); + return 1; +} + +hook OnPlayerJailed( playerid ) +{ + p_UsingBoombox{ playerid } = false; + Boombox_Destroy( playerid ); + return 1; +} + hook OnPlayerEnterDynArea( playerid, areaid ) { foreach ( new i : Player ) @@ -143,7 +161,7 @@ stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: A g_boomboxData[ playerid ] [ E_Z ] = Z; g_boomboxData[ playerid ] [ E_OBJECT ] = CreateDynamicObject( 2103, X, Y, Z - 0.92, 0, 0, 0, GetPlayerVirtualWorld( playerid ), GetPlayerInterior( playerid ), -1, Angle ); - g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "%s(%d)'s Boombox", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z, 10, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); + g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "%s(%d)'s Boombox", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z, 20, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); g_boomboxData[ playerid ] [ E_MUSIC_AREA ] = CreateDynamicSphere( X, Y, Z, fDistance, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); return 1; } diff --git a/gamemodes/irresistible/cnr/features/random_messages.pwn b/gamemodes/irresistible/cnr/features/random_messages.pwn index 2182e83..62365cb 100644 --- a/gamemodes/irresistible/cnr/features/random_messages.pwn +++ b/gamemodes/irresistible/cnr/features/random_messages.pwn @@ -70,7 +70,8 @@ static stock { "{8ADE47}Stephanie:"COL_WHITE" Contribute to our feature "COL_GREY"/crowdfunds"COL_WHITE"! Early supporters get benefits!" }, { "{8ADE47}Stephanie:"COL_WHITE" You can buy premium player homes using "COL_GREY"/estate"COL_WHITE"!" }, { "{8ADE47}Stephanie:"COL_WHITE" You can buy Irresistible Coins from players using "COL_GREY"/ic buy"COL_WHITE"!" }, - { "{8ADE47}Stephanie:"COL_WHITE" Buy a secure wallet to reduce the amount of money you drop when you die!" } + { "{8ADE47}Stephanie:"COL_WHITE" Buy a secure wallet to reduce the amount of money you drop when you die!" }, + { "{8ADE47}Stephanie:"COL_WHITE" Buy a boombox and have a music party with your friends in area!" } }, g_randomMessageTick = 0 ; diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 5826177..0056100 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -5416,8 +5416,9 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) format( szLargeString, 750, "%s"COL_GREY"Weed Seeds:"COL_WHITE" %d\n"\ ""COL_GREY"Fireworks:{FFFFFF} %d\n"\ - ""COL_GREY"Explosive Bullets:{FFFFFF} %d\n", - szLargeString, GetPlayerShopItemAmount( playerid, SHOP_ITEM_WEED_SEED ), p_Fireworks[ pID ], p_ExplosiveBullets[ pID ] ); + ""COL_GREY"Explosive Bullets:{FFFFFF} %d\n"\ + ""COL_GREY"Boombox:{FFFFFF} %s\n", + szLargeString, GetPlayerShopItemAmount( playerid, SHOP_ITEM_WEED_SEED ), p_Fireworks[ pID ], p_ExplosiveBullets[ pID ], p_Boombox{ pID } == true ? ( "Yes" ) : ( "No" ) ); ShowPlayerDialog( playerid, DIALOG_STATS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Item Statistics", szLargeString, "Okay", "Back" ); } From 59cd4dd19ef59803b0eaec37c13faccb5eb4a898 Mon Sep 17 00:00:00 2001 From: Dusan Date: Sat, 8 Jun 2019 00:31:50 +0200 Subject: [PATCH 2/3] Moved boombox to command --- gamemodes/irresistible/cnr/dialog_ids.pwn | 1 - .../irresistible/cnr/features/boom_box.pwn | 45 +++++++++---------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/gamemodes/irresistible/cnr/dialog_ids.pwn b/gamemodes/irresistible/cnr/dialog_ids.pwn index aaf594e..5a26af0 100644 --- a/gamemodes/irresistible/cnr/dialog_ids.pwn +++ b/gamemodes/irresistible/cnr/dialog_ids.pwn @@ -213,7 +213,6 @@ #define DIALOG_VIP_MAIN 1204 #define DIALOG_XPMARKET_SELL 1205 #define DIALOG_BUY_VIP_MAIN 1206 -#define DIALOG_BOOMBOX_PLAY 1207 /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index 6e127c9..997dc06 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -86,42 +86,37 @@ hook OnPlayerLeaveDynArea( playerid, areaid ) return 1; } -hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) -{ - if ( ( dialogid == DIALOG_BOOMBOX_PLAY ) && response ) - { - static - Float: X, Float: Y, Float: Z, Float: Angle; - - if ( isnull( inputtext ) ) return SendError( playerid, "Looks like you didn't provide any URL."); - if ( GetPlayerPos( playerid, X, Y, Z ) && GetPlayerFacingAngle( playerid, Angle ) ) - { - Boombox_Create( playerid, inputtext, X, Y, Z, Angle ); - p_UsingBoombox{ playerid } = true; - - SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." ); - } - } - - return 1; -} - /* ** Commands ** */ CMD:boombox( playerid, params[ ] ) { if ( ! GetPlayerBoombox( playerid ) ) return SendError( playerid, "You can buy Boombox at Supa Save or a 24/7 store." ); + if ( IsPlayerInAnyVehicle(playerid) ) return SendError( playerid, "You cannot use Boombox inside of a vehicle."); - if ( strmatch( params, "play" ) ) + if ( ! strcmp( params, "play", false, 3 ) ) { - if ( IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are already using Boombox." ); - if ( IsPlayerNearBoombox( playerid ) ) return SendError( playerid, "You cannot be near another Boombox if you wish to create your own." ); + static + Float: X, Float: Y, Float: Z, Float: Angle; - ShowPlayerDialog( playerid, DIALOG_BOOMBOX_PLAY, DIALOG_STYLE_INPUT, ""COL_WHITE"Boombox", ""COL_WHITE"Enter the URL below, and streaming will begin.\n\n"COL_ORANGE"Please note, if there isn't a response. It's likely to be an invalid URL.", "Stream", "Back" ); + new szURL[ 128 ]; + + if ( sscanf( params[ 5 ], "s[128]", szURL ) ) return SendUsage( playerid, "/boombox play [URL]" ); + else if ( IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are already using Boombox." ); + else if ( IsPlayerNearBoombox( playerid ) ) return SendError( playerid, "You cannot be near another Boombox if you wish to create your own." ); + else + { + if ( GetPlayerPos( playerid, X, Y, Z ) && GetPlayerFacingAngle( playerid, Angle ) ) + { + Boombox_Create( playerid, szURL, X, Y, Z, Angle ); + p_UsingBoombox{ playerid } = true; + + SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." ); + } + } } - else if ( strmatch( params, "stop" ) ) + else if ( ! strcmp( params, "stop", false, 3 ) ) { if ( ! IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are not using Boombox." ); From 71dc1c8711107453819e142cc4cfce8a45b6e7ba Mon Sep 17 00:00:00 2001 From: Dusan Date: Sat, 8 Jun 2019 00:42:17 +0200 Subject: [PATCH 3/3] Update dialog_ids.pwn --- gamemodes/irresistible/cnr/dialog_ids.pwn | 1 + 1 file changed, 1 insertion(+) diff --git a/gamemodes/irresistible/cnr/dialog_ids.pwn b/gamemodes/irresistible/cnr/dialog_ids.pwn index 5a26af0..804f92b 100644 --- a/gamemodes/irresistible/cnr/dialog_ids.pwn +++ b/gamemodes/irresistible/cnr/dialog_ids.pwn @@ -213,6 +213,7 @@ #define DIALOG_VIP_MAIN 1204 #define DIALOG_XPMARKET_SELL 1205 #define DIALOG_BUY_VIP_MAIN 1206 +#define DIALOG_VEH_COLORS 1207 /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )