Post: [All Cod] How To Create A Function/Option That Toggles! [Noob Friendly]
01-12-2014, 02:51 PM #1
ItsMagiicsz
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys, this is a really quick release.
I am only sharing this with you guys because i cannot explain the amount of times i am asked about this.
I will just be telling you how to toggle an option and how it works Smile.
So lets get started.

Base Of Toggle Function By Me:
    
bool OptionTog;
private void Option(int client)
{
if (OptionTog == false)
{
//Put offsetsandshithere!
OptionTog = true;
}
else
{
//Put offsetsandshithere!
OptionTog = false;
}
}
I have put it like this because i know some of you newbs cannot be bothered to learn what the bool means and where you use it.


Explaining what the function does:
    
bool: this helps you to toggle the shit, remember the option name must be different from the bool name, if they are the same you may get errors as it wont know what one to read.
int client: your just stating the client, you would keep this if your menu was all client, if not it would be ' private void Option() '


How to call the function:
    
To call it is easy!
For an all client menu:
Option(client);

For a host only menu:
Option();

You must put this where the option you would select the option.


An example:
    
bool ChromePlayersTog;
private void ChromePlayers(int client)
{
if (ChromePlayersTog == false)
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x60, 0x00, 0x00, 0x00 });
ChromePlayersTog = true;
}
else
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x2C, 0x03, 0x00, 0x00 });
ChromePlayersTog = false;
}
}


Credits:
    
Me - Making da tutorial.
Taylor - Showing me how to make a bool function when i was a little newb.
eddie mac - The Chrome Players Offset.


Enjoy Awesome face
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to ItsMagiicsz for this useful post:

Azus, iNDMx, Mango_Knife, John, Notorious, xSlinkeyy
01-13-2014, 05:30 PM #11
ByteSource
League Champion
Originally posted by ItsMagiicsz View Post
Hey guys, this is a really quick release.
I am only sharing this with you guys because i cannot explain the amount of times i am asked about this.
I will just be telling you how to toggle an option and how it works Smile.
So lets get started.

Base Of Toggle Function By Me:
    
bool OptionTog;
private void Option(int client)
{
if (OptionTog == false)
{
//Put offsetsandshithere!
OptionTog = true;
}
else
{
//Put offsetsandshithere!
OptionTog = false;
}
}
I have put it like this because i know some of you newbs cannot be bothered to learn what the bool means and where you use it.


Explaining what the function does:
    
bool: this helps you to toggle the shit, remember the option name must be different from the bool name, if they are the same you may get errors as it wont know what one to read.
int client: your just stating the client, you would keep this if your menu was all client, if not it would be ' private void Option() '


How to call the function:
    
To call it is easy!
For an all client menu:
Option(client);

For a host only menu:
Option();

You must put this where the option you would select the option.


An example:
    
bool ChromePlayersTog;
private void ChromePlayers(int client)
{
if (ChromePlayersTog == false)
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x60, 0x00, 0x00, 0x00 });
ChromePlayersTog = true;
}
else
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x2C, 0x03, 0x00, 0x00 });
ChromePlayersTog = false;
}
}


Credits:
    
Me - Making da tutorial.
Taylor - Showing me how to make a bool function when i was a little newb.
eddie mac - The Chrome Players Offset.


Enjoy Awesome face


when i started using the bool-ens some how it disabled all my other functions in every sub menu.
still cant figure out whats the problem
01-14-2014, 09:59 PM #12
ItsMagiicsz
Bounty hunter
Originally posted by 039
when i started using the bool-ens some how it disabled all my other functions in every sub menu.
still cant figure out whats the problem


Try to explain this in more detail or skype me, i will help you.
01-14-2014, 10:01 PM #13
ItsMagiicsz
Bounty hunter
Originally posted by therifboy View Post
I recommend you to read from memory to know what the state of the mod is.


    
void mFlag(int client)//toggle between multiple options
{
int mFlag = PS3Lib.ReadInt32(playerState(client) + 0x3214);
mFlag++;
mFlag %= 5;
PS3Lib.WriteInt32(playerState(client) + 0x3214, mFlag);
}

