Problem with files
#1

pawn Код:
if (strcmp("/Exportallveh", cmdtext, true, 10) == 0)
    {
      for(new c=0;c<MAX_VEHICLES;c++)
      {
        new Float:ca,Float:cb,Float:cc;
        GetVehiclePos(c,ca,cb,cc);
        new carloop[256];
        new vehid = GetVehicleModel(c);
        new rand1 = random(80);
        new rand2 = random(10);
        format(carloop, sizeof(carloop), "AddStaticVehicle(%s,%s,%s,%s,%s,%s,%s);\n",vehid,ca,cb,cc+1,0,rand1,rand2);
        new File:hFile;
            hFile = fopen("allcars.txt", io_append);
            fwrite(hFile, carloop);
            fclose(hFile);
      }
        return 1;

Код:
AddStaticVehicle(,,,AddStaticVehicle(,b,b,у,,L,);
AddStaticVehicle(:,b,b,у,,:,	:);
AddStaticVehicle(:,b,b,у,,8:,8:);
AddStaticVehicle(:,b,b,у,,5:,5:);
AddStaticVehicle(,q,™q,;,,,);
AddStaticVehicle(:,q,™q,;,,@:,@:);
AddStaticVehicle(:,q,™q,;,,:,:);
AddStaticVehicle(:,q,™q,;,,2:,2:);
AddStaticVehicle(,*	,ж*	,u,,	,	);
AddStaticVehicle(:,*
,ж*
,u,,*:,*:);
AddStaticVehicle(:,*,ж*,u,,(:,(:);
AddStaticVehicle(:,*,ж*,u,,/:,/:);
AddStaticVehicle(A,Т
,ЇТ
,L,,A,A);
AddStaticVehicle(A,,Ф,Ћ,,+A,+A);
AddStaticVehicle(A,#,x#,·,,2A,2A);
AddStaticVehicle(V,–,µ–,E,,V,	V);
AddStaticVehicle(к,†,о†,',,к,	к);
AddStaticVehicle(к,H,њH,Г,,#к,#к);
AddStaticVehicle(к,µ,µ,•,,Hк,Hк);
AddStaticVehicle(V,Э,TЭ,R,,!V,!V);
AddStaticVehicle(V,$,Ґ$,Р,,MV,MV);
AddStaticVehicle(,ш,iш,AddStaticVehicle(к,t,^t,в,,к,к);
AddStaticVehicle(к,z,fz,є,,к,к);
AddStaticVehicle(V,ў,ў,,,V,V);
AddStaticVehicle(,Ѓ,®Ѓ,,,@,@);
AddStaticVehicle( ,Д,Д,>,, , );
What is the problem ?
Reply
#2

https://sampwiki.blast.hk/wiki/Format
Reply
#3

Oh my God, i have never seen a bigger fail.

You putted everything as string - (%s)
but those are integers - (%i, %d) and floats - (%f)

pawn Код:
format(carloop, sizeof(carloop), "AddStaticVehicle(%i,%.3f,%.3f,%.3f,%.3f,%i,%i);\n", vehid, ca, cb, cc+1.0, 0.0, rand1, rand2);
and you don't need 256 cells, so change it to 128 (even 128 is too much for this):
pawn Код:
new carloop[128];
Reply
#4

also for random car colors, just use -1 or 255 as the color id and it will choose a random color from the SA defaults for each vehicle
Reply
#5

Thnx alot .
Works fine now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)