Step 1
first open up your defs.qc and at the bottom add:
.float ammo_money; //defines ammo_money
then make a new .qc file and call it buyrocket.qc
in that add:
void() BuyRocket = //declaring the void function
{
if (self.ammo_money >= 90) //declaring how much ammo_money you need to have
{
self.ammo_money = self.ammo_money - 90; /declaring how much ammo_money it costs
self.items = self.items | //gives you a new item
IT_ROCKET_LAUNCHER; //which is the rocket launcher
sprint (self, "You bought the rocket launcher\n"); //states on your screen that you bought the rl
self.ammo_rockets = self.ammo_rockets+ 5; // how much ammo comes with it
}
};
save that as buyrocket.qc
open up your progs.src and add:
weapons.qc
buyrocket.qc //add this
now open up your weapons.qc and add:
void() BuyRocket;
under
void() SuperDamageSound;
then at the impulse command part add:
if (self.impulse == 20)
BuyRocket ();
save that.
now open your item.qc and scroll down to weapon_touch and then goto
if (self.classname == "weapon_nailgun") and replace all of the nailgun stuff with this:
if (self.classname == "weapon_nailgun")
{
other.ammo_money = other.ammo_money + 30; //now when you get to the
}
then if you you downloaded the money.mdl (link to http://www.planetquake.com/census/militia/money.zip) and would like to use that to replace you nailgun spinning
model scroll down until you get to void() weapon_nailgun = and replace all of it with this:
void() weapon_nailgun =
{
precache_model ("progs/money.mdl");
setmodel (self, "progs/money.mdl");
self.weapon = IT_NAILGUN;
self.netname = "nailgun";
self.touch = weapon_touch;
setsize (self, '-16 -16 0', '16 16 56');
StartItem ();
};
then save it and close it.
to be able to see how much money have go to step 2 or skip that and compile it.
|