boombox cleanup
This commit is contained in:
parent
d4744276a7
commit
32402b938c
@ -1027,13 +1027,13 @@ CMD:giveboombox( playerid, params[ ] )
|
||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/giveboombox [PLAYER_ID]" );
|
||||
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
||||
else if ( p_Boombox{ pID } == true ) return SendError( playerid, "Player already has boombox in his inventory." );
|
||||
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player already has boombox in his inventory." );
|
||||
else
|
||||
{
|
||||
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) gave you boombox.", ReturnPlayerName( playerid ), playerid );
|
||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have given boombox to %s(%d).", ReturnPlayerName( pID ), pID );
|
||||
AddAdminLogLineFormatted( "%s(%d) has given boombox to %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID );
|
||||
p_Boombox{ pID } = true;
|
||||
SetPlayerBoombox( pID, true );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -1046,15 +1046,13 @@ CMD:removeboombox( playerid, params[ ] )
|
||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||
else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/removeboombox [PLAYER_ID]" );
|
||||
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
|
||||
else if ( p_Boombox{ pID } == false ) return SendError( playerid, "Player doesn't have boombox in his inventory." );
|
||||
else if ( GetPlayerBoombox( pID ) ) return SendError( playerid, "Player doesn't have boombox in his inventory." );
|
||||
else
|
||||
{
|
||||
SendClientMessageFormatted( pID, -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) has removed your boombox.", ReturnPlayerName( playerid ), playerid );
|
||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have removed boombox from %s(%d).", ReturnPlayerName( pID ), pID );
|
||||
AddAdminLogLineFormatted( "%s(%d) has removed boombox from %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID );
|
||||
p_UsingBoombox{ pID } = false;
|
||||
p_Boombox{ pID } = false;
|
||||
Boombox_Destroy( pID );
|
||||
SetPlayerBoombox( pID, false );
|
||||
}
|
||||
return 1;
|
||||
}
|
@ -20,7 +20,9 @@ enum E_BOOMBOX_DATA
|
||||
};
|
||||
|
||||
static stock
|
||||
g_boomboxData [ MAX_PLAYERS ] [ E_BOOMBOX_DATA ]
|
||||
g_boomboxData [ MAX_PLAYERS ] [ E_BOOMBOX_DATA ],
|
||||
bool: p_Boombox [ MAX_PLAYERS char ],
|
||||
bool: p_UsingBoombox [ MAX_PLAYERS char ]
|
||||
;
|
||||
|
||||
/* ** Hooks ** */
|
||||
@ -134,8 +136,17 @@ stock IsPlayerUsingBoombox( playerid ) return p_UsingBoombox{ playerid };
|
||||
|
||||
stock GetPlayerBoombox( playerid ) return p_Boombox{ playerid };
|
||||
|
||||
stock SetPlayerBoombox( playerid, bool: toggle )
|
||||
{
|
||||
if ( ( p_Boombox{ playerid } = toggle ) == false ) {
|
||||
Boombox_Destroy( playerid );
|
||||
}
|
||||
}
|
||||
|
||||
stock Boombox_Destroy( playerid )
|
||||
{
|
||||
p_UsingBoombox{ playerid } = false;
|
||||
|
||||
g_boomboxData[ playerid ] [ E_X ] = 0.0;
|
||||
g_boomboxData[ playerid ] [ E_Y ] = 0.0;
|
||||
g_boomboxData[ playerid ] [ E_Z ] = 0.0;
|
||||
|
@ -106,8 +106,8 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
}
|
||||
case SHOP_ITEM_BOOMBOX:
|
||||
{
|
||||
if ( p_Boombox{ playerid } == true ) return SendError( playerid, "You have already purchased this item." );
|
||||
p_Boombox{ playerid } = true;
|
||||
if ( GetPlayerBoombox( playerid ) ) return SendError( playerid, "You have already purchased this item." );
|
||||
SetPlayerBoombox( playerid, true );
|
||||
}
|
||||
}
|
||||
GivePlayerCash( playerid, -( g_shopItemData[ listitem ] [ E_PRICE ] ) );
|
||||
@ -198,7 +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 ];
|
||||
case SHOP_ITEM_BOOMBOX: return GetPlayerBoombox( playerid );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -221,7 +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;
|
||||
case SHOP_ITEM_BOOMBOX: SetPlayerBoombox( playerid, !!value );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -209,9 +209,7 @@ new
|
||||
p_TazingImmunity [ MAX_PLAYERS ],
|
||||
p_PlayerAltBind [ MAX_PLAYERS ] = { -1, ... },
|
||||
p_PlayerAltBindTick [ MAX_PLAYERS ],
|
||||
p_AimedAtPolice [ MAX_PLAYERS ],
|
||||
bool: p_UsingBoombox [ MAX_PLAYERS char ],
|
||||
bool: p_Boombox [ MAX_PLAYERS char ]
|
||||
p_AimedAtPolice [ MAX_PLAYERS ]
|
||||
;
|
||||
|
||||
/* ** Getters And Setters** */
|
||||
|
@ -5421,7 +5421,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
""COL_GREY"Fireworks:{FFFFFF} %d\n"\
|
||||
""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" ) );
|
||||
szLargeString, GetPlayerShopItemAmount( playerid, SHOP_ITEM_WEED_SEED ), p_Fireworks[ pID ], p_ExplosiveBullets[ pID ], GetPlayerBoombox( pID ) ? ( "Yes" ) : ( "No" ) );
|
||||
|
||||
ShowPlayerDialog( playerid, DIALOG_STATS_REDIRECT, DIALOG_STYLE_MSGBOX, "{FFFFFF}Item Statistics", szLargeString, "Okay", "Back" );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user