Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Weapon Drops/Keeping the Weapon
Re: Weapon Drops/Keeping the Weapon [message #361164 is a reply to message #361001] Wed, 03 December 2008 01:16 Go to previous messageGo to previous message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma:
Colonel
here, this is my backpack script:

.cpp

void cAMpa_Weapon_BackPack::Created(GameObject *obj)
{
	Commands->Start_Timer(obj,this,6.0f,2);
	GameObject *player = Get_GameObj(Get_Int_Parameter("ID"));

	if (Has_Weapon(player,"Weapon_AutoRifle_Player"))
		this->miniGunGdi = true;
	else
		this->miniGunGdi = false;
	if (Has_Weapon(player,"Weapon_AutoRifle_Player_Nod"))
		this->miniGunNod = true;
	else
		this->miniGunNod = false;
	if (Has_Weapon(player,"Weapon_Chaingun_Player"))
		this->chainGunGdi = true;
	else
		this->chainGunGdi = false;
	if (Has_Weapon(player,"Weapon_Chaingun_Player_Nod"))
		this->chainGunNod = true;
	else
		this->chainGunNod = false;
	if (Has_Weapon(player,"Weapon_ChemSprayer_Player"))
		this->chemSprayer = true;
	else
		this->chemSprayer = false;
	if (Has_Weapon(player,"CNC_Weapon_Flamethrower_Player"))
		this->flameThrower = true;
	else
		this->flameThrower = false;
	if (Has_Weapon(player,"Weapon_GrenadeLauncher_Player"))
		this->grenadeLauncher = true;
	else
		this->grenadeLauncher = false;
	if (Has_Weapon(player,"Weapon_LaserChaingun_Player"))
		this->laserChainGun = true;
	else
		this->laserChainGun = false;
	if (Has_Weapon(player,"Weapon_LaserRifle_Player"))
		this->laserRifle = true;
	else
		this->laserRifle = false;
	if (Has_Weapon(player,"Weapon_MineProximity_Player"))
		this->mineProxy = true;
	else
		this->mineProxy = false;
	if (Has_Weapon(player,"Weapon_PersonalIonCannon_Player"))
		this->persIonCannon = true;
	else
		this->persIonCannon = false;
	if (Has_Weapon(player,"Weapon_Railgun_Player"))
		this->railGun = true;
	else
		this->railGun = false;
	if (Has_Weapon(player,"Weapon_RamjetRifle_Player") || Has_Weapon(player,"CnC_Weapon_RamjetRifle_Player"))
		this->ramjet = true;
	else
		this->ramjet = false;
	if (Has_Weapon(player,"Weapon_RepairGun_Player") || Has_Weapon(player,"CnC_Weapon_RepairGun_Player_Special"))
		this->repairGun = true;
	else
		this->repairGun = false;
	if (Has_Weapon(player,"Weapon_RocketLauncher_Player"))
		this->rocketLauncher = true;
	else
		this->rocketLauncher = false;
	if (Has_Weapon(player,"CnC_Weapon_RocketLauncher_Player"))
		this->rocketGunner = true;
	else
		this->rocketGunner = false;
	if (Has_Weapon(player,"Weapon_Shotgun_Player"))
		this->shotGun = true;
	else
		this->shotGun = false;
	if (Has_Weapon(player,"Weapon_SniperRifle_Player"))
		this->sniperRifle = true;
	else
		this->sniperRifle = false;
	if (Has_Weapon(player,"Weapon_TiberiumAutoRifle_Player"))
		this->tibAutoRifle = true;
	else
		this->tibAutoRifle = false;
	if (Has_Weapon(player,"Weapon_TiberiumFlechetteGun_Player"))
		this->flechetteGun = true;
	else
		this->flechetteGun = false;
	if (Has_Weapon(player,"Weapon_VoltAutoRifle_Player"))
		this->voltAutoRifleGdi = true;
	else
		this->voltAutoRifleGdi = false;
	if (Has_Weapon(player,"Weapon_VoltAutoRifle_Player_Nod"))
		this->voltAutoRifleNod = true;
	else
		this->voltAutoRifleNod = false;
}

void cAMpa_Weapon_BackPack::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
	if (message == 1000000025) 
	{
		int rnd = Commands->Get_Random_Int(1,100);
		if (rnd <= 5)
		{
			Commands->Apply_Damage(sender,99999,"Explosion_Mine_Remote_01",0);
			page(sender,"[RC] You picked up a bomb-backpack, haha its blowed.", false);
		}
		else
		{
			Create_2D_WAV_Sound_Player(sender,"m00psbk_aqob0004i1evag_snd.wav");
			if (this->miniGunGdi)       Commands->Give_Powerup(sender,"POW_AutoRifle_Player",false);
			if (this->miniGunNod)       Commands->Give_Powerup(sender,"POW_AutoRifle_Player_Nod",false);
			if (this->chainGunGdi)      Commands->Give_Powerup(sender,"POW_Chaingun_Player",false);
			if (this->chainGunNod)      Commands->Give_Powerup(sender,"POW_Chaingun_Player_Nod",false);
			if (this->chemSprayer)      Commands->Give_Powerup(sender,"POW_ChemSprayer_Player",false);
			if (this->flameThrower)     Commands->Give_Powerup(sender,"POW_Flamethrower_Player",false);
			if (this->grenadeLauncher)  Commands->Give_Powerup(sender,"POW_GrenadeLauncher_Player",false);
			if (this->laserChainGun)    Commands->Give_Powerup(sender,"POW_LaserChaingun_Player",false);
			if (this->laserRifle)       Commands->Give_Powerup(sender,"POW_LaserRifle_Player",false);
			if (this->mineProxy)        Commands->Give_Powerup(sender,"POW_MineProximity_Player",false);
			if (this->persIonCannon)    Commands->Give_Powerup(sender,"POW_PersonalIonCannon_Player",false);
			if (this->railGun)          Commands->Give_Powerup(sender,"POW_Railgun_Player",false);
			if (this->ramjet)           Commands->Give_Powerup(sender,"POW_RamjetRifle_Player",false);
			if (this->repairGun)        Commands->Give_Powerup(sender,"POW_RepairGun_Player",false);
			if (this->rocketLauncher)   Commands->Give_Powerup(sender,"POW_RocketLauncher_Player",false);
			if (this->rocketGunner)     Commands->Give_Powerup(sender,"CnC_POW_RocketLauncher_Player",false);
			if (this->shotGun)          Commands->Give_Powerup(sender,"POW_Shotgun_Player",false);
			if (this->sniperRifle)      Commands->Give_Powerup(sender,"POW_SniperRifle_Player",false);
			if (this->tibAutoRifle)     Commands->Give_Powerup(sender,"POW_TiberiumAutoRifle_Player",false);
			if (this->flechetteGun)     Commands->Give_Powerup(sender,"POW_TiberiumFlechetteGun_Player",false);
			if (this->voltAutoRifleGdi) Commands->Give_Powerup(sender,"POW_VoltAutoRifle_Player",false);
			if (this->voltAutoRifleNod) Commands->Give_Powerup(sender,"CnC_POW_VoltAutoRifle_Player_Nod",false);
		}
	}
}

