C++ to pawn - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: C++ to pawn (
/showthread.php?tid=614841)
C++ to pawn -
cyberlord - 13.08.2016
Hello guys need help by converting c++ into pawn i write a little script witch just tells what do i want to do in pawn
Код:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const string src = "scriptfile/enterexit/ex.txt";
const int amax = 100;
struct EnterExit{
int id;
int type;
float x;
float y;
float z;
float dx;
float dy;
float dz;
float angle;
};
void fileRead(const string fn,EnterExit v[]);
int main()
{
EnterExit v[amax];
fileRead(src,v);
return 0;
}
void fileRead(const string fn,EnterExit v[]){
int a = 0;
ifstream fin(fn.c_str());
while(!fin.eof()){
fin >> v[a].id >> v[a].type >> v[a].x >> v[a].y >> v[a].z >> v[a].dx >> v[a].dy >> v[a].dz >> v[a].angle;
a++;
}
fin.close();
}
so this is just a basic code to read pickup cordinates id ant type from txt file and store them into array witch i will use later to create a enterexits pickups , the hardest part for me to do this into pawn is a file reading