How to check if an array has that string or not?
-
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 -
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 -
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 : PurpleEnki Thanks man! How did you learn GSC by any chance? I'm very interested to learn this language!
-
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
-
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
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login