void cAMpa_Weapon_BackPack::Timer_Expired(GameObject *obj, int number)
{
	if (number == 1) 
	{
		Commands->Expire_Powerup(obj);
		Commands->Destroy_Object(obj);
	}
	else if (number == 2)
	{
		Commands->Start_Timer(obj,this,2.0f,1);
		Commands->Create_Object("Spawner Created Special Effect",Commands->Get_Position(obj));
	}
}

ScriptRegistrant<cAMpa_Weapon_BackPack>cAMpa_Weapon_BackPack_Registrant("cAMpa_Weapon_BackPack","ID:int");


.h

class cAMpa_Weapon_BackPack : public ScriptImpClass 
{
private:
	bool miniGunGdi;
	bool miniGunNod;
	bool chainGunGdi;
	bool chainGunNod;
	bool chemSprayer;
	bool flameThrower;
	bool grenadeLauncher;
	bool laserChainGun;
	bool laserRifle;
	bool mineProxy;
	bool persIonCannon;
	bool railGun;
	bool ramjet;
	bool repairGun;
	bool rocketLauncher;
	bool rocketGunner;
	bool shotGun;
	bool sniperRifle;
	bool tibAutoRifle;
	bool flechetteGun;
	bool voltAutoRifleGdi;
	bool voltAutoRifleNod;
public:
	void Created(GameObject *obj);
	void Custom(GameObject *obj, int message, int param, GameObject *sender);
	void Timer_Expired(GameObject *obj, int number);
};


Bückstabü!
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to animate a flag?
Next Topic: Help installing LUA 5?
Goto Forum:
  


Current Time: Sun Dec 22 05:13:01 MST 2024

Total time taken to generate the page: 0.01106 seconds