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, 08:31 AM #2
DlBSY993
There's 0nly 1..
Originally posted by SatanicHispanic View Post
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!


I think this may already posted by Vader.....

The following user thanked DlBSY993 for this useful post:

Taylor
03-19-2012, 08:46 AM #3
IVI40A3Fusionz
Former Gaming Squad Member
Isn't this like the 3rd or 4th thread about re-created foreach functions for COD4?
03-19-2012, 11:14 AM #4
Choco
Respect my authoritah!!
Originally posted by IVI40A3Fusionz View Post
Isn't this like the 3rd or 4th thread about re-created foreach functions for COD4?


Yea but this one is fairly nicer than the others.
03-19-2012, 12:30 PM #5
Originally posted by DlBSY993 View Post
I think this may already posted by Vader.....


I am just trying to help you cod4 guys :fa:
03-19-2012, 01:09 PM #6
DlBSY993
There's 0nly 1..
Originally posted by SatanicHispanic View Post
I am just trying to help you cod4 guys :fa:


i know... Just saying, i suppose people have posted like 100 dvar editors for cod4 why not post a few off these.
03-19-2012, 01:16 PM #7
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by DlBSY993 View Post
i know... Just saying, i suppose people have posted like 100 dvar editors for cod4 why not post a few off these.


Editors are the only things getting out of hand :/ i mean they don't even make a patch look any better Happy.
03-19-2012, 03:11 PM #8
i think this was posted befor, i may be rong Winky Winky still love you tho :wub:
03-19-2012, 04:34 PM #9
d7w7z
Bounty hunter
Originally posted by SatanicHispanic View Post
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!


This won't work. The function returns an array and you're using the function wrong.

    
[B]blah = [];
player = [/B]foreach(blah, level.players); // If you use [B]return X;[/B] then you have to store the return in a variable.

//Now [I]player[/I] is just the exact same as level.players(both arrays).


The best way to get something close to a foreach function is to just use a for statment.

    
for(i=0; i <= level.players.size; i++)
{
level.players[i] println("something");
level.players[i] thread doSomething();
level.players[i].VIP = false;
}

or

i=0;
while(i <= level.players.size)
{
level.players[i] thread doSomething();
i++;
}

The following 4 users say thank you to d7w7z for this useful post:

247Yamato, aerosoul94, Taylor, x_DaftVader_x
03-19-2012, 04:46 PM #10
Default Avatar
Newelly
Guest
Alot less coding and an easier way to go about stuff :y:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo