From 46e43f24f8cdca1ee689c4a23972b26220c52858 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 10:51:23 +0200 Subject: [PATCH 1/6] Boombox [WIP] --- gamemodes/irresistible/cnr/dialog_ids.pwn | 1 + .../irresistible/cnr/features/_features.pwn | 1 + .../irresistible/cnr/features/boom_box.pwn | 142 ++++++++++++++++++ .../cnr/features/player_items/shop.pwn | 13 +- gamemodes/irresistible/cnr/player.pwn | 4 +- 5 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 gamemodes/irresistible/cnr/features/boom_box.pwn diff --git a/gamemodes/irresistible/cnr/dialog_ids.pwn b/gamemodes/irresistible/cnr/dialog_ids.pwn index 5a26af0..aaf594e 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_BOOMBOX_PLAY 1207 /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index cc9696e..ab01df9 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -68,6 +68,7 @@ #include "irresistible\cnr\features\shamal.pwn" #include "irresistible\cnr\features\billboards.pwn" #include "irresistible\cnr\features\trolley_car.pwn" +#include "irresistible\cnr\features\boom_box.pwn" // pool #include "irresistible\cnr\features\pool.pwn" diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn new file mode 100644 index 0000000..c212ec9 --- /dev/null +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -0,0 +1,142 @@ +/* + * Irresistible Gaming 2018 + * Developed by Night + * Module: cnr\features\boom_box.pwn + * Purpose: boombox related feature + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Definitions ** */ +#define DEFAULT_BOOMBOX_RANGE ( 50.0 ) + +/* ** Variables ** */ +enum E_BOOMBOX_DATA +{ + E_OBJECT, Text3D: E_LABEL, E_MUSIC_AREA, + E_URL[ 128 ], + Float: E_X, Float: E_Y, Float: E_Z +}; + +static stock + g_boomboxData [ MAX_PLAYERS ] [ E_BOOMBOX_DATA ] +; + +/* ** Hooks ** */ +hook OnPlayerDisconnect( playerid, reason ) +{ + p_UsingBoombox{ playerid } = false; + p_Boombox{ playerid } = false; + Boombox_Destroy( playerid ); + return 1; +} + +hook OnPlayerEnterDynArea( playerid, areaid ) +{ + foreach ( new i : Player ) + { + if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) && ! IsPlayerUsingBoombox( i ) ) + { + if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) + { + // start the music + PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ][ E_URL ], g_boomboxData[ playerid ][ E_X ], g_boomboxData[ playerid ][ E_Y ], g_boomboxData[ playerid ][ E_Z ] ); + SendServerMessage( playerid, "You are now listening to a nearby boombox!" ); + return 1; + } + } + } + return 1; +} + +hook OnPlayerLeaveDynArea( playerid, areaid ) +{ + foreach ( new i : Player ) + { + if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) ) + { + if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) + { + // stop the music + StopAudioStreamForPlayer( playerid ); + SendServerMessage( playerid, "You stopped listening to a nearby boombox!" ); + return 1; + } + } + } + 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 ( GetPlayerPos( playerid, X, Y, Z ) && GetPlayerFacingAngle( playerid, Angle ) ) + { + Boombox_Create( playerid, inputtext, X, Y, Z, Angle ); + + p_UsingBoombox{ playerid } = true; + PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ][ E_URL ], X, Y, Z, 30, 1 ); + SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/stopboombox"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 ( strmatch( params, "play" ) ) + { + if ( IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are already using Boombox." ); + + 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" ); + } + else if ( strmatch( params, "stop" ) ) + { + if ( ! IsPlayerUsingBoombox( playerid ) ) return SendError( playerid, "You are not using Boombox." ); + + StopAudioStreamForPlayer( playerid ); + Boombox_Destroy( playerid ); + SendServerMessage( playerid, "You have removed your Boombox."); + p_UsingBoombox{ playerid } = false; + } + else SendUsage( playerid, "/boombox [PLAY/STOP]" ); + return 1; +} + +/* ** Functions ** */ +stock IsPlayerUsingBoombox( playerid ) return p_UsingBoombox{ playerid }; + +stock GetPlayerBoombox( playerid ) return p_Boombox{ playerid }; + +stock Boombox_Destroy( playerid ) +{ + g_boomboxData[ playerid ] [ E_X ] = 0.0; + g_boomboxData[ playerid ] [ E_Y ] = 0.0; + g_boomboxData[ playerid ] [ E_Z ] = 0.0; + g_boomboxData[ playerid ] [ E_URL ][ 0 ] = '\0'; + + DestroyDynamicObject( g_boomboxData[ playerid ] [ E_OBJECT ] ); + DestroyDynamic3DTextLabel( g_boomboxData[ playerid ] [ E_LABEL ] ); + DestroyDynamicArea( g_boomboxData[ playerid ] [ E_MUSIC_AREA ] ); + return 1; +} + +stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: Angle, Float: fDistance = DEFAULT_BOOMBOX_RANGE ) +{ + format( g_boomboxData[ playerid ][ E_URL ], 128, "%s", szURL ); + + g_boomboxData[ playerid ] [ E_OBJECT ] = CreateDynamicObject( 2226, X, Y, Z - 0.92, 0, 0, 0, GetPlayerVirtualWorld( playerid ), GetPlayerInterior( playerid ), -1, Angle ); + g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "Owner: %s(%d)", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z+0.3, 10, .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; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/player_items/shop.pwn b/gamemodes/irresistible/cnr/features/player_items/shop.pwn index 131cfe4..b31c8ba 100644 --- a/gamemodes/irresistible/cnr/features/player_items/shop.pwn +++ b/gamemodes/irresistible/cnr/features/player_items/shop.pwn @@ -24,7 +24,8 @@ enum E_SHOP_ITEMS SHOP_ITEM_DRILL, SHOP_ITEM_METAL_MELTER, SHOP_ITEM_WEED_SEED, - SHOP_ITEM_FIREWORKS + SHOP_ITEM_FIREWORKS, + SHOP_ITEM_BOOMBOX } enum E_SHOP_DATA @@ -49,7 +50,8 @@ new { SHOP_ITEM_MONEY_CASE, false, "Money Case", "Increases robbing amount", 1, 4500 }, // [1250] { SHOP_ITEM_DRILL, true , "Thermal Drill", "Halves safe cracking time", 1, 5000 }, { SHOP_ITEM_METAL_MELTER, true , "Metal Melter", "/breakout", 4, 7500 }, - { SHOP_ITEM_FIREWORKS, true , "Firework", "/fireworks", 0, 50000 } + { SHOP_ITEM_FIREWORKS, true , "Firework", "/fireworks", 0, 50000 }, + { SHOP_ITEM_BOOMBOX, false, "Boombox", "/boombox", 1, 15000 } }, g_playerShopItems [ MAX_PLAYERS ] [ E_SHOP_ITEMS ] // gradually move to this ; @@ -102,6 +104,11 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { GivePlayerFireworks( playerid, 1 ); } + case SHOP_ITEM_BOOMBOX: + { + if ( p_Boombox{ playerid } == true ) return SendError( playerid, "You have already purchased this item." ); + p_Boombox{ playerid } = true; + } } GivePlayerCash( playerid, -( g_shopItemData[ listitem ] [ E_PRICE ] ) ); SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_shopItemData[ listitem ] [ E_NAME ], cash_format( g_shopItemData[ listitem ] [ E_PRICE ] ) ); @@ -191,6 +198,7 @@ stock GetShopItemAmount( playerid, id ) case SHOP_ITEM_METAL_MELTER: return p_MetalMelter[ playerid ]; case SHOP_ITEM_WEED_SEED: return g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ]; case SHOP_ITEM_FIREWORKS: return p_Fireworks[ playerid ]; + case SHOP_ITEM_BOOMBOX: return p_Boombox[ playerid ]; } return 0; } @@ -213,6 +221,7 @@ stock SetPlayerShopItemAmount( playerid, id, value ) case SHOP_ITEM_METAL_MELTER: p_MetalMelter[ playerid ] = value; case SHOP_ITEM_WEED_SEED: g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ] = value; case SHOP_ITEM_FIREWORKS: p_Fireworks[ playerid ] = value; + case SHOP_ITEM_BOOMBOX: p_Boombox[ playerid ] = !!value; } return 1; } diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index ea5a19b..456700c 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -209,7 +209,9 @@ new p_TazingImmunity [ MAX_PLAYERS ], p_PlayerAltBind [ MAX_PLAYERS ] = { -1, ... }, p_PlayerAltBindTick [ MAX_PLAYERS ], - p_AimedAtPolice [ MAX_PLAYERS ] + p_AimedAtPolice [ MAX_PLAYERS ], + bool: p_UsingBoombox [ MAX_PLAYERS char ], + bool: p_Boombox [ MAX_PLAYERS char ] ; /* ** Getters And Setters** */ From 3e517f08473884d7e7e1359ffcd6a5d954841260 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 12:18:56 +0200 Subject: [PATCH 2/6] Boombox wip --- gamemodes/irresistible/cnr/features/boom_box.pwn | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index c212ec9..a07c48f 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -36,13 +36,13 @@ hook OnPlayerEnterDynArea( playerid, areaid ) { foreach ( new i : Player ) { - if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) && ! IsPlayerUsingBoombox( i ) ) + if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) ) { if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) { // start the music - PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ][ E_URL ], g_boomboxData[ playerid ][ E_X ], g_boomboxData[ playerid ][ E_Y ], g_boomboxData[ playerid ][ E_Z ] ); - SendServerMessage( playerid, "You are now listening to a nearby boombox!" ); + PlayAudioStreamForPlayer( i, g_boomboxData[ playerid ][ E_URL ], g_boomboxData[ playerid ][ E_X ], g_boomboxData[ playerid ][ E_Y ], g_boomboxData[ playerid ][ E_Z ] ); + SendServerMessage( i, "You are now listening to a nearby boombox!" ); return 1; } } @@ -59,8 +59,8 @@ hook OnPlayerLeaveDynArea( playerid, areaid ) if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) { // stop the music - StopAudioStreamForPlayer( playerid ); - SendServerMessage( playerid, "You stopped listening to a nearby boombox!" ); + StopAudioStreamForPlayer( i ); + SendServerMessage( i, "You stopped listening to a nearby boombox!" ); return 1; } } @@ -93,6 +93,8 @@ 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" ) ) { @@ -136,7 +138,7 @@ stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: A format( g_boomboxData[ playerid ][ E_URL ], 128, "%s", szURL ); g_boomboxData[ playerid ] [ E_OBJECT ] = CreateDynamicObject( 2226, X, Y, Z - 0.92, 0, 0, 0, GetPlayerVirtualWorld( playerid ), GetPlayerInterior( playerid ), -1, Angle ); - g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "Owner: %s(%d)", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z+0.3, 10, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); + g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "Owner: %s(%d)", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z+0.1, 10, .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; } \ No newline at end of file From d5f40ba2b6d6afaf73740a8d5cba4cd048e4dabd Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 15:51:14 +0200 Subject: [PATCH 3/6] Boombox wip --- .../irresistible/cnr/features/boom_box.pwn | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index a07c48f..3ab1e5c 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -36,13 +36,13 @@ hook OnPlayerEnterDynArea( playerid, areaid ) { foreach ( new i : Player ) { - if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) ) + if ( IsValidDynamicArea( g_boomboxData[ i ] [ E_MUSIC_AREA ] ) ) { - if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) + if ( areaid == g_boomboxData[ i ] [ E_MUSIC_AREA ] ) { // start the music - PlayAudioStreamForPlayer( i, g_boomboxData[ playerid ][ E_URL ], g_boomboxData[ playerid ][ E_X ], g_boomboxData[ playerid ][ E_Y ], g_boomboxData[ playerid ][ E_Z ] ); - SendServerMessage( i, "You are now listening to a nearby boombox!" ); + PlayAudioStreamForPlayer( playerid, g_boomboxData[ i ] [ E_URL ], g_boomboxData[ i ] [ E_X ], g_boomboxData[ i ] [ E_Y ], g_boomboxData[ i ] [ E_Z ], DEFAULT_BOOMBOX_RANGE, 1 ); + SendServerMessage( playerid, "You are now listening to a nearby boombox!" ); return 1; } } @@ -54,13 +54,13 @@ hook OnPlayerLeaveDynArea( playerid, areaid ) { foreach ( new i : Player ) { - if ( IsValidDynamicArea( g_boomboxData[ i ][ E_MUSIC_AREA ] ) ) + if ( IsValidDynamicArea( g_boomboxData[ i ] [ E_MUSIC_AREA ] ) ) { - if ( areaid == g_boomboxData[ i ][ E_MUSIC_AREA ] ) + if ( areaid == g_boomboxData[ i ] [ E_MUSIC_AREA ] ) { // stop the music - StopAudioStreamForPlayer( i ); - SendServerMessage( i, "You stopped listening to a nearby boombox!" ); + StopAudioStreamForPlayer( playerid ); + SendServerMessage( playerid, "You stopped listening to a nearby boombox!" ); return 1; } } @@ -78,10 +78,10 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) if ( GetPlayerPos( playerid, X, Y, Z ) && GetPlayerFacingAngle( playerid, Angle ) ) { Boombox_Create( playerid, inputtext, X, Y, Z, Angle ); - p_UsingBoombox{ playerid } = true; - PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ][ E_URL ], X, Y, Z, 30, 1 ); - SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/stopboombox"COL_WHITE" to stop the stream." ); + + // PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ] [ E_URL ], X, Y, Z, DEFAULT_BOOMBOX_RANGE, 1 ); + SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." ); } } @@ -99,6 +99,7 @@ CMD:boombox( playerid, params[ ] ) if ( strmatch( params, "play" ) ) { 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." ); 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" ); } @@ -125,7 +126,7 @@ stock Boombox_Destroy( playerid ) g_boomboxData[ playerid ] [ E_X ] = 0.0; g_boomboxData[ playerid ] [ E_Y ] = 0.0; g_boomboxData[ playerid ] [ E_Z ] = 0.0; - g_boomboxData[ playerid ] [ E_URL ][ 0 ] = '\0'; + g_boomboxData[ playerid ] [ E_URL ] [ 0 ] = '\0'; DestroyDynamicObject( g_boomboxData[ playerid ] [ E_OBJECT ] ); DestroyDynamic3DTextLabel( g_boomboxData[ playerid ] [ E_LABEL ] ); @@ -135,10 +136,23 @@ stock Boombox_Destroy( playerid ) stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: Angle, Float: fDistance = DEFAULT_BOOMBOX_RANGE ) { - format( g_boomboxData[ playerid ][ E_URL ], 128, "%s", szURL ); + format( g_boomboxData[ playerid ] [ E_URL ], 128, "%s", szURL ); + + g_boomboxData[ playerid ] [ E_X ] = X; + g_boomboxData[ playerid ] [ E_Y ] = Y; + g_boomboxData[ playerid ] [ E_Z ] = Z; g_boomboxData[ playerid ] [ E_OBJECT ] = CreateDynamicObject( 2226, X, Y, Z - 0.92, 0, 0, 0, GetPlayerVirtualWorld( playerid ), GetPlayerInterior( playerid ), -1, Angle ); - g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "Owner: %s(%d)", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z+0.1, 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+0.1, 10, .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; + +stock IsPlayerNearBoombox( playerid ) +{ + foreach ( new i : Player ) { + if ( GetPlayerDistanceFromPoint( playerid, g_boomboxData[ i ] [ E_X ], g_boomboxData[ i ] [ E_Y ], g_boomboxData[ i ] [ E_Z ] ) < DEFAULT_BOOMBOX_RANGE ) { + return true; + } + } + return false; } \ No newline at end of file From d0c3abf86afb154427e23e0c53e94baf54036241 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 15:51:37 +0200 Subject: [PATCH 4/6] Update boom_box.pwn --- gamemodes/irresistible/cnr/features/boom_box.pwn | 1 + 1 file changed, 1 insertion(+) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index 3ab1e5c..76ef1b0 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -146,6 +146,7 @@ stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: A g_boomboxData[ playerid ] [ E_LABEL ] = CreateDynamic3DTextLabel( sprintf( "%s(%d)'s Boombox", ReturnPlayerName( playerid ), playerid ), COLOR_GOLD, X, Y, Z+0.1, 10, .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; +} stock IsPlayerNearBoombox( playerid ) { From e41883b9a782f527f3654fc6ef78cd80de248472 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 19:32:54 +0200 Subject: [PATCH 5/6] Update boom_box.pwn --- gamemodes/irresistible/cnr/features/boom_box.pwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/boom_box.pwn b/gamemodes/irresistible/cnr/features/boom_box.pwn index 76ef1b0..ca39bdf 100644 --- a/gamemodes/irresistible/cnr/features/boom_box.pwn +++ b/gamemodes/irresistible/cnr/features/boom_box.pwn @@ -75,12 +75,12 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) 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; - // PlayAudioStreamForPlayer( playerid, g_boomboxData[ playerid ] [ E_URL ], X, Y, Z, DEFAULT_BOOMBOX_RANGE, 1 ); SendServerMessage( playerid, "If the stream doesn't respond then it must be offline. Use "COL_GREY"/boombox stop"COL_WHITE" to stop the stream." ); } } @@ -142,8 +142,8 @@ stock Boombox_Create( playerid, szURL[ ], Float: X, Float: Y, Float: Z, Float: A g_boomboxData[ playerid ] [ E_Y ] = Y; g_boomboxData[ playerid ] [ E_Z ] = Z; - g_boomboxData[ playerid ] [ E_OBJECT ] = CreateDynamicObject( 2226, 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+0.1, 10, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); + 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_MUSIC_AREA ] = CreateDynamicSphere( X, Y, Z, fDistance, .worldid = GetPlayerVirtualWorld( playerid ), .interiorid = GetPlayerInterior( playerid ) ); return 1; } From 15a9a27ccd23bede7bb0f9492bf47c95821d9b88 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 5 Jun 2019 19:39:50 +0200 Subject: [PATCH 6/6] Update sf-cnr.pwn --- gamemodes/sf-cnr.pwn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 3298fe4..5826177 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -727,19 +727,19 @@ public OnPlayerSpawn( playerid ) SpawnToPaintball( playerid, p_PaintBallArena{ playerid } ); return 1; } - + #if defined __cloudy_event_system else if ( IsPlayerInEvent( playerid ) ) { - if( ! EventSettingAllow( 0 ) && g_eventData[ EV_STARTED ] ) - { + if( ! EventSettingAllow( 0 ) && g_eventData[ EV_STARTED ] ) + { SetPlayerInEvent( playerid ); // respawns player in event. return 1; } else RemovePlayerFromEvent( playerid, true ); // changes the InEvent variable to false. } #endif - + if ( p_Class[ playerid ] == CLASS_CIVILIAN ) { if ( !p_JobSet{ playerid } ) @@ -850,7 +850,7 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: #else if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 ) #endif - { + { p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3; } @@ -5295,6 +5295,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) strcat( szCMDS, ""COL_GREY"/labelinfo{FFFFFF} - Displays your label text with the 32 character limit.\n"\ ""COL_GREY"/radio{FFFFFF} - Shows the list of radio stations you can listen to.\n"\ ""COL_GREY"/stopradio{FFFFFF} - Stops the radio from playing.\n"\ + ""COL_GREY"/boombox{FFFFFF} - Places a boombox at your position which plays music in small area.\n"\ ""COL_GREY"/moviemode{FFFFFF} - Toggles movie mode so you can record without all the text on the screen." ); ShowPlayerDialog( playerid, DIALOG_CMDS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Miscellaneous Commands", szCMDS, "Okay", "Back" ); }