Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. How to check if an array has that string or not?

How to check if an array has that string or not?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
5 Posts 2 Posters 207 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Ayresiaundefined Offline
    Ayresiaundefined Offline
    Ayresia
    wrote on last edited by Ayresia
    #1

    As the title says, "How to check if an array has that string or not."

    Let me show you a scenario:

    In the array i have, [0] - Hello and [1] - Purple.
    How can i check if i have the string "purple" in the array?

    NOTE: Is there any GSC Resources to learn from? I know GSC (a bit) although i really have hard time to learn it cause there is no good tutorials. I would like to create other COD Mods also.

    Thanks,
    Ayresia

    1 Reply Last reply
    0
    • Ioofundefined Offline
      Ioofundefined Offline
      Ioof Contributor
      wrote on last edited by Ioof
      #2
      level.example[0] = "Green";
      level.example[1] = "Purple";
      level.example[2] = "Yellow";
      level.example[3] = "Red";
      level.example[4] = "Blue";
      level.example[5] = "Orange";
      
      findPurple()
      {
      	for( i = 0; i < 5; i++ ) //<- Loops 5 times from 0 - 5
      	{
      		if ( level.example[i] == "Purple" )
      		{
      		
      			self iPrintln ( "Array : " + i + "has the string :" +  level.example[i]  );
      				break;
      		}
              }
      	
      }
      

      it should print you ingame:
      Array : 1 has the string : Purple

      Ayresiaundefined 1 Reply Last reply
      0
      • Ayresiaundefined Offline
        Ayresiaundefined Offline
        Ayresia
        replied to Ioof on last edited by
        #3

        Enki Thanks man! How did you learn GSC by any chance? I'm very interested to learn this language!

        1 Reply Last reply
        0
        • Ioofundefined Offline
          Ioofundefined Offline
          Ioof Contributor
          wrote on last edited by
          #4

          I learned it just by looking at raw files and changing little stuff in a gsc files and see what changed....
          sounds stupid i know 😌

          and i started with mw2 you have alot more you can do on on that game because you have access to all the raw files

          Ayresiaundefined 1 Reply Last reply
          0
          • Ayresiaundefined Offline
            Ayresiaundefined Offline
            Ayresia
            replied to Ioof on last edited by
            #5

            Enki Do you have discord or something, i would like to help/learn from you 😄 . If you don't wanna add it's all good.

            1 Reply Last reply
            0

            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Donate