Post: C# Load/Save Position And More Teleport Functions - C# TuT + Source Code - 1.10
03-14-2014, 08:45 PM #1
Mango_Knife
In my man cave
(adsbygoogle = window.adsbygoogle || []).push({}); Today im showing you guys how to code Save/Load Postion in game!
Alot of people have asked me how to do it
So here it is i release a tut of how to code it Smile

Things that are needed:
Visual Studio (Any)
Teleport Offset: 0x00f4449c
And PS3Lib.dll

Alright lets start:
First add the PS3Lib and all the other things you need to the project.

Getting Ready:
Step 1)
First we will need to code ClientInt into the tool
Put this up to your project:
You must login or register to view this content.
    
private int ClientInt = 0;
private uint ClientUInt = 0;


Step 2)
Lets make a function for the Teleport Offset on the project, insted of write the offset all the time
Add this somewhere on your project:
    
public static UInt32
TeleportOffset = 0x00f4449c;


Coding The Functions:

Now lets start to code the functions on the project that we will use to code the Save Position and the Load Position:
Add this 2 codes somewhere to your project:

Save Position:
    
#region SavePosition
private void SavePosition(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
System.IO.File.WriteAllBytes(@"Position.txt", lalal);
}
#endregion


Load Position:
On the load position you got a few options:
Teleport client to position
Teleport everyone to position

So lets code them both Awesome face :
    
#region TeleportClientToPosition
private void TeleportClientToPosition(int ClientInt)
{
byte[] lalal = System.IO.File.ReadAllBytes(@"Position.txt");
PS3.Extension.WriteBytes(TeleportOffset + ((uint)ClientInt * 0x3700), lalal);
}
#endregion


    
#region TeleportEveryoneToPosition
private void TeleportEveryoneToPosition(int ClientInt)
{
byte[] lalal = System.IO.File.ReadAllBytes(@"Position.txt");
for (uint i = 1; i < 11; i++)
{
uint allClientsOffset = (uint)TeleportOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}

We are doing "uint i = 1; i <11; i++ "wich mean it will teleport all the clients , but not the client 0 (Host)

Coding The Function Into A Button/numericUpDown/DataGridView or anything you choose:

First you will need a Save Position button or what ever you use
Insert this into the button or whatever you using:
    
SavePosition(ClientInt)//the client int is index wich mean its start's from client 0 you can choose wich client to save his position.


Now lets add this somewhere in your project If its a button or a mod menu or anything you choosed Smile
    
//This code is to teleport everyone to the saved position.
TeleportEveryoneToPosition(ClientInt);


Now lets test this:
Click on the button and it will teleport everyone to the position you choosed.

Last Thing:
You will want to delete the Positon.txt everytime you quit the tool.
So easiely click on the form and go to this option:
You must login or register to view this content.

Then just type this on the Form_Closing:
You must login or register to view this content.
    
System.IO.File.Delete(@"Position.txt");


If you want to make the load position to Auto Just put this on a timer Winky Winky
Exmple:
You must login or register to view this content.

Here are some codes that i used to teleport to diffrent places (If its teleport to me, to client and etc)

    
#region TeleportEveryoneToHost
private void TeleportEveryoneToHost(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset, 14);
for (uint i = 1; i < 11; i++)
{
uint allClientsOffset = (uint)TeleportOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}
#endregion


    
#region TeleportClientToHost
private void TeleportClientToHost(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset, 14);
PS3.Extension.WriteBytes(TeleportOffset + ((uint)ClientInt * 0x3700), lalal);
}
#endregion


    
#region TeleportHostToClient
private void TeleportHostToClient(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
PS3.Extension.WriteBytes(TeleportOffset, lalal);
}
#endregion


    
#region TeleportEveryoneToClient
private void TeleportEveryoneToClient(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
for (uint i = 1; i < 11; i++)
{
uint allClientsOffset = (uint)TeleportOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}
#endregion


FAQ's:

The "14" Is the bytes that the position.txt is saving then its sending the bytes to the other client and it teleporting him.
If you getting error with the System.IO So add this to your project: using System.IO;
If you are getting problem with this just quote what you getting hard with and i will help Smile


Credits:
Me - Teleport Offset + Function
xHostModer - Teaching me C# in old days...

Have Fun Guys Awesome face
Last edited by Mango_Knife ; 04-04-2014 at 02:26 PM. Reason: Updated to 1.10.

The following 19 users say thank you to Mango_Knife for this useful post:

ARABIC_GUY, BuC-ShoTz, ByteSource, FusionIsDaName, Hori_By_Nature, iNDMx, M-alShammary, MegaMister, MoTmrD-, moxl, nasir, John, Notorious, xProvXKiller, ThePaaqoHD, Fatality, xHostModer, zSunriseModz
03-14-2014, 08:56 PM #2
Thanks Smile
03-14-2014, 08:57 PM #3
xProvXKiller
Climbing up the ladder
omg thanks love you bro
03-14-2014, 08:57 PM #4
ByteSource
League Champion
Originally posted by Knife View Post
Today im showing you guys how to code Save/Load Postion in game!
Alot of people have asked me how to do it
So here it is i release a tut of how to code it Smile

Things that are needed:
Visual Studio (Any)
Teleport Offset: 0x00f43b1b
And PS3Lib.dll

Alright lets start:
First add the PS3Lib and all the other things you need to the project.

Getting Ready:
Step 1)
First we will need to code ClientInt into the tool
Put this up to your project:
You must login or register to view this content.
    
private int ClientInt = 0;
private uint ClientUInt = 0;


Step 2)
Lets make a function for the Teleport Offset on the project, insted of write the offset all the time
Add this somewhere on your project:
    
public static UInt32
TeleportOffset = 0x00f43b1b;


Coding The Functions:

