Skip to content

Instantly share code, notes, and snippets.

@CamxxCore
Created June 14, 2022 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CamxxCore/dfc50b20b7d2c8bf2b7c6d51c7d43e50 to your computer and use it in GitHub Desktop.
Save CamxxCore/dfc50b20b7d2c8bf2b7c6d51c7d43e50 to your computer and use it in GitHub Desktop.
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