27.08.2014, 04:16
Just add the RemoveBuildingForPlayer code in somefile.txt in your scriptfiles folder.
Compile the above code and run it as a gamemode. The code wll be exported to WorldObject.txt
PHP код:
#include <a_samp>
#include <sscanf2>
main()
{
ConvertF("somefile.txt");
}
public OnGameModeInit()
{
return 1;
}
#define MAX_OBJECTS_TO_REMOVE 500
enum obInfo
{
Model,
Float:X,
Float:Y,
Float:Z,
Float:Radius,
}
new ObjectInfo[MAX_OBJECTS_TO_REMOVE][obInfo];
forward ConvertF(const file[]);
public ConvertF(const file[])
{
new File:openfile = fopen(file,io_read);
if(!openfile) return printf("File %s was not found. Please make sure you have placed it on your ScriptFiles folder.", file);
new File:newfile = fopen("WorldObject.txt",io_write);
new string[600], lods, objects, object, kk[50];
while(fread(openfile, string))
{
if(object >= sizeof(ObjectInfo)) break;
if(!sscanf(string, "P<(),>{s[2]}'playerid'dffff", ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z], ObjectInfo[object][Radius]))
{
format(string,sizeof(string),"\t<removeWorldObject id=\"removeWorldObject (sm_fir_copse1) (25)\" radius=\"%f\" interior=\"0\" model=\"%d\" lodModel=\"%d\" posX=\"%f\" posY=\"%f\" posZ=\"%f\" rotX=\"0\" rotY=\"0\" rotZ=\"0\"></removeWorldObject>\r\n",ObjectInfo[object][Radius], ObjectInfo[object][Model], ObjectInfo[object][Model], ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z]);
fwrite(newfile,string);
object++;
}
}
fwrite(newfile,"a");
fclose(openfile);
fclose(newfile);
printf("Code exported to WorldObject.txt. Objects converted: %d", object);
return object;
}