28.02.2017, 20:20
(
Последний раз редактировалось faxxe; 01.03.2017 в 11:52.
)
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.
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
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; }
![Cheesy](images/smilies/biggrin.png)