Code:
-- Add stuff in van
function secure(name)
managers.loot:secure( name, managers.money:get_bag_value( name ) )
end
--secure("meth")
--secure("money")
--secure("gold")
-- Spawn bags
function get_crosshair_ray(penetrate, from_pos, mvec_to)
local player_unit = managers.player:player_unit()
local camera = player_unit:camera()
if not penetrate then penetrate = false end
if not mvec_to then mvec_to = Vector3() end
if not from_pos then from_pos = camera:position() end
mvector3.set( mvec_to, camera:forward() )
mvector3.multiply( mvec_to, 20000 )
mvector3.add( mvec_to, from_pos )
local col_ray = World:raycast( "ray", from_pos, mvec_to, "slot_mask", managers.slot:get_mask( "bullet_impact_targets" ) )
if col_ray then
if penetrate then
local offset = Vector3()
mvector3.set(offset, camera:forward())
mvector3.multiply(offset, 100)
mvector3.add(col_ray.hit_position, offset)
end
return col_ray
end
return false
end
function get_crosshair_pos(penetrate, from_pos, mvec_to)
local ray = get_crosshair_ray(penetrate, from_pos, mvec_to)
if not ray then return false end
return ray.hit_position
end
function spawn_loot(type, _position, z_offset)
local position = mvector3.copy(_position)
if z_offset then mvector3.set_z(position, position.z + z_offset) end
if Network:is_client() then
managers.network:session():send_to_host( "server_drop_carry", type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
else
managers.player:server_drop_carry( type, managers.money:get_bag_value( type ), nil, nil, 0, position, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,0 ), 0 )
end
end
if managers.job:current_level_id() == "nightclub" or managers.job:current_level_id() == "welcome_to_the_jungle_1" or managers.job:current_level_id() == "watchdogs_1" or managers.job:current_level_id() == "watchdogs_2" then
spawn_loot("coke", get_crosshair_pos(), 120)
--secure("coke")
end
if managers.job:current_level_id() == "branchbank" or managers.job:current_level_id() == "firestarter_3" then
spawn_loot("money", get_crosshair_pos(), 120)
spawn_loot("gold", get_crosshair_pos(), 120)
end
if managers.job:current_level_id() == "firestarter_2" then
spawn_loot("money", get_crosshair_pos(), 120)
spawn_loot("gold", get_crosshair_pos(), 120)
spawn_loot("coke", get_crosshair_pos(), 120)
end
if managers.job:current_level_id() == "alex_1" then
spawn_loot("meth", get_crosshair_pos(), 120)
end
if managers.job:current_level_id() == "alex_3" then
spawn_loot("money", get_crosshair_pos(), 120)
end
if managers.job:current_level_id() == "arm_cro" or managers.job:current_level_id() == "arm_und" or managers.job:current_level_id() == "arm_hcm" or managers.job:current_level_id() == "arm_par" or managers.job:current_level_id() == "arm_fac" then
spawn_loot("gold", get_crosshair_pos(), 120)
end
if managers.job:current_level_id() == "arm_for" then
spawn_loot("ammo", get_crosshair_pos(), 120)
--spawn_loot("turret", get_crosshair_pos(), 120)
--spawn_loot("lance_bag", get_crosshair_pos(), 120)
end
spawn_loot("ammo", get_crosshair_pos(), 400)
--spawn_loot("meth", get_crosshair_pos(), 120)
--spawn_loot("gold", get_crosshair_pos(), 120)
--spawn_loot("money", get_crosshair_pos(), 120)
--spawn_loot("coke", get_crosshair_pos(), 120)
--spawn_loot("weapons", get_crosshair_pos(), 120)
--spawn_loot("lance_bag", get_crosshair_pos(), 120)
--spawn_loot("painting", get_crosshair_pos(), 120)
--spawn_loot("circuit", get_crosshair_pos(), 120)
--spawn_loot("engine_XX", get_crosshair_pos(), 120) -- 01-12
--spawn_loot("person", get_crosshair_pos(), 120)
--spawn_loot("special_person", get_crosshair_pos(), 120)
Will drop a bag where you aim with the mouse. 4m will make the bag explode; loot bag drop code originally by dougbenham/transcend on UC, original spawn code by Simplity on UC. I just modified it to spawn bags instead of npc.