Convert Objects into another format
#1

Ahoy friends

Currently i want to convert huge amounts of CreateObjects into MTA Server objects vise versa.
Unfortunately these online converter stuff doesnt work with more than 40000 Objects so i tried to write something in PAWN to realize that.

Код:
#include <a_samp>
#include <sscanf2>
#include <file>





main ()
{
	new str[1024]; 
	new File:example = fopen("createobject.txt", io_read);
	new i=0;
	while(fread(example, str))
	{
		new string[512];
		i++;
		new modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0;
		new CreateObjectString[1024];
		format(string, sizeof(string), "%s %s", string, str);
		if(sscanf(string, "ifffffff", modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance))
		format(CreateObjectString,sizeof(CreateObjectString),"<object id="%d" breakable="true" interior="0" collisions="true" alpha="255" model="%d" doublesided="false" scale="1" dimension="0" posX="%f" posY="%f" posZ="%f" rotX="%f" rotY="%f" rotZ="%f"></object>",i, modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
		new File:handle = fopen("output.txt", io_write);

		
		if(handle)
		{
			
			fwrite(handle,CreateObjectString);


			fclose(handle);
		}
		else
		{
			print("Failed to open file");
		}
		
		
	}
	fclose(example); 
	printf("%s",string);
	return 0x01;
	
	
}
Unfortunately it doesnt seem to work because of the string length maybe? Is it better to write it in C instead? Is there a similiar sscanf function in C? Maybe someone can help me
Reply


Messages In This Thread
Convert Objects into another format (sscanf) - by faxxe - 28.02.2017, 20:20
Re: Convert Objects into another format - by Toroi - 28.02.2017, 20:30
Re: Convert Objects into another format - by faxxe - 28.02.2017, 20:32
Re: Convert Objects into another format - by Vince - 28.02.2017, 20:48
Re: Convert Objects into another format - by faxxe - 28.02.2017, 21:03
Re: Convert Objects into another format - by faxxe - 01.03.2017, 07:30

Forum Jump:


Users browsing this thread: 1 Guest(s)