Quantcast

Jump to content

» «
Photo

Save to .txt file

4 replies to this topic
Fantaseb
  • Fantaseb

    One Nation, One Love, But Who? ;)

  • BUSTED!
  • Joined: 17 Oct 2011

#1

Posted 13 April 2012 - 09:59 PM Edited by Fantaseb, 13 April 2012 - 10:23 PM.

How can I make my saved object save there X, Y, Z Co-ordinates in C++? So say I place a object on the map how can I save the X, Y, Z co-ordinates to a another file like simple native trainer does. I have tried a few things but they are not right, so I scrapped the idea, and came and asked on here....

I know C++ and I am lost, it's just weird trying to save it.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • None

#2

Posted 14 April 2012 - 11:20 AM

uhm

Fantaseb
  • Fantaseb

    One Nation, One Love, But Who? ;)

  • BUSTED!
  • Joined: 17 Oct 2011

#3

Posted 14 April 2012 - 11:25 AM

QUOTE (Bad.boy! @ Saturday, Apr 14 2012, 11:20)
uhm

I tried that, and it never worked.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • None

#4

Posted 14 April 2012 - 12:03 PM

Try this (sorry if it's wrong I only do C#)
CODE
float objectx, objecty, objectz; // Store coords to these values
myfile.open ("coords.txt"); // You'll have to create one if it doesn't exist
buffer << objectx;
string sobjectx = buffer.str();
buffer << objecty;
string sobjecty = buffer.str();
buffer << objecty;
string sobjectz = buffer.str();
sobjectx += "\n";
sobjecty += "\n";
sobjectz += "\n";
myfile << sobjectx;
myfile << sobjecty;
myfile << sobjectz;
myfile.close();

Fantaseb
  • Fantaseb

    One Nation, One Love, But Who? ;)

  • BUSTED!
  • Joined: 17 Oct 2011

#5

Posted 14 April 2012 - 02:20 PM

QUOTE (Bad.boy! @ Saturday, Apr 14 2012, 12:03)
Try this (sorry if it's wrong I only do C#)
CODE
float objectx, objecty, objectz; // Store coords to these values
myfile.open ("coords.txt"); // You'll have to create one if it doesn't exist
buffer << objectx;
string sobjectx = buffer.str();
buffer << objecty;
string sobjecty = buffer.str();
buffer << objecty;
string sobjectz = buffer.str();
sobjectx += "\n";
sobjecty += "\n";
sobjectz += "\n";
myfile << sobjectx;
myfile << sobjecty;
myfile << sobjectz;
myfile.close();

Thanks I re-done that code and it worked biggrin.gif Cheers buddy smile.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users