Results 1 to 7 of 7

Thread: Meaning 2

  1. #1
    Private Mariusz's Avatar
    Join Date
    Sep 2017
    Posts
    67
    Thanks
    8
    Thanked 43 Times in 43 Posts

    Meaning 2

    What does this i < 15 mean?

    randombox(weap)
    {
    weap hide();
    o = weap.origin;
    cost = 800;

    // init set of weapons in this randombox
    self.weapons = [];
    self.weaponsModel = [];

    for(i = 0; i < 15; i++) {
    for(i = 0; i < 10; i++) {
    for(i = 0; i < 3; i++) {
    for(i = 0; i < 2; i++) {
    for(i = 0; i < 1; i++) {

  2. The Following User Says Thank You to Mariusz For This Useful Post:

    kubislav23 (12th March 2018)

  3. #2
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    sudo apt-get rekt

  4. #3
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Code:
    i < 15
    second argument operator "for" (after first ";") - it condition. Untill condition true (i<15): cycle work
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  5. #4
    Private Mariusz's Avatar
    Join Date
    Sep 2017
    Posts
    67
    Thanks
    8
    Thanked 43 Times in 43 Posts
    i<15 - 10 items
    i<10 - 4 items
    i<3 - 8 items
    i<2 - 5 items
    i<1 - 4 items

    What does it mean technically?

  6. The Following User Says Thank You to Mariusz For This Useful Post:

    kubislav23 (12th March 2018)

  7. #5
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    Quote Originally Posted by Mariusz View Post
    for(i = 0; i < 15; i++) {
    for(i = 0; i < 10; i++) {
    for(i = 0; i < 3; i++) {
    for(i = 0; i < 2; i++) {
    for(i = 0; i < 1; i++) {
    like this part

  8. #6
    Private Mariusz's Avatar
    Join Date
    Sep 2017
    Posts
    67
    Thanks
    8
    Thanked 43 Times in 43 Posts
    I think my script have an error in it originally. It's about weapon like I said before.
    The first case is that I don't receive a proper weapon model from the randombox. I have a suspicion to ak74, cause this weapon appears most often.
    And the second case; I don't receive a weapon at all but the text something like "Now you have (this) weapon". My hands are empty of this chosed model of weapon.

  9. The Following User Says Thank You to Mariusz For This Useful Post:

    kubislav23 (13th March 2018)

  10. #7
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    probability = true / total || ak47 / 100 weapons (on server) = 1 / 100 = 0,01 = 1% chance for ak47
    example random box for 10 weapons:
    PHP Code:

    rand_int 
    randomint(1000);

    if (
    rand_int <= 100//10%
       
    giveWeapon(/* your weapon */);
    else
    if (
    rand_int <= 200//10%
       
    giveWeapon(/* your weapon */); 
    else
    if (
    rand_int <= 300//10%
       
    giveWeapon(/* your weapon */);
    else 
    if (
    rand_int <= 700//40%
       
    giveWeapon(/* your weapon */); 

    /* etc. */ 
    P.S: cod2 have pseudorandom algorithm
    Last edited by maxdamage99; 13th March 2018 at 14:49.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •