• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Y U NO WORK
#1
C++ Code
  1. scrambleClass()
  2. {
  3. WeaponPrimary = [];
  4. WeaponPrimary[WeaponPrimary.size] = "m4";
  5. PickWeapon = WeaponPrimary[randomInt(WeaponPrimary.size)];
  6. WeaponToGive = "";
  7. if(PickWeapon == "m4_mp")
  8. {
  9. M4Attach = [];
  10. M4Attach[M4Attach.size] = "";
  11. M4Attach[M4Attach.size] = "_acog";
  12. M4Attach[M4Attach.size] = "_reflex";
  13. M4Attach[M4Attach.size] = "_thermal";
  14. M4Attach[M4Attach.size] = "_eotech";
  15. WeaponToGive = "m4" + M4Attach[randomInt(M4Attach.size)] + "_mp";
  16. }
  17.  
  18. self takeAllWeapons();
  19. self clearPerks();
  20. wait 0.05;
  21. self giveWeapon(WeaponToGive, 0, false);
  22. wait 0.05;
  23. self switchToWeapon(WeaponToGive, 0, false);
  24. }
  Reply
#2
which error?

try to print result, maybe you will see error...
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
  Reply
#3
Hurrhurr

(06-19-2012, 00:25)broshaan Wrote: WeaponPrimary[WeaponPrimary.size] = "m4";
PickWeapon = WeaponPrimary[randomInt(WeaponPrimary.size)];
if(PickWeapon == "m4_mp")

Also you can just do:
Code:
PickWeapon = random(WeaponPrimary);

random(M4Attach)

Afaik.
  Reply
#4
(06-19-2012, 00:48)Nukem Wrote: Hurrhurr

(06-19-2012, 00:25)broshaan Wrote: WeaponPrimary[WeaponPrimary.size] = "m4";
PickWeapon = WeaponPrimary[randomInt(WeaponPrimary.size)];
if(PickWeapon == "m4_mp")

Also you can just do:
Code:
PickWeapon = random(WeaponPrimary);

random(M4Attach)

Afaik.

I fixed the problem I had, pick weapon should have said m4 not m4_mp.
But thanks for your random(), it looks way less messy
  Reply
#5
(06-19-2012, 01:33)broshaan Wrote:
(06-19-2012, 00:48)Nukem Wrote: Hurrhurr

(06-19-2012, 00:25)broshaan Wrote: WeaponPrimary[WeaponPrimary.size] = "m4";
PickWeapon = WeaponPrimary[randomInt(WeaponPrimary.size)];
if(PickWeapon == "m4_mp")

Also you can just do:
Code:
PickWeapon = random(WeaponPrimary);

random(M4Attach)

Afaik.

I fixed the problem I had, pick weapon should have said m4 not m4_mp.
But thanks for your random(), it looks way less messy

C++ Code
  1. WeaponToGive = "m4" + random(M4Attack) + random(M4Barrel) + "_mp";
  2. if("thermal" in WeaponToGive)
  3. {
  4. if("shotgun" in WeaponToGive){WeaponToGive = "m4_shotgun_thermal_mp";}
  5. if("gl" in WeaponToGive){WeaponToGive = "m4_gl_thermal_mp";}
  6. if("silencer" in WeaponToGive){WeaponToGive = "m4_silencer_thermal_mp";}
  7. if("heartbeat" in WeaponToGive){WeaponToGive = "m4_heartbeat_thermal_mp";}
  8. if("fmj" in WeaponToGive){WeaponToGive = "m4_fmj_thermal_mp";}
  9. if("xmags" in WeaponToGive){WeaponToGive = "m4_xmags_thermal_mp";}
}

HALP ME!

I dunno how to look for substrings
  Reply
#6
use [code] tags and please be more specific next time when you create a thread title
  Reply
#7
(06-19-2012, 02:43)broshaan Wrote:
(06-19-2012, 01:33)broshaan Wrote:
(06-19-2012, 00:48)Nukem Wrote: Hurrhurr

(06-19-2012, 00:25)broshaan Wrote: WeaponPrimary[WeaponPrimary.size] = "m4";
PickWeapon = WeaponPrimary[randomInt(WeaponPrimary.size)];
if(PickWeapon == "m4_mp")

Also you can just do:
Code:
PickWeapon = random(WeaponPrimary);

random(M4Attach)

Afaik.

I fixed the problem I had, pick weapon should have said m4 not m4_mp.
But thanks for your random(), it looks way less messy

C++ Code
  1. WeaponToGive = "m4" + random(M4Attack) + random(M4Barrel) + "_mp";
  2. if("thermal" in WeaponToGive)
  3. {
  4. if("shotgun" in WeaponToGive){WeaponToGive = "m4_shotgun_thermal_mp";}
  5. if("gl" in WeaponToGive){WeaponToGive = "m4_gl_thermal_mp";}
  6. if("silencer" in WeaponToGive){WeaponToGive = "m4_silencer_thermal_mp";}
  7. if("heartbeat" in WeaponToGive){WeaponToGive = "m4_heartbeat_thermal_mp";}
  8. if("fmj" in WeaponToGive){WeaponToGive = "m4_fmj_thermal_mp";}
  9. if("xmags" in WeaponToGive){WeaponToGive = "m4_xmags_thermal_mp";}
}

HALP ME!

I dunno how to look for substrings

I already posted in the shoutbox but if you didn't see it, it's:
Code:
if(isSubStr(WeaponToGive, "thermal")) { /* Blah */ }
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Permissions DOESNT work Hallla 2 2,802 08-18-2013, 11:28
Last Post: hillbilly
  why permissions dont work. ? ExoGamer* 4 3,010 07-21-2013, 13:46
Last Post: X-Track
  Bunker Plugin Won't work OBJAY 4 4,068 06-03-2013, 15:48
Last Post: X-Track
  Help prefix doesnt work with shop koro35 2 2,628 05-18-2013, 10:51
Last Post: koro35
  Help Perks do not work (( x1412 6 3,971 04-06-2013, 18:09
Last Post: x1412
  liberation dont work? puistis 7 7,277 02-18-2013, 09:17
Last Post: JariZ
  Weapon dont work?? Erik The Born 3 2,604 02-05-2013, 19:53
Last Post: Yamato
  private match maps won't work with mods! leereef 1 2,306 01-13-2013, 12:01
Last Post: surtek
  Some images do not work with SetShader xplosiff 8 4,411 01-05-2013, 07:19
Last Post: mw2killer
  Help !giveammo Plugin doesnt work [solved] Hallla 3 3,229 12-29-2012, 20:53
Last Post: Hallla

Forum Jump:


Users browsing this thread: 1 Guest(s)