Jump to content
gc8

Get weapons from ground

Recommended Posts

Hey 
can anyone tell how do you pick weapons from ground via script? I am able to get the WeaponHolderSimulated object with this: 
 

player nearEntities 5;


But I don't know how to turn that to real weapon (name).

thx!

Share this post


Link to post
Share on other sites

If you have a weapon in a weaponHolderSimulated, you can pick it up.

Usually to spawn a weapon, you create this "weaponHolderSimulated", then addWeaponCargoGlobal some weapon inside (after the addMagazineCargoGlobal). You need to choose the class in config viewer cfgWeapons

  • Thanks 1

Share this post


Link to post
Share on other sites
12 minutes ago, pierremgi said:

If you have a weapon in a weaponHolderSimulated, you can pick it up.

Usually to spawn a weapon, you create this "weaponHolderSimulated", then addWeaponCargoGlobal some weapon inside (after the addMagazineCargoGlobal). You need to choose the class in config viewer cfgWeapons

 

So the solution was to call getWeaponCargo on the weaponHolderSimulated.

 

thanks :)

 

  • Like 1

Share this post


Link to post
Share on other sites
29 minutes ago, gc8 said:

 

So the solution was to call getWeaponCargo on the weaponHolderSimulated.

 

thanks :)

 

Ah OK, you just needed the class name of the weapon, not pick the weapon up while in game. Sorry for this misunderstanding. My French language plays tricks on me sometimes..

  • Like 1

Share this post


Link to post
Share on other sites

When I put weapon on ground that has magazine loaded in and try to get the mags with getMagazineCargo it returns empty arrays. Does anyone know if its possible to get the mag loaded?

I also tried with these commands: getAmmoCargo _obj, magazineCargo _obj, magazinesAmmoCargo _obj

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×