Now lets start to code the functions on the project that we will use to code the Save Position and the Load Position:
Add this 2 codes somewhere to your project:

Save Position:
    
#region SavePosition
private void SavePosition(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
System.IO.File.WriteAllBytes(@"Position.txt", lalal);
}
#endregion


Load Position:
On the load position you got a few options:
Teleport client to position
Teleport everyone to position

So lets code them both Awesome face :
    
#region TeleportClientToPosition
private void TeleportClientToPosition(int ClientInt)
{
byte[] lalal = System.IO.File.ReadAllBytes(@"Position.txt");
PS3.Extension.WriteBytes(TeleportOffset + ((uint)ClientInt * 0x3700), lalal);
}
#endregion


    
#region TeleportEveryoneToPosition
private void TeleportEveryoneToPosition(int ClientInt)
{
byte[] lalal = System.IO.File.ReadAllBytes(@"Position.txt");
int Client1TeleportLocationOffset = 0xF4721B;
for (uint i = 0; i < 11; i++)
{
uint allClientsOffset = (uint)Client1TeleportLocationOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}

0xF4721B - This client 1 teleport offset, wich mean the teleport will teleport everyone Except client 0 (Host).

Coding The Function Into A Button/numericUpDown/DataGridView or anything you choose:

First you will need a Save Position button or what ever you use
Insert this into the button or whatever you using:
    
SavePosition(ClientInt)//the client int is index wich mean its start's from client 0 you can choose wich client to save his position.


Now lets add this somewhere in your project If its a button or a mod menu or anything you choosed Smile
    
//This code is to teleport everyone to the saved position.
TeleportEveryoneToPosition(ClientInt);


Now lets test this:
Click on the button and it will teleport everyone to the position you choosed.

Last Thing:
You will want to delete the Positon.txt everytime you quit the tool.
So easiely click on the form and go to this option:
You must login or register to view this content.

Then just type this on the Form_Closing:
You must login or register to view this content.
    
System.IO.File.Delete(@"Position.txt");


If you want to make the load position to Auto Just put this on a timer Winky Winky
Exmple:
You must login or register to view this content.

Here are some codes that i used to teleport to diffrent places (If its teleport to me, to client and etc)

    
#region TeleportEveryoneToHost
private void TeleportEveryoneToHost(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset, 14);
int Client1TeleportLocationOffset = 0xF4721B;
for (uint i = 0; i < 11; i++)
{
uint allClientsOffset = (uint)Client1TeleportLocationOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}
#endregion


    
#region TeleportClientToHost
private void TeleportClientToHost(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset, 14);
PS3.Extension.WriteBytes(TeleportOffset + ((uint)ClientInt * 0x3700), lalal);
}
#endregion


    
#region TeleportHostToClient
private void TeleportHostToClient(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
PS3.Extension.WriteBytes(TeleportOffset, lalal);
}
#endregion


    
#region TeleportEveryoneToClient
private void TeleportEveryoneToClient(int ClientInt)
{
byte[] lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
int Client1TeleportLocationOffset = 0xF4721B;//1.09 Offset Client 1 Teleport
for (uint i = 0; i < 11; i++)
{
uint allClientsOffset = (uint)Client1TeleportLocationOffset + (0x3700 * i);
PS3.Extension.WriteBytes(allClientsOffset, lalal);
}
}
#endregion


FAQ's:

The "14" Is the bytes that the position.txt is saving then its sending the bytes to the other client and it teleporting him.
If you getting error with the System.IO So add this to your project: using System.IO;
If you are getting problem with this just quote what you getting hard with and i will help Smile


Credits:
Me - Teleport Offset + Function
xHostModer - Teaching me C# in old days...

Have Fun Guys Awesome face


no to be mean mango but yeaa kids that just started wont pass step 2.
03-14-2014, 08:57 PM #5
GodJob Man
03-14-2014, 09:02 PM #6
BuC-ShoTz
TeamMvKâ?¢
nice work, just wanna ask why write the bytes to a file?
    
private byte[] lalal;
private void SavePosition(int ClientInt)
{
lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
}

the position with be available when the app is open at all times...
Last edited by BuC-ShoTz ; 03-14-2014 at 09:05 PM.

The following user thanked BuC-ShoTz for this useful post:

ItsLollo1000
03-14-2014, 09:05 PM #7
Mango_Knife
In my man cave
Originally posted by ShoTz View Post
nice work, just wanna ask why write the bytes to a file?
    
private byte[] lalal;
private void SavePosition(int ClientInt)
{
lalal = PS3.Extension.ReadBytes(TeleportOffset + ((uint)ClientInt * 0x3700), 14);
System.IO.File.WriteAllBytes(@"Position.txt", lalal);
}

the position with be available when the app is open at all times...


Thanks man Smile
And yeah i know
That's why i posted this ^^

You must login or register to view this content.

So it deleting the Position.txt when the app close.
03-14-2014, 09:07 PM #8
SC58
Former Staff
Or you could use this function

    
TeleportPlayer(gentity_s *player, float *origin, float *angles)

The following 2 users say thank you to SC58 for this useful post:

ErasedDev, ItsLollo1000
03-14-2014, 09:10 PM #9
RatchetBooty
Former Staff
Originally posted by Knife View Post
Thanks man Smile
And yeah i know
That's why i posted this ^^

You must login or register to view this content.

So it deleting the Position.txt when the app close.

Ya but there's no point, you can store the origin (position) in a static byte.
03-14-2014, 09:14 PM #10
Mango_Knife
In my man cave
Originally posted by RatchetBooty View Post
Ya but there's no point, you can store the origin (position) in a static byte.


I know Ratchet...
But this is how i like to use this.
Deal with it....

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

$ticky, nasir, John, Notorious, xProvXKiller, zSunriseModz

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo