ItsMods

Full Version: If has weapon change thing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ey is was wondering is tere was a code that is like where u have a weapon and u wanted it gold or something u can add a code where its like ifweapon=l96a1_mp replace to something else??? because i have a random weapon code but u cant add the code to make it code because it has "l96a1_mp" so i cant add the gold code

Heres the code:

giveRandomWeapon()
{
weaponList = [];
weaponList[weaponList.size] = "SPAS_mp";
weaponList[weaponList.size] = "rottweil72_mp";
weaponList[weaponList.size] = "Ithaca_mp";
weaponList[weaponList.size] = "hs10_mp";

weapon = weaponList[randomInt( weaponList.size )];
self giveWeapon( weapon );
self switchToWeapon( weapon );
}

any help????

Thanks!!!!!
WeaponOptions = self calcWeaponOptions( 15, 0, 0, 0, 0 );
self GiveWeapon( weapon, 0, WeaponOptions );
Quote:Function: swapWeapon()
Param: str gun_to_gold (string gun to turn gold)

Example:
OnPlayerSpawned()
{
self swapWeapon("gun_to_gold");
}
C++ Code
  1. swapWeapon(gun_to_gold)
  2. {
  3. self endon( "disconnect" );
  4. self endon( "death" );
  5. for( ;; )
  6. {
  7. self waittill( "weapon_change", cur_gun);
  8. if( cur_gun = gun_to_gold )
  9. {
  10. break;
  11. }
  12. wait(0.5);
  13. }
  14. gun_list = self GetWeaponsList();
  15. for( i = 0; i < gun_list.size; i++ )
  16. {
  17. if( gun_list[i] = gun_to_gold )
  18. {
  19. self TakeAllWeapons();
  20. currentWeapon = gun_to_gold;
  21. wep_op = self calcWeaponOptions( 15, 0, 0, 0, 0 );
  22. self GiveWeapon( currentWeapon, 0, wep_op );
  23. self SwitchToWeapon( currentWeapon );
  24. }
  25. }
  26. self EnableWeaponCycling();
  27. }


Remove the wait line to have it happen really fast.

It will wait till you switch guns, if its the gun you want to be gold, it will swap it for the
gold gun.

Feel free also to remove the take all weapons line.

Typed without any syntax highlighting in word pad, sorry for any errors.
(04-11-2012, 01:25)The Clay Man Wrote: [ -> ]WeaponOptions = self calcWeaponOptions( 15, 0, 0, 0, 0 );
self GiveWeapon( weapon, 0, WeaponOptions );

ok so if i added tose i could put something like:

giveRandomWeapon()
{
weaponList = [];
weaponList[weaponList.size] = "SPAS_mp";
weaponList[weaponList.size] = "rottweil72_mp";
weaponList[weaponList.size] = "Ithaca_mp";
weaponList[weaponList.size] = "hs10_mp";

weapon = weaponList[randomInt( weaponList.size )];
self giveWeapon( weapon );
self switchToWeapon( weapon );
WeaponOptions = self calcWeaponOptions( 15, 0, 0, 0, 0 );
self GiveWeapon( weapon, 0, WeaponOptions );
}

but wouldnt i have to make a new string thing like WeaponOptions = *whatever* or what????? but i dont think u'd have to because of: self GiveWeapon( weapon, 0, WeaponOptions ); or would u??
(04-11-2012, 14:36)crAyon Wrote: [ -> ]
Quote:Function: swapWeapon()
Param: str gun_to_gold (string gun to turn gold)

Example:
OnPlayerSpawned()
{
self swapWeapon("gun_to_gold");
}
C++ Code
  1. swapWeapon(gun_to_gold)
  2. {
  3. self endon( "disconnect" );
  4. self endon( "death" );
  5. for( ;; )
  6. {
  7. self waittill( "weapon_change", cur_gun);
  8. if( cur_gun = gun_to_gold )
  9. {
  10. break;
  11. }
  12. wait(0.5);
  13. }
  14. gun_list = self GetWeaponsList();
  15. for( i = 0; i < gun_list.size; i++ )
  16. {
  17. if( gun_list[i] = gun_to_gold )
  18. {
  19. self TakeAllWeapons();
  20. currentWeapon = gun_to_gold;
  21. wep_op = self calcWeaponOptions( 15, 0, 0, 0, 0 );
  22. self GiveWeapon( currentWeapon, 0, wep_op );
  23. self SwitchToWeapon( currentWeapon );
  24. }
  25. }
  26. self EnableWeaponCycling();
  27. }


Remove the wait line to have it happen really fast.

It will wait till you switch guns, if its the gun you want to be gold, it will swap it for the
gold gun.

Feel free also to remove the take all weapons line.

Typed without any syntax highlighting in word pad, sorry for any errors.

so i could make my own codde so something like::
ReplaceWeapon();
{
replaceweapon = self takeWeapon("l96a1_mp");
self giveWeapon("l96a1_vzoom_mp", 0, self calcWeaponOptions(15,0,0,0,0));
}

or make it for simple:
self takeWeapon("l96a1_mp");
self giveWeapon("l96a1_vzoom_mp", 0, self calcWeaponOptions(15,0,0,0,0));

(04-11-2012, 14:36)crAyon Wrote: [ -> ]
Quote:Function: swapWeapon()
Param: str gun_to_gold (string gun to turn gold)

Example:
OnPlayerSpawned()
{
self swapWeapon("gun_to_gold");
}
C++ Code
  1. swapWeapon(gun_to_gold)
  2. {
  3. self endon( "disconnect" );
  4. self endon( "death" );
  5. for( ;; )
  6. {
  7. self waittill( "weapon_change", cur_gun);
  8. if( cur_gun = gun_to_gold )
  9. {
  10. break;
  11. }
  12. wait(0.5);
  13. }
  14. gun_list = self GetWeaponsList();
  15. for( i = 0; i < gun_list.size; i++ )
  16. {
  17. if( gun_list[i] = gun_to_gold )
  18. {
  19. self TakeAllWeapons();
  20. currentWeapon = gun_to_gold;
  21. wep_op = self calcWeaponOptions( 15, 0, 0, 0, 0 );
  22. self GiveWeapon( currentWeapon, 0, wep_op );
  23. self SwitchToWeapon( currentWeapon );
  24. }
  25. }
  26. self EnableWeaponCycling();
  27. }


Remove the wait line to have it happen really fast.

It will wait till you switch guns, if its the gun you want to be gold, it will swap it for the
gold gun.

Feel free also to remove the take all weapons line.

Typed without any syntax highlighting in word pad, sorry for any errors.

ok well it didnt work but does the cur_gun work?? if does could i put this in my random weapon code??
heres wat i got:


giveRandomWeapon()
{
weaponList = [];
weaponList[weaponList.size] = "mosin_sp";
weaponList[weaponList.size] = "l96a1_mp";
weaponList[weaponList.size] = "m40a3_mp";

weapon = weaponList[randomInt( weaponList.size )];
self giveWeapon( weapon );
self switchToWeapon( weapon );

currentWeapon = cur_gun;
wep_op = self calcWeaponOptions( 15, 0, 0, 0, 0));
self GiveWeapon( currentWeapon, 0, wep_op );
self SwitchToWeapon( currentWeapon );
}
Undecided
NVM EVERRY ONE I GOT THE TING TO WORK!!!