Jump to content
Sign in to follow this  
SNIPER_SKULL

How do i put ammo in a cpp

Recommended Posts

i made a crate for my clan but i want to a G36 in it how do i

the cpp i got

class CfgPatches

{

class Crate

{

units[] = {Crate};

weapons[] = {};

requiredVersion = 1.0;

};

};

class CfgVehicles

{

class All {};

class Static: All {};

class Building: Static {};

class NonStrategic: Building {};

class TargetTraining: NonStrategic {};

class TargetGrenade: TargetTraining {};

class Crate: TargetGrenade

{

model="\crate\crate";

armor=20000;

scope=2;

displayName="MiniMeNation";

}

}

Share this post


Link to post
Share on other sites

Easy.

Insert the following code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class Crate: TargetGrenade

{

model="\crate\crate";

armor=20000;

scope=2;

displayName="MiniMeNation";

class EventHandlers

{

init = [_this] exec {\myaddon\populatecrate.sqs};

};

}

Now you have added an initialisation event handler, which will populate your crate with weapons and ammo. Note the use of _this in the event handler declaration - NOT "this" as you would in the editor.

in populatecrate.sqs, it's same script syntax that you'd use in ofp editor, e.g :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_crate = _this select 0

_crate addweaponcargo "G36a"

_crate addmagazinecargo <whatever..>

... etc etc etc

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
Sign in to follow this  

×