limiting bullets to 1024

This commit is contained in:
Stev 2019-09-01 17:54:13 +01:00
parent dbd9c9a2fd
commit d1e94fe4be
3 changed files with 20 additions and 3 deletions

View File

@ -278,7 +278,11 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
StockMarket_UpdateEarnings( E_STOCK_AMMUNATION, price, .factor = 0.25 ); StockMarket_UpdateEarnings( E_STOCK_AMMUNATION, price, .factor = 0.25 );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) ); if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) { else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 )
{
if ( p_ExplosiveBullets[ playerid ] >= MAX_EXPLOSIVE_ROUNDS )
return SendError( playerid, "You can only purchase a max of %d rounds.", MAX_EXPLOSIVE_ROUNDS );
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ]; p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." ); ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
} }

View File

@ -70,6 +70,9 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{ {
case 0: case 0:
{ {
if ( p_ExplosiveBullets[ playerid ] >= MAX_EXPLOSIVE_ROUNDS )
return SendError( playerid, "You can only purchase a max of %d rounds.", MAX_EXPLOSIVE_ROUNDS );
p_ExplosiveBullets[ playerid ] += 10; p_ExplosiveBullets[ playerid ] += 10;
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." ); ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
} }

View File

@ -51,6 +51,8 @@ native WP_Hash ( buffer[ ], len, const str[ ] );
native IsValidVehicle ( vehicleid ); native IsValidVehicle ( vehicleid );
native gpci ( playerid, serial[ ], len ); native gpci ( playerid, serial[ ], len );
#define MAX_EXPLOSIVE_ROUNDS ( 1024 )
/* ** SF-CNR ** */ /* ** SF-CNR ** */
#include "irresistible\_main.pwn" #include "irresistible\_main.pwn"
@ -5537,7 +5539,11 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
SetPVarInt( playerid, "purchased_weapon", GetPVarInt( playerid, "purchased_weapon" ) + 1 ); 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 ) ); 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 ); if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, 100.0 );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) { else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 )
{
if ( p_ExplosiveBullets[ playerid ] >= MAX_EXPLOSIVE_ROUNDS )
return SendError( playerid, "You can only purchase a max of %d rounds.", MAX_EXPLOSIVE_ROUNDS );
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ]; p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." ); ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
} }
@ -5594,7 +5600,11 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
RedirectAmmunation( playerid, p_AmmunationMenu{ playerid } ); RedirectAmmunation( playerid, p_AmmunationMenu{ playerid } );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) ); if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 ) { else if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 102 )
{
if ( p_ExplosiveBullets[ playerid ] >= MAX_EXPLOSIVE_ROUNDS )
return SendError( playerid, "You can only purchase a max of %d rounds.", MAX_EXPLOSIVE_ROUNDS );
p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ]; p_ExplosiveBullets[ playerid ] += g_AmmunationWeapons[ i ] [ E_AMMO ];
ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." ); ShowPlayerHelpDialog( playerid, 3000, "Press ~r~~k~~CONVERSATION_NO~~w~ to activate explosive bullets." );
} }