move some weapon drop modules

This commit is contained in:
Lorenc Pekaj 2018-10-17 04:28:47 +11:00
parent 0836381de9
commit 2a90d06d90
2 changed files with 11 additions and 9 deletions

View File

@ -13,8 +13,6 @@
#error "This module requires weapon data functions" #error "This module requires weapon data functions"
#endif #endif
#define WEAPON_DROP_ENABLED
/* ** Definitions ** */ /* ** Definitions ** */
#define MAX_WEAPON_DROPS ( 100 ) #define MAX_WEAPON_DROPS ( 100 )
@ -41,6 +39,12 @@ hook OnGameModeInit( )
return 1; return 1;
} }
hook OnServerUpdate( )
{
ClearInactiveWeaponDrops( );
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
@ -394,7 +398,7 @@ stock CreateWeaponPickup( weaponid, ammo, slotid, Float: X, Float: Y, Float: Z,
} }
else else
{ {
ClearInactiveWeaponDrops( gettime( ) ); ClearInactiveWeaponDrops( );
} }
return handle; return handle;
} }
@ -409,8 +413,11 @@ stock DestroyWeaponPickup( handle )
return 1; return 1;
} }
stock ClearInactiveWeaponDrops( global_timestamp ) stock ClearInactiveWeaponDrops( )
{ {
new
global_timestamp = GetServerTime( );
foreach ( new dropid : weapondrop ) if ( g_weaponDropData[ dropid ] [ E_EXPIRE_TIMESTAMP ] != 0 && global_timestamp > g_weaponDropData[ dropid ] [ E_EXPIRE_TIMESTAMP ] ) foreach ( new dropid : weapondrop ) if ( g_weaponDropData[ dropid ] [ E_EXPIRE_TIMESTAMP ] != 0 && global_timestamp > g_weaponDropData[ dropid ] [ E_EXPIRE_TIMESTAMP ] )
{ {
new new

View File

@ -948,11 +948,6 @@ public OnServerUpdateTimer( )
// Restore and Replenish Stuff // Restore and Replenish Stuff
if ( g_iTime > g_RestoreRobberiesBribes ) if ( g_iTime > g_RestoreRobberiesBribes )
{ {
#if defined WEAPON_DROP_ENABLED
// Replenish Weapon Drops
ClearInactiveWeaponDrops( g_iTime );
#endif
// Replenish Vaults // Replenish Vaults
for( new i = 0; i < sizeof( g_bankvaultData ); i++ ) if ( g_bankvaultData[ i ] [ E_DISABLED ] && g_iTime > g_bankvaultData[ i ] [ E_TIMESTAMP_CLOSE ] ) for( new i = 0; i < sizeof( g_bankvaultData ); i++ ) if ( g_bankvaultData[ i ] [ E_DISABLED ] && g_iTime > g_bankvaultData[ i ] [ E_TIMESTAMP_CLOSE ] )
{ {