Created
June 14, 2022 19:45
-
-
Save CamxxCore/dfc50b20b7d2c8bf2b7c6d51c7d43e50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function GimmeTheLootThread() | |
{ | |
while ( true ) | |
{ | |
if ( GetConVarInt( "2" ) == 0 || !autoLootEnabled) | |
{ | |
wait 5.0 | |
continue | |
} | |
entity player = GetLocalViewPlayer() | |
vector org = player.GetOrigin(); | |
array<entity> nearbyDeathBoxes = ArrayWithin( GetAllDeathBoxes(), org, 2000.0 ) | |
array<entity> lootEnts = GetSurvivalLootNearbyPos( org, 2000.0, false, false, false, player ) | |
foreach ( entity nearbyDeathBox in nearbyDeathBoxes ) | |
lootEnts.extend( GetDeathBoxLootEnts( nearbyDeathBox ) ) | |
foreach ( entity lootItem in lootEnts ) | |
{ | |
LootData lootData = SURVIVAL_Loot_GetLootDataByIndex( lootItem.GetSurvivalInt() ) | |
if ( lootData.lootType == eLootType.ARMOR) | |
{ | |
LootRef lootRef = SURVIVAL_CreateLootRef( lootData, lootItem ) | |
int currentShields = SURVIVAL_GetPlayerShieldHealthFromArmor( player ) | |
int lootShields = GetPropSurvivalMainProperty( lootRef.lootProperty ) | |
if (lootData.tier <= 1 || currentShields >= lootShields ) | |
continue | |
} | |
else if (!SURVIVAL_IsLootAnUpgrade( player, lootItem, lootData, eLootContext.GROUND)) | |
continue | |
if ( lootData.lootType == eLootType.ATTACHMENT && IsModTypeSight( lootData.ref, "" ) ) | |
continue | |
Remote_ServerCallFunction( "ClientCallback_PickupSurvivalItem", lootItem, 0, null ) | |
//Remote_ServerCallFunction( "ClientCallback_Sur_DropBackpackItem", lootData.ref, lootData.countPerDrop, null ) | |
} | |
wait 0.5 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment