buyable armour and weapon/health drops

This commit is contained in:
Lorenc Pekaj 2018-05-25 06:29:21 +10:00
parent 5bc884912d
commit 55c633de4d
5 changed files with 127 additions and 47 deletions

View File

@ -75,7 +75,6 @@ native gpci ( playerid, serial[ ], len );
/* ** Useful macros ** */ /* ** Useful macros ** */
#define DQCMD:%1(%2) forward discord_%1(%2); public discord_%1(%2) #define DQCMD:%1(%2) forward discord_%1(%2); public discord_%1(%2)
#define IsPlayerJailed(%1) (p_Jailed{%1})
#define IsPlayerTazed(%1) (p_Tazed{%1}) #define IsPlayerTazed(%1) (p_Tazed{%1})
#define IsPlayerDetained(%1) (p_Detained{%1}) #define IsPlayerDetained(%1) (p_Detained{%1})
#define IsPlayerCuffed(%1) (p_Cuffed{%1}) #define IsPlayerCuffed(%1) (p_Cuffed{%1})
@ -84,7 +83,6 @@ native gpci ( playerid, serial[ ], len );
#define IsPlayerBlowingCock(%0) (p_GivingBlowjob{%0}) #define IsPlayerBlowingCock(%0) (p_GivingBlowjob{%0})
#define IsPlayerGettingBlowed(%0) (p_GettingBlowjob{%0}) #define IsPlayerGettingBlowed(%0) (p_GettingBlowjob{%0})
#define IsPlayerAdminOnDuty(%0) (p_AdminOnDuty{%0}) #define IsPlayerAdminOnDuty(%0) (p_AdminOnDuty{%0})
#define IsPlayerInPaintBall(%0) (p_inPaintBall{%0})
#define IsPlayerMining(%0) (p_isMining{%0}) #define IsPlayerMining(%0) (p_isMining{%0})
#define IsPlayerLoadingObjects(%0) (p_pausedToLoad{%0}) #define IsPlayerLoadingObjects(%0) (p_pausedToLoad{%0})
#define IsPlayerOnSlotMachine(%0) (p_usingSlotMachine[%0]!=-1) #define IsPlayerOnSlotMachine(%0) (p_usingSlotMachine[%0]!=-1)
@ -105,7 +103,6 @@ native gpci ( playerid, serial[ ], len );
#define UpdateWoodStockObject() (format(szNormalString,32,"%d Logs Ready",g_LogsInStock),SetDynamicObjectMaterialText(g_LogCountObject,0,szNormalString,130,"Arial",0,1,-1,0,1)) #define UpdateWoodStockObject() (format(szNormalString,32,"%d Logs Ready",g_LogsInStock),SetDynamicObjectMaterialText(g_LogCountObject,0,szNormalString,130,"Arial",0,1,-1,0,1))
#define replacePercentageSymbol(%0) strreplacechar(szString,'%','#') #define replacePercentageSymbol(%0) strreplacechar(szString,'%','#')
#define IsPlayerInEntrance(%0,%1) (p_LastEnteredEntrance[%0]==(%1)) #define IsPlayerInEntrance(%0,%1) (p_LastEnteredEntrance[%0]==(%1))
#define IsPlayerInEvent(%0) (GetPlayerVirtualWorld(playerid)==69)
#define IsPlayerInPlayerGang(%0,%1) (p_Class[%0] == p_Class[%1] && p_Class[%0] == CLASS_CIVILIAN && p_GangID[%0] == p_GangID[%1] && p_GangID[%0] != INVALID_GANG_ID) #define IsPlayerInPlayerGang(%0,%1) (p_Class[%0] == p_Class[%1] && p_Class[%0] == CLASS_CIVILIAN && p_GangID[%0] == p_GangID[%1] && p_GangID[%0] != INVALID_GANG_ID)
#define INVALID_TIMER_ID (-1) #define INVALID_TIMER_ID (-1)
#define IsPlayerNpcEx(%0) (IsPlayerNPC(%0) || strmatch(p_PlayerIP[%0], "127.0.0.1")) #define IsPlayerNpcEx(%0) (IsPlayerNPC(%0) || strmatch(p_PlayerIP[%0], "127.0.0.1"))
@ -1887,6 +1884,7 @@ new
#define MENU_RIFLES ( 4 ) #define MENU_RIFLES ( 4 )
#define MENU_SHOTGUNS ( 5 ) #define MENU_SHOTGUNS ( 5 )
#define MENU_THROWN ( 6 ) #define MENU_THROWN ( 6 )
#define MENU_ARMOR ( 7 )
enum E_WEAPONS_DATA enum E_WEAPONS_DATA
{ {
@ -1898,7 +1896,7 @@ new
g_AmmunitionCategory[ ] [ ] = g_AmmunitionCategory[ ] [ ] =
{ {
{ "Assault" }, { "Melee" }, { "Submachine Guns" }, { "Pistols" }, { "Assault" }, { "Melee" }, { "Submachine Guns" }, { "Pistols" },
{ "Rifles" }, { "Shotguns" }, { "Thrown" } { "Rifles" }, { "Shotguns" }, { "Thrown" }, { "Armor" }
}, },
g_AmmunationWeapons[ ][ E_WEAPONS_DATA ] = g_AmmunationWeapons[ ][ E_WEAPONS_DATA ] =
{ {
@ -1934,7 +1932,9 @@ new
{ MENU_THROWN, "Teargas", 17, 5, 500 }, { MENU_THROWN, "Teargas", 17, 5, 500 },
{ MENU_THROWN, "Grenade", 16, 1, 1200 }, { MENU_THROWN, "Grenade", 16, 1, 1200 },
{ MENU_THROWN, "Molotov Cocktail", 18, 4, 1400 } { MENU_THROWN, "Molotov Cocktail", 18, 4, 1400 },
{ MENU_ARMOR, "Armor", 101, 100, 12500 }
}, },
p_AmmunationMenu [ MAX_PLAYERS char ] p_AmmunationMenu [ MAX_PLAYERS char ]
; ;
@ -3448,7 +3448,7 @@ public OnGameModeInit()
/* ** Robbery Points ** */ /* ** Robbery Points ** */
static const ROBBERY_BOT_PAY = 2100; // max pay from robbing bots static const ROBBERY_BOT_PAY = 2100; // max pay from robbing bots
static const ROBBERY_SAFE_PAY = 4500; // max pay from robbing safes static const ROBBERY_SAFE_PAY = 4300; // max pay from robbing safes
CreateMultipleRobberies( "Bank of San Fierro - Safe 1", floatround( float( ROBBERY_SAFE_PAY ) * 1.85 ), -1400.941772, 862.858947, 984.17200, -90.00000, g_bankvaultData[ CITY_SF ] [ E_WORLD ] ); CreateMultipleRobberies( "Bank of San Fierro - Safe 1", floatround( float( ROBBERY_SAFE_PAY ) * 1.85 ), -1400.941772, 862.858947, 984.17200, -90.00000, g_bankvaultData[ CITY_SF ] [ E_WORLD ] );
CreateMultipleRobberies( "Bank of San Fierro - Safe 2", floatround( float( ROBBERY_SAFE_PAY ) * 1.85 ), -1400.941772, 861.179321, 985.07251, -90.00000, g_bankvaultData[ CITY_SF ] [ E_WORLD ] ); CreateMultipleRobberies( "Bank of San Fierro - Safe 2", floatround( float( ROBBERY_SAFE_PAY ) * 1.85 ), -1400.941772, 861.179321, 985.07251, -90.00000, g_bankvaultData[ CITY_SF ] [ E_WORLD ] );
@ -8822,9 +8822,9 @@ CMD:business( playerid, params[ ] )
if ( p_OwnedBusinesses[ playerid ] >= getPlayerBusinessCapacity( playerid ) ) return SendError( playerid, "You cannot purchase any more businesses, you've reached the limit." ); if ( p_OwnedBusinesses[ playerid ] >= getPlayerBusinessCapacity( playerid ) ) return SendError( playerid, "You cannot purchase any more businesses, you've reached the limit." );
if ( GetPlayerScore( playerid ) < 1000 ) return SendError( playerid, "You need at least 1,000 score to buy a business." ); if ( GetPlayerScore( playerid ) < 1000 ) return SendError( playerid, "You need at least 1,000 score to buy a business." );
foreach(new b : business) foreach ( new b : business )
{ {
if ( IsPlayerInDynamicCP( playerid, g_businessData[ b ] [ E_ENTER_CP ] ) ) if ( IsPlayerInDynamicCP( playerid, g_businessData[ b ] [ E_ENTER_CP ] ) || ( iBusiness != -1 && iBusiness == b ) )
{ {
if ( ! g_businessData[ b ] [ E_OWNER_ID ] ) if ( ! g_businessData[ b ] [ E_OWNER_ID ] )
{ {
@ -12732,7 +12732,7 @@ CMD:h( playerid, params[ ] )
foreach ( new i : houses ) foreach ( new i : houses )
{ {
if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) ) if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) || ( ID != -1 && ID == i ) )
{ {
if ( strmatch( g_houseData[ i ] [ E_OWNER ], "No-one" ) ) if ( strmatch( g_houseData[ i ] [ E_OWNER ], "No-one" ) )
{ {
@ -14772,6 +14772,7 @@ CMD:gang( playerid, params[ ] )
else if ( gangNameExists( szName ) ) return SendError( playerid, "This gang already exists, try another name." ); else if ( gangNameExists( szName ) ) return SendError( playerid, "This gang already exists, try another name." );
else else
{ {
trimString( szName );
format( g_gangData[ p_GangID[ playerid ] ] [ E_NAME ], 30, "%s", szName ); format( g_gangData[ p_GangID[ playerid ] ] [ E_NAME ], 30, "%s", szName );
SendClientMessageToGang( p_GangID[ playerid ], g_gangData[ p_GangID[ playerid ] ] [ E_COLOR ], "[GANG]{FFFFFF} %s(%d) has changed the gang's name to {%06x}%s"COL_WHITE".", ReturnPlayerName( playerid ), playerid, g_gangData[ p_GangID[ playerid ] ] [ E_COLOR ] >>> 8, szName ); SendClientMessageToGang( p_GangID[ playerid ], g_gangData[ p_GangID[ playerid ] ] [ E_COLOR ], "[GANG]{FFFFFF} %s(%d) has changed the gang's name to {%06x}%s"COL_WHITE".", ReturnPlayerName( playerid ), playerid, g_gangData[ p_GangID[ playerid ] ] [ E_COLOR ] >>> 8, szName );
SaveGangData( p_GangID[ playerid ] ); SaveGangData( p_GangID[ playerid ] );
@ -17943,7 +17944,7 @@ CMD:explosiverounds( playerid, params[ ] ) {
new new
targetid, rounds; targetid, rounds;
if ( sscanf( params, "dd", targetid, rounds ) ) if ( sscanf( params, "ud", targetid, rounds ) )
return SendUsage( playerid, "/explosiverounds [PLAYER_ID] [ROUNDS]" ); return SendUsage( playerid, "/explosiverounds [PLAYER_ID] [ROUNDS]" );
p_ExplosiveBullets[ targetid ] += rounds; p_ExplosiveBullets[ targetid ] += rounds;
@ -22257,11 +22258,8 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
} }
else else
{ {
new
iAfterTax = floatround( iWithdraw * 0.975 );
g_gangData[ gangid ] [ E_BANK ] -= iWithdraw; g_gangData[ gangid ] [ E_BANK ] -= iWithdraw;
GivePlayerCash( playerid, iAfterTax ); GivePlayerCash( playerid, iWithdraw );
SaveGangData( gangid ); SaveGangData( gangid );
// transaction // transaction
@ -22269,7 +22267,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
mysql_single_query( szNormalString ); mysql_single_query( szNormalString );
// withdraw // withdraw
SendClientMessageToGang( gangid, g_gangData[ gangid ] [ E_COLOR ], "[GANG]"COL_GREY" %s(%d) has withdrawn %s (inc. 2.5%s fee) from the gang bank account.", ReturnPlayerName( playerid ), playerid, number_format( iAfterTax ), "%%" ); SendClientMessageToGang( gangid, g_gangData[ gangid ] [ E_COLOR ], "[GANG]"COL_GREY" %s(%d) has withdrawn %s from the gang bank account.", ReturnPlayerName( playerid ), playerid, number_format( iWithdraw ), "%%" );
format( Query, sizeof( Query ), ""COL_GREY"Amount Withdrawn:"COL_WHITE" %s\n"COL_GREY"Current Balance:"COL_WHITE" %s\n"COL_GREY"Current Money:{FFFFFF} %s", number_format( iWithdraw ), number_format( g_gangData[ gangid ] [ E_BANK ] ), number_format( GetPlayerCash( playerid ) ) ); format( Query, sizeof( Query ), ""COL_GREY"Amount Withdrawn:"COL_WHITE" %s\n"COL_GREY"Current Balance:"COL_WHITE" %s\n"COL_GREY"Current Money:{FFFFFF} %s", number_format( iWithdraw ), number_format( g_gangData[ gangid ] [ E_BANK ] ), number_format( GetPlayerCash( playerid ) ) );
ShowPlayerDialog( playerid, DIALOG_GANG_BANK_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Gang Account", Query, "Ok", "Back" ); ShowPlayerDialog( playerid, DIALOG_GANG_BANK_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Gang Account", Query, "Ok", "Back" );
} }
@ -24505,6 +24503,11 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
return 1; return 1;
} }
if ( p_VIPLevel[ playerid ] < VIP_BRONZE && listitem == MENU_ARMOR ) {
SendError( playerid, "You are not Bronze V.I.P, to become one visit "COL_GREY"donate.irresistiblegaming.com" );
return ShowAmmunationMenu( playerid, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL );
}
p_WeaponDealMenu{ playerid } = listitem; p_WeaponDealMenu{ playerid } = listitem;
RedirectAmmunation( playerid, listitem, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL_BUY, 0.75, true ); RedirectAmmunation( playerid, listitem, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL_BUY, 0.75, true );
} }
@ -24539,8 +24542,9 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
GivePlayerCash( weapondealerid, floatround( price * 0.75 ) ); GivePlayerCash( weapondealerid, floatround( price * 0.75 ) );
SendClientMessageFormatted( weapondealerid, -1, ""COL_ORANGE"[WEAPON DEAL]{FFFFFF} %s(%d) has purchased a %s for "COL_GOLD"%s"COL_WHITE" (tax applied).", ReturnPlayerName( playerid ), playerid, g_AmmunationWeapons[ i ] [ E_NAME ], number_format( price ) ); SendClientMessageFormatted( weapondealerid, -1, ""COL_ORANGE"[WEAPON DEAL]{FFFFFF} %s(%d) has purchased a %s for "COL_GOLD"%s"COL_WHITE" (tax applied).", ReturnPlayerName( playerid ), playerid, g_AmmunationWeapons[ i ] [ E_NAME ], number_format( price ) );
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 a %s for "COL_GOLD"%s"COL_WHITE".", g_AmmunationWeapons[ i ] [ E_NAME ], number_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 ], number_format( price ) );
GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], 15000 ); // Infinite if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, 100.0 );
else GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], 15000 ); // Infinite
SetPlayerArmedWeapon( playerid, 0 ); SetPlayerArmedWeapon( playerid, 0 );
GivePlayerCash( playerid, -( price ) ); GivePlayerCash( playerid, -( price ) );
RedirectAmmunation( playerid, p_WeaponDealMenu{ playerid }, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL_BUY, 0.75, true ); RedirectAmmunation( playerid, p_WeaponDealMenu{ playerid }, "{FFFFFF}Weapon Deal - Purchase Weapons", DIALOG_WEAPON_DEAL_BUY, 0.75, true );
@ -24592,9 +24596,12 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
} }
GivePlayerCash( playerid, -iCostPrice ); GivePlayerCash( playerid, -iCostPrice );
GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] );
if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
else GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] );
RedirectAmmunation( playerid, p_WeaponLockerMenu{ playerid }, "{FFFFFF}Weapon Locker - Purchase Weapons", DIALOG_WEAPON_LOCKER_BUY, 1.25 ); RedirectAmmunation( playerid, p_WeaponLockerMenu{ playerid }, "{FFFFFF}Weapon Locker - Purchase Weapons", DIALOG_WEAPON_LOCKER_BUY, 1.25 );
SendServerMessage( playerid, "You have purchased a %s(%d) for "COL_GOLD"%s"COL_WHITE"%s (inc. fees).", g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], number_format( iCostPrice ) ); SendServerMessage( playerid, "You have purchased %s(%d) for "COL_GOLD"%s"COL_WHITE"%s (inc. fees).", g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], number_format( iCostPrice ) );
break; break;
} }
x ++; x ++;
@ -24640,8 +24647,11 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
GivePlayerCash( playerid, -iCostPrice ); GivePlayerCash( playerid, -iCostPrice );
RedirectAmmunation( playerid, p_AmmunationMenu{ playerid } ); RedirectAmmunation( playerid, p_AmmunationMenu{ playerid } );
GivePlayerWeapon( playerid, g_AmmunationWeapons[ i ] [ E_WEPID ], g_AmmunationWeapons[ i ] [ E_AMMO ] );
SendServerMessage( playerid, "You have purchased a %s(%d) for "COL_GOLD"%s"COL_WHITE"%s.", g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], number_format( iCostPrice ), bDealer ? ( " (inc. discount)" ) : ( "" ) ); if ( g_AmmunationWeapons[ i ] [ E_WEPID ] == 101 ) SetPlayerArmour( playerid, float( g_AmmunationWeapons[ i ] [ E_AMMO ] ) );
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 ], number_format( iCostPrice ), bDealer ? ( " (inc. discount)" ) : ( "" ) );
break; break;
} }
x ++; x ++;
@ -29390,7 +29400,7 @@ stock getClosestRobberySafe( playerid, &Float: dis = 99999.99 )
; ;
foreach(new i : RobberyCount) foreach(new i : RobberyCount)
{ {
if ( world != 0 && g_robberyData[ i ] [ E_WORLD ] != world ) continue; if ( world != 0 && g_robberyData[ i ] [ E_WORLD ] != -1 && g_robberyData[ i ] [ E_WORLD ] != world ) continue;
GetDynamicObjectPos( g_robberyData[ i ] [ E_SAFE ], X, Y, Z ); GetDynamicObjectPos( g_robberyData[ i ] [ E_SAFE ], X, Y, Z );
dis2 = GetPlayerDistanceFromPoint( playerid, X, Y, Z ); dis2 = GetPlayerDistanceFromPoint( playerid, X, Y, Z );
if ( dis2 < dis && dis2 != -1.00 ) { if ( dis2 < dis && dis2 != -1.00 ) {
@ -30562,6 +30572,7 @@ stock CreateGang( const gang_name[ 30 ], leader, gang_color, kills = 1, deaths =
// format name // format name
format( g_gangData[ handle ] [ E_NAME ], 30, "%s", gang_name ); format( g_gangData[ handle ] [ E_NAME ], 30, "%s", gang_name );
trimString( g_gangData[ handle ] [ E_NAME ] );
// default variables // default variables
g_gangData[ handle ] [ E_LEADER ] = leader; g_gangData[ handle ] [ E_LEADER ] = leader;
@ -31552,11 +31563,13 @@ stock RedirectAmmunation( playerid, listitem, custom_title[ ] = "{FFFFFF}Ammu-Na
new new
szString[ 420 ]; szString[ 420 ];
szString = ! unlimited_ammo ? ( ""COL_WHITE"Weapon\t"COL_WHITE"Ammo\t"COL_WHITE"Price\n" ) : ( ""COL_WHITE"Weapon\t"COL_WHITE"Price\n" ); if ( listitem == MENU_ARMOR ) szString = ""COL_WHITE"Item\t"COL_WHITE"Price\n";
else if ( unlimited_ammo ) szString = ""COL_WHITE"Weapon\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 ) for( new i; i < sizeof( g_AmmunationWeapons ); i++ ) if ( g_AmmunationWeapons[ i ] [ E_MENU ] == listitem )
{ {
if ( ! unlimited_ammo ) // Other multipliers will not specify ammo if ( ! unlimited_ammo && listitem != MENU_ARMOR ) // Other multipliers will not specify ammo
format( szString, sizeof( szString ), "%s%s\t%d\t"COL_GOLD"%s\n", szString, g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], number_format( floatround( g_AmmunationWeapons[ i ] [ E_PRICE ] * custom_multplier ) ) ); format( szString, sizeof( szString ), "%s%s\t%d\t"COL_GOLD"%s\n", szString, g_AmmunationWeapons[ i ] [ E_NAME ], g_AmmunationWeapons[ i ] [ E_AMMO ], number_format( floatround( g_AmmunationWeapons[ i ] [ E_PRICE ] * custom_multplier ) ) );
else else
format( szString, sizeof( szString ), "%s%s\t"COL_GOLD"%s\n", szString, g_AmmunationWeapons[ i ] [ E_NAME ], number_format( floatround( g_AmmunationWeapons[ i ] [ E_PRICE ] * custom_multplier ) ) ); format( szString, sizeof( szString ), "%s%s\t"COL_GOLD"%s\n", szString, g_AmmunationWeapons[ i ] [ E_NAME ], number_format( floatround( g_AmmunationWeapons[ i ] [ E_PRICE ] * custom_multplier ) ) );
@ -31568,12 +31581,11 @@ stock RedirectAmmunation( playerid, listitem, custom_title[ ] = "{FFFFFF}Ammu-Na
stock ShowAmmunationMenu( playerid, custom_title[ ] = "{FFFFFF}Ammu-Nation", custom_dialogid = DIALOG_AMMU ) stock ShowAmmunationMenu( playerid, custom_title[ ] = "{FFFFFF}Ammu-Nation", custom_dialogid = DIALOG_AMMU )
{ {
static static
szString[ 60 ]; szString[ 70 ];
if ( !szString[ 0 ] ) if ( !szString[ 0 ] )
{ {
for( new i; i < sizeof( g_AmmunitionCategory ); i++ ) for( new i = 0; i < sizeof( g_AmmunitionCategory ); i++ ) {
{
format( szString, sizeof( szString ), "%s%s\n", szString, g_AmmunitionCategory[ i ] ); format( szString, sizeof( szString ), "%s%s\n", szString, g_AmmunitionCategory[ i ] );
} }
} }
@ -38370,10 +38382,16 @@ stock GetPlayerAccountID( playerid ) return p_AccountID[ playerid ];
stock GetPlayerVIPLevel( playerid ) return p_VIPLevel[ playerid ]; stock GetPlayerVIPLevel( playerid ) return p_VIPLevel[ playerid ];
stock IsPlayerInPaintBall( playerid ) return p_inPaintBall{ playerid };
stock GetPlayerAdminLevel( playerid ) return p_AdminLevel[ playerid ]; stock GetPlayerAdminLevel( playerid ) return p_AdminLevel[ playerid ];
stock IsPlayerSpawned( playerid ) return p_Spawned{ playerid }; stock IsPlayerSpawned( playerid ) return p_Spawned{ playerid };
stock IsPlayerInEvent( playerid ) return ( GetPlayerVirtualWorld( playerid ) == 69 );
stock IsPlayerJailed( playerid ) return p_Jailed{ playerid };
stock IsPlayerEmailVerified( playerid ) return p_accountSecurityData[ playerid ] [ E_ID ]; stock IsPlayerEmailVerified( playerid ) return p_accountSecurityData[ playerid ] [ E_ID ];
stock UpdatePlayerEntranceExitTick( playerid, ms = 2000 ) { stock UpdatePlayerEntranceExitTick( playerid, ms = 2000 ) {
@ -38381,3 +38399,4 @@ stock UpdatePlayerEntranceExitTick( playerid, ms = 2000 ) {
} }
stock CanPlayerExitEntrance( playerid ) return GetTickCount( ) > p_EntranceTickcount[ playerid ]; stock CanPlayerExitEntrance( playerid ) return GetTickCount( ) > p_EntranceTickcount[ playerid ];

View File

@ -6,7 +6,7 @@
*/ */
/* ** Includes ** */ /* ** Includes ** */
// #include < YSI\y_hooks > #include < YSI\y_hooks >
/* ** Definitions ** */ /* ** Definitions ** */
#define MAX_GANGS ( MAX_PLAYERS ) // safest is MAX_PLAYERS #define MAX_GANGS ( MAX_PLAYERS ) // safest is MAX_PLAYERS

View File

@ -18,6 +18,9 @@
/* ** Definitions ** */ /* ** Definitions ** */
#define MAX_WEAPON_DROPS ( 50 ) #define MAX_WEAPON_DROPS ( 50 )
#define WEAPON_HEALTH ( 100 )
#define WEAPON_ARMOUR ( 101 )
/* ** Variables ** */ /* ** Variables ** */
enum E_WEAPONDROP_DATA { enum E_WEAPONDROP_DATA {
E_WEAPON_ID, E_AMMO, E_PICKUP, E_WEAPON_ID, E_AMMO, E_PICKUP,
@ -27,18 +30,37 @@ enum E_WEAPONDROP_DATA {
static g_weaponDropData [ MAX_WEAPON_DROPS ] [ E_WEAPONDROP_DATA ]; static g_weaponDropData [ MAX_WEAPON_DROPS ] [ E_WEAPONDROP_DATA ];
static Iterator: weapondrop < MAX_WEAPON_DROPS >; static Iterator: weapondrop < MAX_WEAPON_DROPS >;
static const g_rankHealthPayout[ ] = { 100, 75, 50, 45, 40, 35, 30, 25, 20, 15, 10 };
static g_HealthPickup;
/* ** Hooks ** */ /* ** Hooks ** */
hook OnGameModeInit( )
{
g_HealthPickup = CreateDynamicPickup( 1240, 3, -1980.3679, 884.4898, 45.2031 );
return 1;
}
#if defined AC_INCLUDED #if defined AC_INCLUDED
hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart ) hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
#else #else
hook OnPlayerDeath( playerid, killerid, reason ) hook OnPlayerDeath( playerid, killerid, reason )
#endif #endif
{ {
new static
Float: X, Float: Y, Float: Z; Float: X, Float: Y, Float: Z;
if ( GetPlayerPos( playerid, X, Y, Z ) ) GetPlayerPos( playerid, X, Y, Z );
if ( IsPlayerConnected( killerid ) )
{ {
if ( IsPlayerJailed( playerid ) || IsPlayerInPaintBall( playerid ) || IsPlayerInEvent( playerid ) )
return 1;
new
killer_rank = GetPlayerRank( killerid ),
expire_time = gettime( ) + 180;
for ( new slotid = 0; slotid < 13; slotid++ ) for ( new slotid = 0; slotid < 13; slotid++ )
{ {
new new
@ -47,10 +69,17 @@ hook OnPlayerDeath( playerid, killerid, reason )
GetPlayerWeaponData( playerid, slotid, weaponid, ammo ); GetPlayerWeaponData( playerid, slotid, weaponid, ammo );
// third of what player had
ammo /= 5;
// check valid parameters and shit
if ( weaponid != 0 && 1 < ammo < 5000 && ! IsWeaponBanned( weaponid ) ) { if ( weaponid != 0 && 1 < ammo < 5000 && ! IsWeaponBanned( weaponid ) ) {
CreateWeaponPickup( weaponid, ammo, slotid, X + fRandomEx( 0, 3 ), Y + fRandomEx( 0, 3 ), Z, gettime( ) + 180 ); CreateWeaponPickup( weaponid, ammo, slotid, X + fRandomEx( 0.5, 3.0 ), Y + fRandomEx( 0.5, 3.0 ), Z, expire_time );
} }
} }
// health drop
CreateWeaponPickup( WEAPON_HEALTH, g_rankHealthPayout[ killer_rank ], 0, X + fRandomEx( 0.5, 3.0 ), Y + fRandomEx( 0.5, 3.0 ), Z, expire_time );
} }
return 1; return 1;
} }
@ -61,16 +90,42 @@ hook OnPlayerPickUpDynPickup( playerid, pickupid )
new existing_weapon; new existing_weapon;
new existing_ammo; new existing_ammo;
// Health Pickups
if ( pickupid == g_HealthPickup ) {
SetPlayerHealth( playerid, 100.0 );
return 1;
}
// Player Drops
foreach ( new dropid : weapondrop ) foreach ( new dropid : weapondrop )
{ {
if ( g_weaponDropData[ dropid ] [ E_PICKUP ] == pickupid ) if ( g_weaponDropData[ dropid ] [ E_PICKUP ] == pickupid )
{ {
if ( g_weaponDropData[ dropid ] [ E_WEAPON_ID ] == WEAPON_HEALTH )
{
new
Float: health;
if ( GetPlayerHealth( playerid, health ) )
{
// no weed like effects
if ( ( health += float( g_weaponDropData[ dropid ] [ E_AMMO ] ) ) > 100.0 )
health = 100.0;
SetPlayerHealth( playerid, health );
}
}
else
{
GetPlayerKeys( playerid, keys, existing_weapon, existing_weapon ); GetPlayerKeys( playerid, keys, existing_weapon, existing_weapon );
GetPlayerWeaponData( playerid, g_weaponDropData[ dropid ] [ E_SLOT_ID ], existing_weapon, existing_ammo ); GetPlayerWeaponData( playerid, g_weaponDropData[ dropid ] [ E_SLOT_ID ], existing_weapon, existing_ammo );
printf("Existing Weapon %d, Dropped Weapon %d, Slot id %d", existing_weapon, g_weaponDropData[ dropid ] [ E_WEAPON_ID ], g_weaponDropData[ dropid ] [ E_SLOT_ID ] ); // printf("Existing Weapon %d, Dropped Weapon %d, Slot id %d", existing_weapon, g_weaponDropData[ dropid ] [ E_WEAPON_ID ], g_weaponDropData[ dropid ] [ E_SLOT_ID ] );
if ( existing_weapon > g_weaponDropData[ dropid ] [ E_WEAPON_ID ] && ! ( keys & KEY_ACTION ) && existing_ammo ) { // if ( existing_weapon > g_weaponDropData[ dropid ] [ E_WEAPON_ID ] && ! ( keys & KEY_ACTION ) && existing_ammo )
GameTextForPlayer( playerid, "~r~PRESS ~k~~PED_ANSWER_PHONE~ TO TAKE WEAPON", 4000, 3 ); if ( ! ( keys & KEY_ACTION ) && existing_ammo )
{
ShowPlayerHelpDialog( playerid, 2500, "Hold ~r~~k~~PED_ANSWER_PHONE~~w~ To Take %s", ReturnWeaponName( g_weaponDropData[ dropid ] [ E_WEAPON_ID ] ) );
return 1; return 1;
} }
@ -78,8 +133,11 @@ hook OnPlayerPickUpDynPickup( playerid, pickupid )
p_PlayerHasWeapon[ playerid ] { g_weaponDropData[ dropid ] [ E_WEAPON_ID ] } = true; p_PlayerHasWeapon[ playerid ] { g_weaponDropData[ dropid ] [ E_WEAPON_ID ] } = true;
#endif #endif
PlayerPlaySound( playerid, 1150, 0.0, 0.0, 0.0 );
GivePlayerWeapon( playerid, g_weaponDropData[ dropid ] [ E_WEAPON_ID ], g_weaponDropData[ dropid ] [ E_AMMO ] ); GivePlayerWeapon( playerid, g_weaponDropData[ dropid ] [ E_WEAPON_ID ], g_weaponDropData[ dropid ] [ E_AMMO ] );
}
// destroy health pickup
PlayerPlaySound( playerid, 1150, 0.0, 0.0, 0.0 );
DestroyWeaponPickup( dropid ); DestroyWeaponPickup( dropid );
return 1; return 1;
} }
@ -94,12 +152,12 @@ stock CreateWeaponPickup( weaponid, ammo, slotid, Float: X, Float: Y, Float: Z,
if ( handle != ITER_NONE ) if ( handle != ITER_NONE )
{ {
Iter_Add( weapondrop, handle ); g_weaponDropData[ handle ] [ E_PICKUP ] = CreateDynamicPickup( weaponid == WEAPON_HEALTH ? 1240 : GetWeaponModel( weaponid ), 1, X, Y, Z );
g_weaponDropData[ handle ] [ E_PICKUP ] = CreateDynamicPickup( GetWeaponModel( weaponid ), 1, X, Y, Z );
g_weaponDropData[ handle ] [ E_EXPIRE_TIMESTAMP ] = expire_time; g_weaponDropData[ handle ] [ E_EXPIRE_TIMESTAMP ] = expire_time;
g_weaponDropData[ handle ] [ E_WEAPON_ID ] = weaponid; g_weaponDropData[ handle ] [ E_WEAPON_ID ] = weaponid;
g_weaponDropData[ handle ] [ E_AMMO ] = ammo; g_weaponDropData[ handle ] [ E_AMMO ] = ammo;
g_weaponDropData[ handle ] [ E_SLOT_ID ] = slotid; g_weaponDropData[ handle ] [ E_SLOT_ID ] = slotid;
Iter_Add( weapondrop, handle );
} }
else else
{ {

View File

@ -32,7 +32,7 @@
#include < irresistible\features\radio > #include < irresistible\features\radio >
#include < irresistible\features\cash_cards > #include < irresistible\features\cash_cards >
#include < irresistible\features\furniture > #include < irresistible\features\furniture >
// #include < irresistible\features\weapon_drop > #include < irresistible\features\weapon_drop >
// #include < irresistible\features\vote > // #include < irresistible\features\vote >
// gangs and facilities // gangs and facilities

View File

@ -1 +1,4 @@
(/) New tax system. 1% daily for all users, businesses and gangs. (+) You can now buy Armor at the ammunation for $12.5K. Must be Bronze VIP to get it from a weapon dealer.
(+) Players now drop their weapons and health when they are killed. More health is dropped with a higher in-game rank.
(*) Fixes bugs with certain shops not having their safes breakable.
(-) No more 2.5% withdrawal fee for gangs.