You are viewing our Forum Archives. To view or take place in current topics click here.
NEED A LUA CODER FOR PAYDAY2
Posted:

NEED A LUA CODER FOR PAYDAY2Posted:

Scratched
  • Winter 2019
Status: Offline
Joined: Dec 12, 201013Year Member
Posts: 1,556
Reputation Power: 111
Status: Offline
Joined: Dec 12, 201013Year Member
Posts: 1,556
Reputation Power: 111
Alright so my issue is in the game Payday 2. I got the values and all problem is with trying to get a loop running correctly with **** it.. Here.

This is what I've been trying to do was get the turret values swapped for the money ones. Simple shit but to only one player. Also simple. But this isn't a loop and doesn't spawn to a z cord(my feet). I've tried putting it into a loop but it doesn't work. Wondering if it's even possible....
-- GIVE MONEY BAG TO TEAM MEMBERS
moneyteam = moneyteam or function()
   for pl_key, pl_record in pairs( managers.groupai:state():all_player_criminals() ) do
      if pl_record.status ~= "dead" then
         local unit = managers.groupai:state():all_player_criminals()[ pl_key ].unit:position()
         if Network:is_client() then
            managers.network:session():send_to_host( "server_drop_carry", "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.network:session():send_to_host( "server_drop_carry", "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.network:session():send_to_host( "server_drop_carry", "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.network:session():send_to_host( "server_drop_carry", "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.network:session():send_to_host( "server_drop_carry", "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
         else
            managers.player:server_drop_carry( "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.player:server_drop_carry( "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.player:server_drop_carry( "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.player:server_drop_carry( "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
            managers.player:server_drop_carry( "money", managers.money:get_bag_value( "turret" ), nil, nil, 0, unit, Rotation( math.UP, math.random() * 360 ), Vector3( 0,0,-100 ), 0 )
         end
      end
   end
end


Here's the code though that has the z cord, the value to spawn loop too.
local pos = managers.player:player_unit():position()

function spawn_loot(type, _position, z_offset, number)
local position = mvector3.copy(_position)
if z_offset then mvector3.set_z(position, position.z + z_offset) end
if Network:is_client() then
for i=1,number do
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 )
end
else
for i=1,number do
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
end

spawn_loot("money", pos, 120, 300)
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.