fireworks and explosive rounds available at supa/ammunation

This commit is contained in:
Lorenc Pekaj 2018-11-04 19:24:55 +11:00
parent c836d256b1
commit f503224775
4 changed files with 47 additions and 27 deletions

View File

@ -16,7 +16,7 @@
#define MENU_RIFLES ( 4 )
#define MENU_SHOTGUNS ( 5 )
#define MENU_THROWN ( 6 )
#define MENU_ARMOR ( 7 )
#define MENU_SPECIAL ( 7 )
/* ** Variables ** */
enum E_WEAPONS_DATA
@ -67,8 +67,9 @@ new
{ MENU_THROWN, "Grenade", 16, 1, 1200 },
{ MENU_THROWN, "Molotov Cocktail", 18, 4, 1400 },
{ MENU_ARMOR, "Armor", 101, 100, 12500 },
{ MENU_ARMOR, "RPG", 35, 1, 10000 }
{ MENU_SPECIAL, "Explosive Round", 102, 1, 20000 },
{ MENU_SPECIAL, "Armor", 101, 100, 12500 },
{ MENU_SPECIAL, "RPG", 35, 1, 10000 }
},
p_AmmunationMenu [ MAX_PLAYERS char ]
;
@ -79,12 +80,12 @@ stock RedirectAmmunation( playerid, listitem, custom_title[ ] = "{FFFFFF}Ammu-Na
new
szString[ 420 ];
if ( listitem == MENU_ARMOR ) szString = ""COL_WHITE"Item\t"COL_WHITE"Price\n";
if ( listitem == MENU_SPECIAL ) szString = ""COL_WHITE"Item\t"COL_WHITE"Price\n";
else szString = ""COL_WHITE"Weapon\t"COL_WHITE"Ammo\t"COL_WHITE"Price\n";
for( new i; i < sizeof( g_AmmunationWeapons ); i++ ) if ( g_AmmunationWeapons[ i ] [ E_MENU ] == listitem )
{
if ( listitem != MENU_ARMOR ) { // Other multipliers will not specify ammo
if ( listitem != MENU_SPECIAL ) { // Other multipliers will not specify ammo
format( szString, sizeof( szString ), "%s%s\t%d\t", szString, g_AmmunationWeapons[ i ] [ E_NAME ], listitem == MENU_MELEE ? 1 : ( g_AmmunationWeapons[ i ] [ E_AMMO ] * ammo_multiplier ) );
} else {
format( szString, sizeof( szString ), "%s%s\t", szString, g_AmmunationWeapons[ i ] [ E_NAME ] );

View File

@ -267,6 +267,10 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
StockMarket_UpdateEarnings( E_STOCK_AMMUNATION, price, .factor = 0.25 );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) {
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
}
else GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] );
RedirectAmmunation( playerid, gun_category, "{FFFFFF}Gang Facility - Purchase Weapons", DIALOG_FACILITY_AMMU_BUY, gun_discount );

View File

@ -24,7 +24,8 @@ enum E_SHOP_ITEMS
SHOP_ITEM_MONEY_CASE,
SHOP_ITEM_DRILL,
SHOP_ITEM_METAL_MELTER,
SHOP_ITEM_WEED_SEED
SHOP_ITEM_WEED_SEED,
SHOP_ITEM_FIREWORKS
}
enum E_SHOP_DATA
@ -48,9 +49,9 @@ new
{ SHOP_ITEM_FOIL, true , "Aluminium Foil", "Automatically deflect EMP", 8, 3400 },
{ 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_METAL_MELTER, true , "Metal Melter", "/breakout", 4, 7500 },
{ SHOP_ITEM_FIREWORKS, true , "Firework", "/fireworks", 0, 50000 }
},
g_playerShopItems [ MAX_PLAYERS ] [ E_SHOP_ITEMS ] // gradually move to this
;
@ -69,7 +70,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." );
if ( g_shopItemData[ listitem ] [ E_LIMIT ] == 1 )
if ( g_shopItemData[ listitem ] [ E_LIMIT ] <= 1 )
{
ShowPlayerShopMenu( playerid );
@ -98,6 +99,10 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
if ( p_drillStrength[ playerid ] == MAX_DRILL_STRENGTH ) return SendError( playerid, "You have already purchased this item." );
p_drillStrength[ playerid ] = MAX_DRILL_STRENGTH;
}
case SHOP_ITEM_FIREWORKS:
{
GivePlayerFireworks( playerid, 1 );
}
}
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 ] ) );
@ -130,7 +135,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
case 2: iAmount = iLimit;
}
if ( ( iCurrentQuantity + iAmount ) > iLimit )
if ( iLimit != 0 && ( iCurrentQuantity + iAmount ) > iLimit )
{
// Specified more than he can carry!
if ( ( iAmount = iLimit - iCurrentQuantity ) != 0 )

View File

@ -212,13 +212,20 @@ enum E_REWARDS_DATA
new
g_casinoRewardsItems[ ] [ E_REWARDS_DATA ] = {
{ "Fireworks", 2500.0 },
{ "10 Explosive Bullets", 5000.0 },
// { "No Tax For 1 Hour", 25000.0 },
{ "10 Explosive Bullets", 12500.0 },
{ "Highroller Access", 200000.0 }
},
g_casinoRewardsShopItems[ ] = {
5, 6, 7, 8, 9, 10, 11
E_SHOP_ITEMS: g_casinoRewardsShopItems[ ] = {
SHOP_ITEM_TIE,
SHOP_ITEM_SCISSOR,
SHOP_ITEM_ROPES,
SHOP_ITEM_FOIL,
SHOP_ITEM_BOBBY_PIN,
SHOP_ITEM_MONEY_CASE,
SHOP_ITEM_DRILL,
SHOP_ITEM_METAL_MELTER,
SHOP_ITEM_WEED_SEED,
SHOP_ITEM_FIREWORKS
},
Float: p_CasinoRewardsPoints [ MAX_PLAYERS ],
bool: p_IsCasinoHighRoller [ MAX_PLAYERS char ],
@ -8965,18 +8972,12 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
switch ( rewards_item )
{
case 0: GivePlayerFireworks( playerid, 1 ); // fireworks
case 1:
case 0:
{
p_ExplosiveBullets[ playerid ] += 10;
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
}
/*case 2: // taxes
{
p_TaxTime[ playerid ] = ( p_TaxTime[ playerid ] > p_Uptime[ playerid ] ? p_TaxTime[ playerid ] : p_Uptime[ playerid ] ) + 3600;
mysql_single_query( sprintf( "UPDATE `USERS` SET `TAX_TIME`=%d WHERE `ID`=%d", p_TaxTime[ playerid ], p_AccountID[ playerid ] ) );
}*/
case 2: // highroller
case 1: // highroller
{
if ( p_IsCasinoHighRoller{ playerid } ) return SendError( playerid, "You are already considered a casino highroller." );
mysql_single_query( sprintf( "UPDATE `USERS` SET `VISAGE_HIGHROLLER`=1 WHERE `ID`=%d", p_AccountID[ playerid ] ) );
@ -8993,7 +8994,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
}
else
{
for ( new i = 0; i < sizeof ( g_shopItemData ); i ++ ) if ( IsCasinoRewardsShopItem( i ) )
for ( new i = 0; i < sizeof ( g_shopItemData ); i ++ ) if ( IsCasinoRewardsShopItem( g_shopItemData[ i ] [ E_ID ] ) )
{
if ( x == listitem )
{
@ -9541,7 +9542,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
return 1;
}
if ( p_VIPLevel[ playerid ] < VIP_GOLD && listitem == MENU_ARMOR ) {
if ( p_VIPLevel[ playerid ] < VIP_GOLD && listitem == MENU_SPECIAL ) {
SendError( playerid, "You are not Gold V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
return ShowAmmunationMenu( playerid, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL );
}
@ -9582,6 +9583,10 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
SetPVarInt( playerid, "purchased_weapon", GetPVarInt( playerid, "purchased_weapon" ) + 1 );
SendClientMessageFormatted( playerid, -1, ""COL_ORANGE"[WEAPON DEAL]{FFFFFF} You have purchased %s for "COL_GOLD"%s"COL_WHITE".", g_AmmunationWeapons[ i ] [ E_NAME ], cash_format( price ) );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, 100.0 );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) {
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
}
else GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] * ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 35 ? 1 : 5 ) );
SetPlayerArmedWeapon( playerid, 0 );
GivePlayerCash( playerid, -( price ) );
@ -9633,6 +9638,10 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
RedirectAmmunation( playerid, p_AmmunationMenu{ playerid } );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) {
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
}
else GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] );
SendServerMessage( playerid, "You have purchased %s(%d) for "COL_GOLD"%s"COL_WHITE"%s.", g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], cash_format( iCostPrice ), bDealer ? ( " (inc. discount)" ) : ( "" ) );
@ -13193,7 +13202,7 @@ stock ShowPlayerRewardsMenu( playerid )
if ( szString[ 0 ] == '\0' )
{
strcat( szString, ""COL_WHITE"Item\t"COL_WHITE"Purpose\t"COL_WHITE"Rewards Points\n" );
for( new i; i < sizeof( g_shopItemData ); i++ ) if ( IsCasinoRewardsShopItem( i ) ) {
for( new i; i < sizeof( g_shopItemData ); i++ ) if ( IsCasinoRewardsShopItem( g_shopItemData[ i ] [ E_ID ] ) ) {
new Float: rewards_cost = ( float( g_shopItemData[ i ] [ E_PRICE ] ) * CASINO_REWARDS_COST_MP ) / CASINO_REWARDS_DIVISOR;
format( szString, sizeof( szString ), "%s%s\t"COL_GREY"%s\t"COL_GOLD"%s points\n", szString, g_shopItemData[ i ] [ E_NAME ], g_shopItemData[ i ] [ E_USAGE ], points_format( rewards_cost ) );
}
@ -13204,7 +13213,7 @@ stock ShowPlayerRewardsMenu( playerid )
return ShowPlayerDialog( playerid, DIALOG_CASINO_REWARDS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Casino Rewards Items", szString, "Buy", "Cancel" );
}
stock IsCasinoRewardsShopItem( itemid ) {
stock IsCasinoRewardsShopItem( E_SHOP_ITEMS: itemid ) {
for ( new i = 0; i < sizeof( g_casinoRewardsShopItems ); i ++ ) if ( itemid == g_casinoRewardsShopItems[ i ] ) {
return true;
}
@ -13223,6 +13232,7 @@ stock GetPlayerFireworks( playerid ) return p_Fireworks[ playerid ];
stock GivePlayerFireworks( playerid, fireworks ) {
p_Fireworks[ playerid ] += fireworks;
mysql_single_query( sprintf( "UPDATE `USERS` SET `FIREWORKS`=%d WHERE `ID`=%d", p_Fireworks[ playerid ], p_AccountID[ playerid ] ) );
return 1;
}
stock ShowPlayerSpawnMenu( playerid ) {