Can someone help me with sscanf?
#1

Hi,
Sorry for my ignorance at sscanf.
I'm trying to make a converter from MTA code to samp but it doesn't work..

PHP код:
forward Convert(file[]);
public 
Convert(file[])
{
    if (!
fexist(file)) return printf("File %s was not found. Please make sure you have placed it on your ScriptFiles folder."file);
    new 
File:openfile fopen(file);
    new 
string[4000], string2[4000], playeridobjcount;
    while(
fread(openfilestring))
    {
        for(new 
idk 0idk sizeof(rObj); idk++)
        {
            if(!
sscanf(string"'model='d'posX='f'posY='f'posZ='f'rX='f'rY='f'rZ='f",rObj[idk][modelid_],rObj[idk][x_],rObj[idk][y_],rObj[idk][z_],rObj[idk][rX], rObj[idk][rY], rObj[idk][rZ]))
            {
                
objcount++;
                new 
File:newfile fopen("Objects.pwn",io_write);
                
fwrite(newfile"public OnGameModeInit()\n{\n");
                
format(string,sizeof(string),"    CreateObject(%d, %f, %f, %f, %f, %f, %f);\n",rObj[idk][modelid_], rObj[idk][x_], rObj[idk][y_], rObj[idk][z_], rObj[idk][rX], rObj[idk][rY], rObj[idk][rZ]);
                
strcat(string2,string);
                
printf("%s"string);
                
fwrite(newfile,string2);
                
fwrite(newfile"    return 1;\n}");
                
fclose(newfile);
            }
        }
    }
    
fclose(openfile);
    
printf("%d objects were converted from '%s' to Converted.pwn (Saved in Scriptfiles folder)",objcountfile);
    return 
objcount;

Reply


Messages In This Thread
Can someone help me with sscanf? - by Magic_Time - 05.08.2013, 23:12
Re: Can someone help me with sscanf? - by Jefff - 05.08.2013, 23:24
Re: Can someone help me with sscanf? - by Magic_Time - 05.08.2013, 23:35
Re: Can someone help me with sscanf? - by Jefff - 06.08.2013, 00:14
Re: Can someone help me with sscanf? - by ThePhenix - 06.08.2013, 04:48

Forum Jump:


Users browsing this thread: 1 Guest(s)