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." );