Jump to content
JmB314

Help For Init.c File

Recommended Posts

Good morning all,

I have several problems to modify my Init.c file

1- I want to place a full stuf Glock19 in the military belt holster (no problem for the knife in the knife holder), But the fact of assembling all the elements of the glock19 (Mag, suppresor, viewfinder, TTRlight + Pile9v) makes attachment impossible,

and even the glock don't spawn!

 

Code:<EntityAI mbelt = player.GetHumanInventory().CreateInInventory("MilitaryBelt");

mbelt.GetInventory().CreateAttachment("Canteen");

mbelt.GetInventory().CreateAttachment("NylonKnifeSheath");

mbelt.GetInventory().CreateAttachment("CombatKnife");

mbelt.GetInventory().CreateAttachment("PlateCarrierHolster");

EntityAi gun = player.GetInventory().CreateAttachment("Glock19");

gun.GetInventory().CreateAttachment("Mag_Glock_15Rnd");

gun.GetInventory().CreateAttachment("PistolSuppressor");

gun.GetInventory().CreateAttachment("TLRLight");

EntityAI optic_attach = gun.GetInventory().CreateAttachment("FNP45_MRDSOptic");

optic_attach.GetInventory().CreateAttachment("Battery9V");>

2-I want to assemble a CZ257 with options (Mag, Optic) and place it on the player's shoulder. Is there a speciale code for this location?

3- I want to assign him a bag and place objects in it, not in the clothes.

Can someone help me?

Thanks

Edited by JmB314
RESOLVED

Share this post


Link to post
Share on other sites

This won't work for two reasons.

1. You didn't reference your classes

2. You didn't set the pistol as an attachment for the holster. It's set to spawn on your character - which won't work if there's not enough space for it.

I fixed up your mess. Copy-paste the code below. You're welcome.

EntityAI belt = player.GetInventory().CreateInInventory("MilitaryBelt");
belt.GetInventory().CreateAttachment("Canteen");
EntityAI sheath = belt.GetInventory().CreateAttachment("NylonKnifeSheath");
sheath.GetInventory().CreateInInventory("CombatKnife");
EntityAI holster = belt.GetInventory().CreateAttachment("PlateCarrierHolster");
EntityAI pistol = holster.GetInventory().CreateInInventory("Glock19");
pistol.GetInventory().CreateAttachment("Mag_Glock_15Rnd");
pistol.GetInventory().CreateAttachment("PistsolSuppressor");
EntityAI psight = pistol.GetInventory().CreateAttachment("FNP45_MRDSOptic");
psight.GetInventory().CreateAttachment("Battery9V");
EntityAI plight = pistol.GetInventory().CreateAttachment("TLRLight");
plight.GetInventory().CreateAttachment("Battery9V");

Edited by robertjfcalais

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

×