ExclamationWhat is a loop?

Posts 1–11 of 11 · Page 1 of 1
What is a loop?
Today i will be showing u all how to use a loop and what it is..

What is a loop?

A loop is a way of doing multiple tasks with out coding statements again and again
for example : NoReload..u would have to write it over and over 576 times to make it work for all weapons
but that would take too long so u loop


The For Loop

The for loop :
Code:
for(int i=0; i<576; i++)
U declare a value with any value u want. And if that value is no equal to 576 or a given value, it will increase to that number by 1+ to 576

Code:
if(Weapon)
{
 for(int i=0; i<576; i++)
 {
  DWORD wep = *(DWORD*)(Weapon+(i*4));
  if(wep)
  {
   *(float*)(wep + 0x269C) = 50;
   }
  }
}
we will be using noreload as example

Let's say we take our loop out..it wouldn't work because we didn't add any weapons for the noreload to work..so let's take our loop back
Code:
for(int i=0; i<576;
So if i is not equal to 576 then it will increase by 1+ to 576. But that wouldn't work because it is a float, so u add i*4 . That will keep repeating and the noreload code over and over again 576 times which is the number of guns


More Examples of the For Loop

i created a program with a loop
Code:
#include <iostream>
using namespace std;

int main()
{
	for(int i=0; i<576; i++)
	{
		cout << i << endl;
		system("PAUSE");
	}
	return 0;
}

if the variable i is not equal to 576 it will increase. Now debug and open this program and press enter.. each time u press enter u adds by 1+ 576 times and then closes
why does it do that? coz the u did i++ and which means add by 1..let's say u did i*4..that would add by 4 , 576 times and stop

I hope u guys understand this tut it now PM me and i'll help u
hmm, I would like to ask about the second loop in some functions like no recoil, no knockback and fast knife. What does the second loop do? Just curious
Quote Originally Posted by Ryuzaki2 View Post
hmm, I would like to ask about the second loop in some functions like no recoil, no knockback and fast knife. What does the second loop do? Just curious
576 = Weapon Loop , Number of loops
9 of 10 = Yaw Patch Texture loop
Quote Originally Posted by Ryuzaki2 View Post
hmm, I would like to ask about the second loop in some functions like no recoil, no knockback and fast knife. What does the second loop do? Just curious
Code:
for(int y=0; y<10; y++)
this is the same thing as the other loop...let's say u have 7 norecoil offsets and used this loop. u would really have 70 offsets why because 7*10 = 70. each norecoil offsets get repeated 10 times. But because u did y*4, it would add by 4, 10 times.

hope i helped
i think it should be in c++ section
Quote Originally Posted by giniyat101 View Post
i think it should be in c++ section
it should but it is better in this section
For example loop 576 it's 576 becuz i guess z8 has number of weps/ 576
Quote Originally Posted by AeroNex View Post
For example loop 576 it's 576 becuz i guess z8 has number of weps/ 576
yes z8 has 576 guns and if u didn't use a loop, u would have to repeat the code 576 times. but instead of doing that u loop
Quote Originally Posted by DaRk View Post
yes z8 has 576 guns and if u didn't use a loop, u would have to repeat the code 576 times. but instead of doing that u loop
exactly
Deserve Sticked.
Quote Originally Posted by AeroNex View Post


exactly
Deserve Sticked.
thxs for saying man
Quote Originally Posted by DaRk View Post
thxs for saying man
no problem sir. all
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us