SA-MP Forums Archive
problem with fread, or split... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with fread, or split... (/showthread.php?tid=266881)



problem with fread, or split... - CoaPsyFactor - 06.07.2011

Hi there,

So I have one problem, when I add SpeedCam, if it is only one in file, server load it normal, but if there is 2 or more, server just say UNKNOWN COMMAND, so here is code for reading and adding speedcams

pawn Код:
public AddSpeedCam(playerid, speed){
    new Float:X, Float:Y, Float:Z, scString[128];
    new File:SpeedCamsFile = fopen("speedcams.txt", io_append);
    GetPlayerPos(playerid, X, Y, Z);
    format(scString, sizeof(scString), "%f,%f,%f,%d\n", X, Y, Z, speed);
    fwrite(SpeedCamsFile, scString);
    fclose(SpeedCamsFile);
    return 1;
}
public LoadSpeedCams(){
    print("Loading SpeedCams...");
    new String_SC[256], Split_String[5][20], SC;
    if(!dini_Exists("speedcams.txt")){
        return 1;
    }
    SC = 0;
    new File:LoadSC = fopen("speedcams.txt", io_read);
    while(fread(LoadSC, String_SC)){
        printf("%s", String_SC);
        split(String_SC, Split_String, ',');
        SpeedCams[SC][scX] = floatstr(Split_String[0]);
        SpeedCams[SC][scY] = floatstr(Split_String[1]);
        SpeedCams[SC][scZ] = floatstr(Split_String[2]);
        SpeedCams[SC][scMax_Speed] = strval(Split_String[3]);
        SC++;
    }
    fclose(LoadSC);
    return 1;
}
if any one know how to help me, please do that


Re: problem with fread, or split... - CoaPsyFactor - 07.07.2011

is it possible that no one knows what is wrong here ?


Re: problem with fread, or split... - Memoryz - 07.07.2011

try this http://forum.sa-mp.com/showthread.ph...wpost&t=262796


Re: problem with fread, or split... - CoaPsyFactor - 07.07.2011

thanks, but i figured out what is problem