Need Help With FRWRITE
#1

Hello i need help with fwrite , i am not used it but i tryid to use it , i wanna save the cp defines per row to the ini file..

my script:
if someone have a suggestions how to fix this , the cmd writes only one line , and no more.. just rewriting the one line.
pawn Код:
dcmd_cp(playerid, params[])
{
    new reason[128]; new string[256];

    if (sscanf(params, "z", reason)) return SendClientMessage(playerid,0xFFFFFF60, "Kasuta: /cp <nimi>");
   
    if (GetPlayerState(playerid) == 2)
    {
        new stringid[2012]; // Oo jaa..
        new stringid2[2012]; // Maailmalхpp
       
        new Float:XP,Float:YP,Float:ZP;
        new RedNeckiAuto = GetPlayerVehicleID(playerid);

        GetVehiclePos(RedNeckiAuto,XP,YP,ZP);

        new File:fhnd;
       
       
        format(stringid2,2012,"%s",fread(fhnd, stringid2, -1));
       
        format(stringid,2012,"%s\r\n#define %s %0.3f,%0.3f,%0.3f\r\n",stringid2,reason,XP,YP,ZP);

        format(string, 300, "Checkpoint: {FFF45F}%s {FFFFFF}On Salvestatud! X: {FFF45F}%0.3f {FFFFFF}| Y: {FFF45F}%0.3f {FFFFFF}| Z: {FFF45F}%0.3f", reason,XP,YP,ZP);
        SendClientMessage(playerid, 0xFFFFFF60, string);

        SetPlayerRaceCheckpoint(playerid, 2, XP,YP,ZP, XP,YP,ZP, 15.0);
       
       
        format(string, 256, "Checkpointid.ini");
        fhnd=fopen(string ,io_write);
        fwrite(fhnd, stringid);
        fwrite(fhnd, "\n");
        fclose(fhnd);


    }
   
    return 1;
}
Reply


Messages In This Thread
Need Help With FRWRITE - by titanak - 23.10.2011, 22:44
Re: Need Help With FRWRITE - by blewert - 23.10.2011, 23:06
Re: Need Help With FRWRITE - by titanak - 23.10.2011, 23:14

Forum Jump:


Users browsing this thread: 1 Guest(s)