void God(int client)//toggle between two options
{
int god = PS3Lib.ReadInt32(gEntity(client) + 0x1ACool Man (aka Tustin);
PS3Lib.WriteInt32(gEntity(client) + 0x1A8, (god != 100 ? 100 : 0x7FFFFFFF));
}

uint playerState(int client)
{
return (uint)(0xF12C80 + 0x3600 * client);
}

uint gEntity(int client)
{
return (uint)(0xDD2C80 + 0x280 * client);
}


Nice Gasp, never thought of it this way.
01-18-2014, 05:18 PM #14
Shark
Retired.
Originally posted by ItsMagiicsz View Post
Hey guys, this is a really quick release.
I am only sharing this with you guys because i cannot explain the amount of times i am asked about this.
I will just be telling you how to toggle an option and how it works Smile.
So lets get started.

Base Of Toggle Function By Me:
    
bool OptionTog;
private void Option(int client)
{
if (OptionTog == false)
{
//Put offsetsandshithere!
OptionTog = true;
}
else
{
//Put offsetsandshithere!
OptionTog = false;
}
}
I have put it like this because i know some of you newbs cannot be bothered to learn what the bool means and where you use it.


Explaining what the function does:
    
bool: this helps you to toggle the shit, remember the option name must be different from the bool name, if they are the same you may get errors as it wont know what one to read.
int client: your just stating the client, you would keep this if your menu was all client, if not it would be ' private void Option() '


How to call the function:
    
To call it is easy!
For an all client menu:
Option(client);

For a host only menu:
Option();

You must put this where the option you would select the option.


An example:
    
bool ChromePlayersTog;
private void ChromePlayers(int client)
{
if (ChromePlayersTog == false)
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x60, 0x00, 0x00, 0x00 });
ChromePlayersTog = true;
}
else
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x2C, 0x03, 0x00, 0x00 });
ChromePlayersTog = false;
}
}


Credits:
    
Me - Making da tutorial.
Taylor - Showing me how to make a bool function when i was a little newb.
eddie mac - The Chrome Players Offset.


Enjoy Awesome face


you only coded these for one client, so if another client were to click the option and it was already on true it would go back to false Needa

instead of bool WhateverM8;
use bool[] WhateverM8 = new bool[18];
this can also be done with int, uint, float whatever you want ;P


    
bool[] ChromePlayersTog = new bool[];
private void ChromePlayers(int client)
{
if (ChromePlayersTog[client] == false)
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x60, 0x00, 0x00, 0x00 });
ChromePlayersTog = true;
}
else
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x2C, 0x03, 0x00, 0x00 });
ChromePlayersTog = false;
}
}



float[] FloatArray = new float[18]; <- the number 18 doesnt have to be 18, im just using 18 seeing as there can be a max of 18 clients, this number basically decides how much room there is to store values, so if you wanted to store lets say 3 different values as a an int you could do it like this

int[] Value = new int[3]; //3 means we can store up to 3 values
Value[0] = 2; //ok so say you want to set value the first value to 2 then you would do it like this, same for 2 and 3
Value[1] = 3;
Value[2] = 4; //ok so now you have stored your values, you probably want to use them so lets say you want to print one of the values to the output

Console.Write(Value[0]);//this will write the first stored value to the console (the number 2)
So by having 18 different places to store the boolean this means there will be no confusion between clients, so if one client sets a boolean and you are using an array it will set his boolean to lets say true. Now if another client clicks on the same option it will store the boolean to his client so it wont be overwriting the other clients boolean, so because the first client set it to true when this client sets it, it wont go to false because his boolean is stored elsewhere. Hard to explain but eh hope it helps :P

Dont be a grammar nazi idgaf its 3am

The following user thanked Shark for this useful post:

ItsMagiicsz
01-23-2014, 10:57 PM #15
Notorious
Caprisuns Is Back
Originally posted by ItsMagiicsz View Post
Hey guys, this is a really quick release.
I am only sharing this with you guys because i cannot explain the amount of times i am asked about this.
I will just be telling you how to toggle an option and how it works Smile.
So lets get started.

Base Of Toggle Function By Me:
    
bool OptionTog;
private void Option(int client)
{
if (OptionTog == false)
{
//Put offsetsandshithere!
OptionTog = true;
}
else
{
//Put offsetsandshithere!
OptionTog = false;
}
}
I have put it like this because i know some of you newbs cannot be bothered to learn what the bool means and where you use it.


Explaining what the function does:
    
bool: this helps you to toggle the shit, remember the option name must be different from the bool name, if they are the same you may get errors as it wont know what one to read.
int client: your just stating the client, you would keep this if your menu was all client, if not it would be ' private void Option() '


How to call the function:
    
To call it is easy!
For an all client menu:
Option(client);

For a host only menu:
Option();

You must put this where the option you would select the option.


An example:
    
bool ChromePlayersTog;
private void ChromePlayers(int client)
{
if (ChromePlayersTog == false)
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x60, 0x00, 0x00, 0x00 });
ChromePlayersTog = true;
}
else
{
DEX.SetMemory((0x0046C0E8 + ((uint)client * 0x3600)), new byte[] { 0x2C, 0x03, 0x00, 0x00 });
ChromePlayersTog = false;
}
}


Credits:
    
Me - Making da tutorial.
Taylor - Showing me how to make a bool function when i was a little newb.
eddie mac - The Chrome Players Offset.


Enjoy Awesome face


i made a video tutorial for this do you want to see it so u can add it to the thread?
02-16-2014, 08:55 PM #16
Default Avatar
Fossd
Guest
With the naked eye andrew saw below them to the right, not more than five hundred paces from where was standing, a dense french column coming up to meet the apsheronsWell, i dont like anna mikhaylovna and i dont like boris, but they were our friends and poor You must login or register to view this content. If anyone comes meddling again, said he, emitting the words separately through his thin compressed lips, i will throw him down thereDear and precious friend, your letter of the 13th has given me great delight.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo