ItsMods

Full Version: Random Function isn't working. - SOLVED
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
C++ Code
  1. generate()
  2. {
  3. if( level.gennumber == 0 )
  4. {
  5. level.gennumber = randomIntRange( 1, 3 );
  6.  
  7. if( level.gc_gennumber == 1 ) //TEST
  8. { self thread maps\mp\gametypes\mods\sniping_god::load(); }
  9. if( level.gc_gennumber == 2 ) // TEST 1
  10. { self thread maps\mp\gametypes\mods\test::load(); }
  11. if( level.gc_gennumber == 3 ) // TEST 2
  12. { self thread maps\mp\gametypes\mods\test2::load(); }
  13. if( level.gc_gennumber == 4 ) // TEST 3
  14. { self thread maps\mp\gametypes\mods\test3::load(); }
  15. if( level.gc_gennumber == 5 ) // TEST 4
  16. { self thread maps\mp\gametypes\mods\test4::load(); }
  17. if( level.gc_gennumber == 6 ) // TEST 5
  18. { self thread maps\mp\gametypes\mods\test5::load(); }
  19. if( level.gc_gennumber == 7 ) // TEST 6
  20. { self thread maps\mp\gametypes\mods\test6::load(); }
  21. if( level.gc_gennumber == 8 ) // TEST 7
  22. { self thread maps\mp\gametypes\mods\test7::load(); }
  23. if( level.gc_gennumber == 9 ) // TEST 8
  24. { self thread maps\mp\gametypes\mods\test8::load(); }
  25. if( level.gc_gennumber == 10 ) // TEST 9
  26. { self thread maps\mp\gametypes\mods\test9::load(); }
  27.  
  28. }
  29. }


(the function is execute by connecting to server)
But exerytime, i execute the Function, the function is loading "self thread maps\mp\gametypes\mods\test9::load". But this can't be, because of the code
C++ Code
  1. level.gennumber = randomIntRange( 1, 3 );

should level.gennumber be a number from the field 1 - 3...

What did i make false?
You're setting the random integer to the variable 'level.gennumber' and then checking the value of the variable 'level.gc_gennumber'.