problem with fread, or split...
#1

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
Reply
#2

is it possible that no one knows what is wrong here ?
Reply
#3

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

thanks, but i figured out what is problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)