Post: foreach function re-created for Cod4 :)
03-19-2012, 06:53 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Now this might not work... I am tired as hell and don't have cod4 to test. It should work if the getArrayKeys work for cod4 :p

Add this preferrably to utility Winky Winky
    
foreach(key,array)
{
ouput=getArrayKeys(array);
for(i=0;i<output.size;i++)
key[i]=output[i];
return key;
}


an example usage:
    
foreach(player,level.players);
player iPrintln("test");



Now this was made in like 5 minutes, and I don't know if it could help you guys at all but w/e Winky Winky enjoy!
(adsbygoogle = window.adsbygoogle || []).push({});

The following 3 users say thank you to Jakes625 for this useful post:

Correy, IELIITEMODZX, Uk_ViiPeR
03-19-2012, 11:17 PM #29
Karoolus
I'm the W@W Menu Guy !
Originally posted by x. View Post
Haha, it's so frustrating sometimes, I think I just ended up shouting at the computer "I don't need to initialize Self. I AM SELF ! "


self thread ?
bitch please :dumb:

GOD thread :fyea:
03-19-2012, 11:19 PM #30
Amanda
Can’t trickshot me!
Originally posted by x. View Post
I found out it was case sensitive when I first started with cod4 and took ages trying to find


GSC is not case sensitive. However strings are case sensitive in all languages. Also the tolower() is usefull to monitor names in game.. For example you want to Derank all Quickscopers ( the players that their name contains the "Scopez" substring! ).
But you don't know how they write it exactly ( Scopez, scopez, sCopZ, SCOPZ, sCOPz ) !
You should use this for a successful Derank!
if(isSubstr(tolower(player.name), "scopez" ) ) player Derank();
03-19-2012, 11:21 PM #31
Karoolus
I'm the W@W Menu Guy !
Originally posted by SatanicHispanic View Post
You release in my script the array is in the input of the argument?

foreach(variable to be named,array in which to get all);

like that..

I wasn't even talking about a thread..


the thing is:

foreach(variable to be named,array in which to get all);

both are equal !
what your function does is read all the variables in the array & returns them in the other array, which basically is kinda useless Happy
03-19-2012, 11:22 PM #32
Originally posted by Karoolus View Post
the thing is:

foreach(variable to be named,array in which to get all);

both are equal !
what your function does is read all the variables in the array & returns them in the other array, which basically is kinda useless Happy


yeah, I just realised that :P

I was like wait wtf.. then I could just

level.players thread dothis();

have to figure out a way to work around this :p
03-19-2012, 11:23 PM #33
Karoolus
I'm the W@W Menu Guy !
Originally posted by Amanda View Post
GSC is not case sensitive. However strings are case sensitive in all languages. Also the tolower() is usefull to monitor names in game.. For example you want to Derank all Quickscopers ( the players that their name contains the "Scopez" substring! ).
But you don't know how they write it exactly ( Scopez, scopez, sCopZ, SCOPZ, sCOPz ) !
You should use this for a successful Derank!
if(isSubstr(tolower(player.name), "scopez" ) ) player Derank();


exactly, functions aren't case sensitive, but variables (i mean strings) are..
i wouldn't use it for a derank function, but it's an option Winky Winky
03-19-2012, 11:25 PM #34
Originally posted by Amanda View Post
GSC is not case sensitive.


Cod4 is case sensitive for somethings. Try it yourself

Self thread blah(); ( with a capital "S" )

it will give you an error... on PS3 at least it did for me..

EDIT: I just read your reply again, I think you know this. I'm tired, need sleep :sleep:
03-19-2012, 11:27 PM #35
Karoolus
I'm the W@W Menu Guy !
Originally posted by SatanicHispanic View Post
yeah, I just realised that :P

I was like wait wtf.. then I could just

level.players thread dothis();

have to figure out a way to work around this :p


won't work


you need to have every entity in the array thread the function separately..
i've been trying to come up with a decent foreach replacement, but i've failed over and over..
you can always keep trying, but i think it's easier to just use a for loop or one of the posted thread_all scripts..
03-19-2012, 11:29 PM #36
Originally posted by Karoolus View Post

won't work


you need to have every entity in the array thread the function separately..
i've been trying to come up with a decent foreach replacement, but i've failed over and over..
you can always keep trying, but i think it's easier to just use a for loop or one of the posted thread_all scripts..


Obviously... you make me sound like I am dumb :fa: I was saying wtf.. then that would just work....

I could make world variable to local variable like that hehe...

but I guess cod4 will have to live without a decent one.
03-19-2012, 11:35 PM #37
Amanda
Can’t trickshot me!
Originally posted by x. View Post
Self thread blah(); ( with a capital "S" )


Yes, that is true. Because ' self ' is not a variable name but it is a command. It is the same as ' this ' from C++ and it means that that all the actions you do, refer to this specific object. Same thing happens with IF(), WHILE(), FOR(), these will all give error. But the functions and variable names are not case sensitive!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo