drop weapons in BR

This commit is contained in:
Lorenc Pekaj 2019-02-24 17:06:13 +11:00
parent 99b1717ab8
commit 01d0b29514

View File

@ -247,6 +247,32 @@ hook OnPlayerDeath( playerid, killerid, reason )
new new
remaining = Iter_Count( battleroyaleplayers< lobbyid > ) - 1; remaining = Iter_Count( battleroyaleplayers< lobbyid > ) - 1;
// drop player weapons
#if defined CreateWeaponPickup
if ( remaining > 1 )
{
new Float: X, Float: Y, Float: Z;
new expire_time = GetServerTime( ) + 180;
GetPlayerPos( playerid, X, Y, Z );
for ( new slotid = 0; slotid < 13; slotid++ )
{
new
weaponid,
ammo;
GetPlayerWeaponData( playerid, slotid, weaponid, ammo );
// check valid parameters and shit
if ( weaponid != 0 && 1 < ammo < 5000 && ! IsWeaponBanned( weaponid ) ) {
CreateWeaponPickup( weaponid, ammo, slotid, X + fRandomEx( 0.5, 3.0 ), Y + fRandomEx( 0.5, 3.0 ), Z, expire_time, GetPlayerVirtualWorld( playerid ) );
}
}
}
#endif
// alert lobby
if ( IsPlayerConnected( killerid ) ) { if ( IsPlayerConnected( killerid ) ) {
BattleRoyale_SendMessage( lobbyid, "%s(%d) has been killed by %s(%d)'s %s, %d player%s remaining!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( killerid ), killerid, ReturnWeaponName( reason ), remaining, remaining == 1 ? ( "" ) : ( "s" ) ); BattleRoyale_SendMessage( lobbyid, "%s(%d) has been killed by %s(%d)'s %s, %d player%s remaining!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( killerid ), killerid, ReturnWeaponName( reason ), remaining, remaining == 1 ? ( "" ) : ( "s" ) );
} else { } else {