toribio

toribio

Nov 19th, 2008
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dutils>
  3.  
  4. public OnFilterScriptInit()
  5. {
  6.     new File:temp = fopen("temp.txt"), string[1024], modelid, Float:x, Float:y, Float:z, Float:a, cor[2];
  7.         new File:output = fopen("vehicles.sql"), i, index;
  8.     while(fread(temp, string))
  9.     {
  10.             i++;
  11.             new tmp[1024], model[256];
  12.                 strmid(model, string[strfind(string, "(", true)], 1, 5);
  13.         modelid = strval(model);
  14.         strtok(string, index, ',');
  15.         x = floatstr(strtok(string, index, ','));
  16.         y = floatstr(strtok(string, index, ','));
  17.         z = floatstr(strtok(string, index, ','));
  18.         a = floatstr(strtok(string, index, ','));
  19.         cor[0] = strval(strtok(string, index, ','));
  20.         cor[1] = strval(strtok(string, index, ','));
  21.         index = 0;
  22.         format(tmp, sizeof tmp, "INSERT INTO `cars` VALUES(%d, %d, '%.2f', '%.2f', '%.2f', '%.2f', %d, %d, \
  23.         -1, 'default', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n", i, modelid, x, y, z, a,
  24.         cor[0], cor[1]);
  25.         fwrite(output, tmp);
  26.     }
  27.     fclose(output);
  28.     fclose(temp);
  29.     return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment