Advertisement
ThreeKingz

RemoveWorldObject to RemoveBuildingForPlayer

Aug 17th, 2014
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.33 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3. #include <sscanf2>
  4.  
  5.  
  6. #define MAX_OBJECTS_TO_REMOVE   500
  7.  
  8.  
  9. enum obInfo
  10. {
  11.         Model,
  12.         Float:X,
  13.         Float:Y,
  14.         Float:Z,
  15.         Float:Radius,
  16. }
  17. new ObjectInfo[MAX_OBJECTS_TO_REMOVE][obInfo];
  18.  
  19.  
  20.  
  21. forward ConvertF(const file[]);
  22. public ConvertF(const file[])
  23. {
  24.     new File:openfile = fopen(file,io_read);
  25.     if(!openfile) return printf("File %s was not found. Please make sure you have placed it on your ScriptFiles folder.", file);
  26.     new File:newfile = fopen("RemoveBuilding.pwn",io_write);
  27.     fwrite(newfile, "public OnPlayerConnect(playerid)\r\n{\r\n");
  28.     new string[350], lods, normal, objects, object, m;
  29.     while(fread(openfile, string))
  30.     {
  31.         if(object >= sizeof(ObjectInfo)) break;
  32.         if(!sscanf(string, "'lodModel=\"'p<\">d", m))
  33.         {
  34.             if(m != 0)
  35.             {
  36.                 if(!sscanf(string, "'radius=\"'p<\">f'lodModel=\"'p<\">d'posX=\"'p<\">f'posY=\"'p<\">f'posZ=\"'p<\">f",ObjectInfo[object][Radius], ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z]))
  37.                 {
  38.                     format(string,sizeof(string),"\tRemoveBuildingForPlayer(playerid, %d, %.4f, %.4f, %.4f, %.4f);\r\n",ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z], ObjectInfo[object][Radius]);
  39.                     fwrite(newfile,string);
  40.                     lods++;
  41.                     objects++;
  42.                 }
  43.             }
  44.             else
  45.             {
  46.                 if(!sscanf(string, "'radius=\"'p<\">f'model=\"'p<\">d'posX=\"'p<\">f'posY=\"'p<\">f'posZ=\"'p<\">f",ObjectInfo[object][Radius], ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z]))
  47.                 {
  48.                     format(string,sizeof(string),"\tRemoveBuildingForPlayer(playerid, %d, %.4f, %.4f, %.4f, %.4f);\r\n",ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z], ObjectInfo[object][Radius]);
  49.                     fwrite(newfile,string);
  50.                     normal++;
  51.                     objects++;
  52.                 }
  53.             }
  54.         }
  55.     }
  56.     fwrite(newfile, "\treturn 1;\r\n}");
  57.     fclose(openfile);
  58.     fclose(newfile);
  59.     printf("Objects Converted: %d ", objects);
  60.     printf("Lod models: %d | Models: %d", lods, normal);
  61.     print("Remove Building code has been exported to RemoveBuilding.pwn");
  62.     return object;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement