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-15-2014, 12:24 AM #11
why are u writing the bytes in a file? you could just store them in a sys byte or some ware in the ps3 memory

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

RatchetBooty
03-15-2014, 12:54 AM #12
Originally posted by milky4444 View Post
why are u writing the bytes in a file? you could just store them in a sys byte or some ware in the ps3 memory


I do like the idea tho. If you wanted to make a program that you could load a txt files with certain functions
03-15-2014, 01:47 AM #13
$ticky
Banned
Originally posted by RatchetBooty View Post
Ya but there's no point, you can store the origin (position) in a static byte.


I don't think you even know what static means, if you say "static byte"
03-15-2014, 01:51 AM #14
RatchetBooty
Former Staff
Originally posted by ticky View Post
I don't think you even know what static means, if you say "static byte"


Yes I do, static means it sets the instance, and in this case you would need to make the byte static, I didn't know what else to call it, why are you pissed off all of a sudden lol.
03-15-2014, 01:57 AM #15
$ticky
Banned
Originally posted by RatchetBooty View Post
Yes I do, static means it sets the instance, and in this case you would need to make the byte static, I didn't know what else to call it, why are you pissed off all of a sudden lol.


static bytes or any static variable/void can only be used in a static instance so if you tried using a static byte[] in a non-static void it wouldn't work. All I am trying to say is that it doesnt need to be static, it can be public, public static, static, private, private static. It all just depends on how you write your scripts. Learn your shit before you talk.
Last edited by $ticky ; 03-15-2014 at 05:31 PM.
03-15-2014, 07:37 PM #16
RatchetBooty
Former Staff
Originally posted by Knife View Post
I know Ratchet...
But this is how i like to use this.
Deal with it....


Ya I know, I'm not saying there's anything wrong with the way you're doing it, I'm just saying that for a faster way and easier way you can use the way I said, but you're way is fine. I was just saying it for the people that are a bit confused with your code and might want to try out the way I said.

The following user thanked RatchetBooty for this useful post:

Shark
04-04-2014, 02:26 PM #17
Mango_Knife
In my man cave
1.10...
06-29-2015, 02:53 PM #18
Do you think you can send the whole project, I didn't understand that much

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo